[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 13:19:06 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 788fb3354fb0c854483c24d599be2ffa55d4ddd4
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Sep 11 00:47:30 2010 +0000
2010-09-10 Cosmin Truta <ctruta at chromium.org>
Reviewed by Nikolas Zimmermann.
getBoundingClientRect Broken for SVG Elements
https://bugs.webkit.org/show_bug.cgi?id=42815
Added tests for getBoundingClientRect applied to SVG elements.
* svg/custom/getBoundingClientRect.xhtml: Added
* svg/custom/getBoundingClientRect-expected.txt: Added
2010-09-10 Cosmin Truta <ctruta at chromium.org>
Reviewed by Nikolas Zimmermann.
getBoundingClientRect Broken for SVG Elements
https://bugs.webkit.org/show_bug.cgi?id=42815
Use getBBox to retrieve the bounding rectangle for SVG elements.
Test: svg/dom/getBoundingClientRect.xhtml
* dom/Element.cpp:
(Element::getBoundingClientRect):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index e21af88..431f114 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-10 Cosmin Truta <ctruta at chromium.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ getBoundingClientRect Broken for SVG Elements
+ https://bugs.webkit.org/show_bug.cgi?id=42815
+
+ Added tests for getBoundingClientRect applied to SVG elements.
+
+ * svg/custom/getBoundingClientRect.xhtml: Added
+ * svg/custom/getBoundingClientRect-expected.txt: Added
+
2010-09-10 Jian Li <jianli at chromium.org>
Update mac/Skipped to include the bug numbers for newly added skip entries.
diff --git a/LayoutTests/svg/custom/getBoundingClientRect-expected.txt b/LayoutTests/svg/custom/getBoundingClientRect-expected.txt
new file mode 100644
index 0000000..535a7b1
--- /dev/null
+++ b/LayoutTests/svg/custom/getBoundingClientRect-expected.txt
@@ -0,0 +1,38 @@
+This test checks getBoundingClientRect() on a rectangle
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Checking a rectangle of absolute size at absolute coordinates:
+PASS r1.left is 20
+PASS r1.top is 30
+PASS r1.width is 40
+PASS r1.height is 50
+PASS r1.right is 60
+PASS r1.bottom is 80
+
+Checking a resized rectangle at relative coordinates:
+PASS r2.left is 180
+PASS r2.top is 15
+PASS r2.width is 160
+PASS r2.height is 25
+PASS r2.right is 340
+PASS r2.bottom is 40
+
+Checking rectangles with overflow:
+PASS r3.left is 300
+PASS r3.top is 0
+PASS r3.width is 210
+PASS r3.height is 50
+PASS r3.right is 510
+PASS r3.bottom is 50
+PASS r4.left is 300
+PASS r4.top is 50
+PASS r4.width is 210
+PASS r4.height is 60
+PASS r4.right is 510
+PASS r4.bottom is 110
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/custom/getBoundingClientRect.xhtml b/LayoutTests/svg/custom/getBoundingClientRect.xhtml
new file mode 100644
index 0000000..20175e3
--- /dev/null
+++ b/LayoutTests/svg/custom/getBoundingClientRect.xhtml
@@ -0,0 +1,73 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"/>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body style="margin:0; border:0; padding:0;">
+
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
+ width="100px" height="100px">
+ <rect id="r1" x="20" y="30" width="40" height="50" fill="blue" />
+</svg><svg xmlns="http://www.w3.org/2000/svg" version="1.1"
+ width="200px" height="100px" viewBox="0 0 50 200"
+ preserveAspectRatio="none">
+ <rect id="r2" x="20" y="30" width="40" height="50" fill="green" />
+</svg><svg xmlns="http://www.w3.org/2000/svg" version="1.1"
+ width="200px" height="100px">
+ <svg x="0" y="0" width="100px" height="100px">
+ <rect id="r3" x="0" y="0" width="210px" height="50px" fill="yellow" overflow="hidden" />
+ <rect id="r4" x="0" y="50px" width="210px" height="60px" fill="orange" overflow="visible" />
+ </svg>
+</svg>
+
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+
+description("This test checks getBoundingClientRect() on a rectangle");
+
+debug("Checking a rectangle of absolute size at absolute coordinates:");
+var r1 = document.getElementById("r1").getBoundingClientRect();
+shouldBe('r1.left', '20');
+shouldBe('r1.top', '30');
+shouldBe('r1.width', '40');
+shouldBe('r1.height', '50');
+shouldBe('r1.right', '60');
+shouldBe('r1.bottom', '80');
+debug("");
+
+debug("Checking a resized rectangle at relative coordinates:");
+var r2 = document.getElementById("r2").getBoundingClientRect();
+shouldBe('r2.left', '180');
+shouldBe('r2.top', '15');
+shouldBe('r2.width', '160');
+shouldBe('r2.height', '25');
+shouldBe('r2.right', '340');
+shouldBe('r2.bottom', '40');
+debug("");
+
+debug("Checking rectangles with overflow:");
+var r3 = document.getElementById("r3").getBoundingClientRect();
+shouldBe('r3.left', '300');
+shouldBe('r3.top', '0');
+shouldBe('r3.width', '210');
+shouldBe('r3.height', '50');
+shouldBe('r3.right', '510');
+shouldBe('r3.bottom', '50');
+var r4 = document.getElementById("r4").getBoundingClientRect();
+shouldBe('r4.left', '300');
+shouldBe('r4.top', '50');
+shouldBe('r4.width', '210');
+shouldBe('r4.height', '60');
+shouldBe('r4.right', '510');
+shouldBe('r4.bottom', '110');
+debug("");
+
+successfullyParsed = true;
+
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 00ead9b..57d3bfd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-10 Cosmin Truta <ctruta at chromium.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ getBoundingClientRect Broken for SVG Elements
+ https://bugs.webkit.org/show_bug.cgi?id=42815
+
+ Use getBBox to retrieve the bounding rectangle for SVG elements.
+
+ Test: svg/dom/getBoundingClientRect.xhtml
+
+ * dom/Element.cpp:
+ (Element::getBoundingClientRect):
+
2010-09-09 Jer Noble <jer.noble at apple.com>
Reviewed by Eric Carlson.
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index 54dad27..c7086c8 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -50,6 +50,7 @@
#include "RenderLayer.h"
#include "RenderView.h"
#include "RenderWidget.h"
+#include "SVGStyledLocatableElement.h"
#include "Settings.h"
#include "TextIterator.h"
#include "XMLNames.h"
@@ -476,12 +477,22 @@ PassRefPtr<ClientRectList> Element::getClientRects() const
PassRefPtr<ClientRect> Element::getBoundingClientRect() const
{
document()->updateLayoutIgnorePendingStylesheets();
- RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject();
- if (!renderBoxModelObject)
- return ClientRect::create();
Vector<FloatQuad> quads;
- renderBoxModelObject->absoluteQuads(quads);
+ if (isSVGElement()) {
+ // Get the bounding rectangle from the SVG model.
+ const SVGElement* svgElement = static_cast<const SVGElement*>(this);
+ if (svgElement->isStyledLocatable()) {
+ if (renderer()) {
+ const FloatRect& localRect = static_cast<const SVGStyledLocatableElement*>(svgElement)->getBBox();
+ quads.append(renderer()->localToAbsoluteQuad(localRect));
+ }
+ }
+ } else {
+ // Get the bounding rectangle from the box model.
+ if (renderBoxModelObject())
+ renderBoxModelObject()->absoluteQuads(quads);
+ }
if (quads.isEmpty())
return ClientRect::create();
@@ -495,7 +506,8 @@ PassRefPtr<ClientRect> Element::getBoundingClientRect() const
result.move(-visibleContentRect.x(), -visibleContentRect.y());
}
- adjustIntRectForAbsoluteZoom(result, renderBoxModelObject);
+ if (renderBoxModelObject())
+ adjustIntRectForAbsoluteZoom(result, renderBoxModelObject());
return ClientRect::create(result);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list