[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 16:38:51 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 8028c0605a6c36977db4def31582cd803223d4ea
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 29 21:37:39 2010 +0000
2010-11-29 Cosmin Truta <ctruta at chromium.org>
Reviewed by Nikolas Zimmermann.
getBoundingClientRect: Do not truncate the coordinates to integers
https://bugs.webkit.org/show_bug.cgi?id=48110
Enhanced some of the tests for getBoundingClientRect, and added zooming tests.
* css3/zoom-coords-expected.txt: Updated.
* css3/zoom-coords.xhtml: Wrapped the <svg> elements in a <div>,
to avoid re-layout on zooming or resizing.
Added a test for getBoundingClientRect on unzoomed elements.
* fast/dom/Element/getBoundingClientRect-expected.txt: Updated.
* fast/dom/Element/getBoundingClientRect.html: Accounted for non-integer coordinates;
used the Ahem font for uniform results; removed the hard-coded dependencies on font metrics.
* fast/dom/Range/getBoundingClientRect-expected.txt: Updated.
* fast/dom/Range/getBoundingClientRect.html: Accounted for non-integer coordinates;
used the Ahem font for uniform results; removed the hard-coded dependencies on font metrics.
* platform/chromium-win/fast/dom/Element/getBoundingClientRect-expected.txt: Deleted.
* platform/chromium-win/fast/dom/Range/getBoundingClientRect-expected.txt: Deleted.
* svg/custom/getBBox-js.svg: Fixed indentation.
* svg/custom/getBoundingClientRect.xhtml: Wrapped the <svg> elements in a <div>,
to avoid re-layout on zooming or resizing.
* svg/zoom/page/zoom-getBoundingClientRect-expected.txt: Added.
* svg/zoom/page/zoom-getBoundingClientRect.xhtml: Added.
* svg/zoom/page/zoom-zoom-coords-expected.txt: Added.
* svg/zoom/page/zoom-zoom-coords.xhtml: Added.
* svg/zoom/resources/testPageZoom.js: Added call to completeDynamicTest on post-zoom.
(completeDynamicTest): Added.
2010-11-29 Cosmin Truta <ctruta at chromium.org>
Reviewed by Nikolas Zimmermann.
getBoundingClientRect: Do not truncate the coordinates to integers
https://bugs.webkit.org/show_bug.cgi?id=48110
Remove the float-to-int coordinate conversions inside getBoundingClientRect,
to comply with the CSSOM View Module API.
Tests: fast/dom/Element/getBoundingClientRect.html
fast/dom/Range/getBoundingClientRect.html
svg/zoom/page/zoom-getBoundingClientRect.xhtml
svg/zoom/page/zoom-zoom-coords.xhtml
* dom/ClientRect.cpp:
(WebCore::ClientRect::ClientRect): Added overload to allow a FloatRect argument.
* dom/ClientRect.h:
(WebCore::ClientRect::create): Ditto.
* dom/Element.cpp:
(Element::getBoundingClientRect): Removed conversion from FloatRect to IntRect.
* dom/Range.cpp:
(WebCore::Range::getBoundingClientRect): Ditto.
* rendering/RenderObject.h:
(adjustIntRectForAbsoluteZoom): Removed.
(adjustFloatRectForAbsoluteZoom): Added.
* rendering/style/RenderStyle.h:
(adjustFloatForAbsoluteZoom): Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72826 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 33804e8..4f9ab7e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,34 @@
+2010-11-29 Cosmin Truta <ctruta at chromium.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ getBoundingClientRect: Do not truncate the coordinates to integers
+ https://bugs.webkit.org/show_bug.cgi?id=48110
+
+ Enhanced some of the tests for getBoundingClientRect, and added zooming tests.
+
+ * css3/zoom-coords-expected.txt: Updated.
+ * css3/zoom-coords.xhtml: Wrapped the <svg> elements in a <div>,
+ to avoid re-layout on zooming or resizing.
+ Added a test for getBoundingClientRect on unzoomed elements.
+ * fast/dom/Element/getBoundingClientRect-expected.txt: Updated.
+ * fast/dom/Element/getBoundingClientRect.html: Accounted for non-integer coordinates;
+ used the Ahem font for uniform results; removed the hard-coded dependencies on font metrics.
+ * fast/dom/Range/getBoundingClientRect-expected.txt: Updated.
+ * fast/dom/Range/getBoundingClientRect.html: Accounted for non-integer coordinates;
+ used the Ahem font for uniform results; removed the hard-coded dependencies on font metrics.
+ * platform/chromium-win/fast/dom/Element/getBoundingClientRect-expected.txt: Deleted.
+ * platform/chromium-win/fast/dom/Range/getBoundingClientRect-expected.txt: Deleted.
+ * svg/custom/getBBox-js.svg: Fixed indentation.
+ * svg/custom/getBoundingClientRect.xhtml: Wrapped the <svg> elements in a <div>,
+ to avoid re-layout on zooming or resizing.
+ * svg/zoom/page/zoom-getBoundingClientRect-expected.txt: Added.
+ * svg/zoom/page/zoom-getBoundingClientRect.xhtml: Added.
+ * svg/zoom/page/zoom-zoom-coords-expected.txt: Added.
+ * svg/zoom/page/zoom-zoom-coords.xhtml: Added.
+ * svg/zoom/resources/testPageZoom.js: Added call to completeDynamicTest on post-zoom.
+ (completeDynamicTest): Added.
+
2010-11-29 Ojan Vafai <ojan at chromium.org>
Unreviewed build fix.
diff --git a/LayoutTests/css3/zoom-coords-expected.txt b/LayoutTests/css3/zoom-coords-expected.txt
index 7162390..3ebe9c9 100644
--- a/LayoutTests/css3/zoom-coords-expected.txt
+++ b/LayoutTests/css3/zoom-coords-expected.txt
@@ -1,9 +1,14 @@
Test
Test
+Test
This test checks getBoundingClientRect() on zoomed HTML and SVG elements
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+Gray rectangles: 100x50
+Green rectangles: 100x50, zoom=200%
+Blue rectangles: 200x100, zoom=50%
+
Checking HTML elements:
PASS div1.left is 0
@@ -14,63 +19,95 @@ PASS div1.right is 100
PASS div1.bottom is 50
PASS div2.left is 0
-PASS div2.top is 200
-PASS div2.width is 200
-PASS div2.height is 100
-PASS div2.right is 200
-PASS div2.bottom is 300
+PASS div2.top is 25
+PASS div2.width is 100
+PASS div2.height is 50
+PASS div2.right is 100
+PASS div2.bottom is 75
+
+PASS div3.left is 0
+PASS div3.top is 300
+PASS div3.width is 200
+PASS div3.height is 100
+PASS div3.right is 200
+PASS div3.bottom is 400
Checking SVG elements:
PASS svg1.left is 0
-PASS svg1.top is 75
+PASS svg1.top is 250
PASS svg1.width is 150
PASS svg1.height is 50
PASS svg1.right is 150
-PASS svg1.bottom is 125
+PASS svg1.bottom is 300
PASS rect1.left is 0
-PASS rect1.top is 75
+PASS rect1.top is 250
PASS rect1.width is 100
PASS rect1.height is 50
PASS rect1.right is 100
-PASS rect1.bottom is 125
+PASS rect1.bottom is 300
PASS image1.left is 100
-PASS image1.top is 75
+PASS image1.top is 250
PASS image1.width is 50
PASS image1.height is 25
PASS image1.right is 150
-PASS image1.bottom is 100
-PASS text1.left == 100 is true
-PASS text1.top >= 75 is true
-PASS text1.width > 0 is true
-PASS text1.height > 0 is true
-PASS text1.right > 100 is true
-PASS text1.bottom > 75 is true
+PASS image1.bottom is 275
+PASS text1.left is 100
+PASS text1.top is 282.5
+PASS text1.width is 48
+PASS text1.height is 6
+PASS text1.right is 148
+PASS text1.bottom is 288.5
+
+PASS svg2.left is 75
+PASS svg2.top is 100
+PASS svg2.width is 150
+PASS svg2.height is 50
+PASS svg2.right is 225
+PASS svg2.bottom is 150
+PASS rect2.left is 75
+PASS rect2.top is 100
+PASS rect2.width is 100
+PASS rect2.height is 50
+PASS rect2.right is 175
+PASS rect2.bottom is 150
+PASS image2.left is 175
+PASS image2.top is 100
+PASS image2.width is 50
+PASS image2.height is 25
+PASS image2.right is 225
+PASS image2.bottom is 125
+PASS text2.left is 175
+PASS text2.top is 132.5
+PASS text2.width is 48
+PASS text2.height is 6
+PASS text2.right is 223
+PASS text2.bottom is 138.5
-PASS svg2.left is 600
-PASS svg2.top is 400
-PASS svg2.width is 300
-PASS svg2.height is 100
-PASS svg2.right is 900
-PASS svg2.bottom is 500
-PASS rect2.left is 600
-PASS rect2.top is 400
-PASS rect2.width is 200
-PASS rect2.height is 100
-PASS rect2.right is 800
-PASS rect2.bottom is 500
-PASS image2.left is 800
-PASS image2.top is 400
-PASS image2.width is 100
-PASS image2.height is 50
-PASS image2.right is 900
-PASS image2.bottom is 450
-PASS text2.left == 800 is true
-PASS text2.top >= 400 is true
-PASS text2.width > 0 is true
-PASS text2.height > 0 is true
-PASS text2.right > 800 is true
-PASS text2.bottom > 400 is true
+PASS svg3.left is 900
+PASS svg3.top is 500
+PASS svg3.width is 300
+PASS svg3.height is 100
+PASS svg3.right is 1200
+PASS svg3.bottom is 600
+PASS rect3.left is 900
+PASS rect3.top is 500
+PASS rect3.width is 200
+PASS rect3.height is 100
+PASS rect3.right is 1100
+PASS rect3.bottom is 600
+PASS image3.left is 1100
+PASS image3.top is 500
+PASS image3.width is 100
+PASS image3.height is 50
+PASS image3.right is 1200
+PASS image3.bottom is 550
+PASS text3.left is 1100
+PASS text3.top is 565
+PASS text3.width is 96
+PASS text3.height is 12
+PASS text3.right is 1196
+PASS text3.bottom is 577
PASS successfullyParsed is true
diff --git a/LayoutTests/css3/zoom-coords.xhtml b/LayoutTests/css3/zoom-coords.xhtml
index 41f6a9d..1590697 100644
--- a/LayoutTests/css3/zoom-coords.xhtml
+++ b/LayoutTests/css3/zoom-coords.xhtml
@@ -2,37 +2,68 @@
<head>
<link rel="stylesheet" href="../fast/js/resources/js-test-style.css"/>
<style type="text/css">
- body { margin:0px; border:0px; padding:0px; }
- #div1, #svg1 { zoom:200%; }
- #div2, #svg2 { zoom:50%; }
+ body {
+ margin:0px;
+ border:0px;
+ padding:0px;
+ }
+ text {
+ font: 12px Ahem;
+ }
+ #div2, #svg2 {
+ zoom:200%;
+ }
+ #div3, #svg3 {
+ zoom:50%;
+ }
</style>
-<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body>
-<div id="div1" style="width:100px;height:50px;background-color:blue;"></div>
-<div id="div2" style="width:200px;height:100px;background-color:green;"></div>
+<div id="div1" style="width:100px;height:50px;background-color:gray;"></div>
+<div id="div2" style="width:100px;height:50px;background-color:green;"></div>
+<div id="div3" style="width:200px;height:100px;background-color:blue;"></div>
+<div style="width:600px;height=100px;">
<svg id="svg1" xmlns="http://www.w3.org/2000/svg"
width="150px" height="50px" viewBox="0 0 150 100"
preserveAspectRatio="none">
- <rect id="rect1" x="0" y="0" width="100px" height="100px" fill="yellow" />
- <image id="image1" x="100px" y="0" width="50px" height="50px" xlink:href="../svg/dom/resources/magnify.png" />
+ <rect id="rect1" x="0" y="0" width="100px" height="100px" fill="gray" />
+ <image id="image1" x="100px" y="0" width="50px" height="50px" xlink:href="../svg/W3C-SVG-1.1/resources/magnify.png" />
<text id="text1" x="100px" y="75px">Test</text>
</svg><svg id="svg2" xmlns="http://www.w3.org/2000/svg"
- width="300px" height="100px" viewBox="0 0 150 100"
+ width="150px" height="50px" viewBox="0 0 150 100"
preserveAspectRatio="none">
- <rect id="rect2" x="0" y="0" width="100px" height="100px" fill="orange" />
- <image id="image2" x="100px" y="0" width="50px" height="50px" xlink:href="../svg/dom/resources/magnify.png" />
+ <rect id="rect2" x="0" y="0" width="100px" height="100px" fill="green" />
+ <image id="image2" x="100px" y="0" width="50px" height="50px" xlink:href="../svg/W3C-SVG-1.1/resources/magnify.png" />
<text id="text2" x="100px" y="75px">Test</text>
+</svg><svg id="svg3" xmlns="http://www.w3.org/2000/svg"
+ width="300px" height="100px" viewBox="0 0 150 100"
+ preserveAspectRatio="none">
+ <rect id="rect3" x="0" y="0" width="100px" height="100px" fill="blue" />
+ <image id="image3" x="100px" y="0" width="50px" height="50px" xlink:href="../svg/W3C-SVG-1.1/resources/magnify.png" />
+ <text id="text3" x="100px" y="75px">Test</text>
</svg>
+</div>
<div id="description"></div>
<div id="console"></div>
+<script src="../fast/js/resources/js-test-pre.js"></script>
<script>
+function msgDumpRenderTreeRequired()
+{
+ if (!window.layoutTestController)
+ debug("The following tests may fail if not run in DumpRenderTree:");
+}
+
description("This test checks getBoundingClientRect() on zoomed HTML and SVG elements");
+debug("Gray rectangles: 100x50");
+debug("Green rectangles: 100x50, zoom=200%");
+debug("Blue rectangles: 200x100, zoom=50%");
+debug("");
+
debug("Checking HTML elements:");
debug("");
@@ -47,11 +78,20 @@ debug("");
var div2 = document.getElementById("div2").getBoundingClientRect();
shouldBe('div2.left', '0');
-shouldBe('div2.top', '200');
-shouldBe('div2.width', '200');
-shouldBe('div2.height', '100');
-shouldBe('div2.right', '200');
-shouldBe('div2.bottom', '300');
+shouldBe('div2.top', '25');
+shouldBe('div2.width', '100');
+shouldBe('div2.height', '50');
+shouldBe('div2.right', '100');
+shouldBe('div2.bottom', '75');
+debug("");
+
+var div3 = document.getElementById("div3").getBoundingClientRect();
+shouldBe('div3.left', '0');
+shouldBe('div3.top', '300');
+shouldBe('div3.width', '200');
+shouldBe('div3.height', '100');
+shouldBe('div3.right', '200');
+shouldBe('div3.bottom', '400');
debug("");
debug("Checking SVG elements:");
@@ -59,62 +99,95 @@ debug("");
var svg1 = document.getElementById("svg1").getBoundingClientRect();
shouldBe('svg1.left', '0');
-shouldBe('svg1.top', '75');
+shouldBe('svg1.top', '250');
shouldBe('svg1.width', '150');
shouldBe('svg1.height', '50');
shouldBe('svg1.right', '150');
-shouldBe('svg1.bottom', '125');
+shouldBe('svg1.bottom', '300');
var rect1 = document.getElementById("rect1").getBoundingClientRect();
shouldBe('rect1.left', '0');
-shouldBe('rect1.top', '75');
+shouldBe('rect1.top', '250');
shouldBe('rect1.width', '100');
shouldBe('rect1.height', '50');
shouldBe('rect1.right', '100');
-shouldBe('rect1.bottom', '125');
+shouldBe('rect1.bottom', '300');
var image1 = document.getElementById("image1").getBoundingClientRect();
shouldBe('image1.left', '100');
-shouldBe('image1.top', '75');
+shouldBe('image1.top', '250');
shouldBe('image1.width', '50');
shouldBe('image1.height', '25');
shouldBe('image1.right', '150');
-shouldBe('image1.bottom', '100');
+shouldBe('image1.bottom', '275');
var text1 = document.getElementById("text1").getBoundingClientRect();
-shouldBe('text1.left == 100', 'true');
-shouldBe('text1.top >= 75', 'true');
-shouldBe('text1.width > 0', 'true');
-shouldBe('text1.height > 0', 'true');
-shouldBe('text1.right > 100', 'true');
-shouldBe('text1.bottom > 75', 'true');
+shouldBe('text1.left', '100');
+msgDumpRenderTreeRequired();
+shouldBe('text1.top', '282.5');
+shouldBe('text1.width', '48');
+shouldBe('text1.height', '6');
+shouldBe('text1.right', '148');
+shouldBe('text1.bottom', '288.5');
debug("");
var svg2 = document.getElementById("svg2").getBoundingClientRect();
-shouldBe('svg2.left', '600');
-shouldBe('svg2.top', '400');
-shouldBe('svg2.width', '300');
-shouldBe('svg2.height', '100');
-shouldBe('svg2.right', '900');
-shouldBe('svg2.bottom', '500');
+shouldBe('svg2.left', '75');
+shouldBe('svg2.top', '100');
+shouldBe('svg2.width', '150');
+shouldBe('svg2.height', '50');
+shouldBe('svg2.right', '225');
+shouldBe('svg2.bottom', '150');
var rect2 = document.getElementById("rect2").getBoundingClientRect();
-shouldBe('rect2.left', '600');
-shouldBe('rect2.top', '400');
-shouldBe('rect2.width', '200');
-shouldBe('rect2.height', '100');
-shouldBe('rect2.right', '800');
-shouldBe('rect2.bottom', '500');
+shouldBe('rect2.left', '75');
+shouldBe('rect2.top', '100');
+shouldBe('rect2.width', '100');
+shouldBe('rect2.height', '50');
+shouldBe('rect2.right', '175');
+shouldBe('rect2.bottom', '150');
var image2 = document.getElementById("image2").getBoundingClientRect();
-shouldBe('image2.left', '800');
-shouldBe('image2.top', '400');
-shouldBe('image2.width', '100');
-shouldBe('image2.height', '50');
-shouldBe('image2.right', '900');
-shouldBe('image2.bottom', '450');
+shouldBe('image2.left', '175');
+shouldBe('image2.top', '100');
+shouldBe('image2.width', '50');
+shouldBe('image2.height', '25');
+shouldBe('image2.right', '225');
+shouldBe('image2.bottom', '125');
var text2 = document.getElementById("text2").getBoundingClientRect();
-shouldBe('text2.left == 800', 'true');
-shouldBe('text2.top >= 400', 'true');
-shouldBe('text2.width > 0', 'true');
-shouldBe('text2.height > 0', 'true');
-shouldBe('text2.right > 800', 'true');
-shouldBe('text2.bottom > 400', 'true');
+shouldBe('text2.left', '175');
+msgDumpRenderTreeRequired();
+shouldBe('text2.top', '132.5');
+shouldBe('text2.width', '48');
+shouldBe('text2.height', '6');
+shouldBe('text2.right', '223');
+shouldBe('text2.bottom', '138.5');
+debug("");
+
+var svg3 = document.getElementById("svg3").getBoundingClientRect();
+shouldBe('svg3.left', '900');
+shouldBe('svg3.top', '500');
+shouldBe('svg3.width', '300');
+shouldBe('svg3.height', '100');
+shouldBe('svg3.right', '1200');
+shouldBe('svg3.bottom', '600');
+var rect3 = document.getElementById("rect3").getBoundingClientRect();
+shouldBe('rect3.left', '900');
+shouldBe('rect3.top', '500');
+shouldBe('rect3.width', '200');
+shouldBe('rect3.height', '100');
+shouldBe('rect3.right', '1100');
+shouldBe('rect3.bottom', '600');
+var image3 = document.getElementById("image3").getBoundingClientRect();
+shouldBe('image3.left', '1100');
+shouldBe('image3.top', '500');
+shouldBe('image3.width', '100');
+shouldBe('image3.height', '50');
+shouldBe('image3.right', '1200');
+shouldBe('image3.bottom', '550');
+var text3 = document.getElementById("text3").getBoundingClientRect();
+shouldBe('text3.left', '1100');
+msgDumpRenderTreeRequired();
+shouldBe('text3.top', '565');
+shouldBe('text3.width', '96');
+shouldBe('text3.height', '12');
+shouldBe('text3.right', '1196');
+shouldBe('text3.bottom', '577');
debug("");
successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/Element/getBoundingClientRect-expected.txt b/LayoutTests/fast/dom/Element/getBoundingClientRect-expected.txt
index a6c80a6..bc962b2 100644
--- a/LayoutTests/fast/dom/Element/getBoundingClientRect-expected.txt
+++ b/LayoutTests/fast/dom/Element/getBoundingClientRect-expected.txt
@@ -1,215 +1,117 @@
-Client bounding rect for #1
-testRect.top 42
-testRect.left 8
-testRect.width 300
-testRect.height 100
-testRect.bottom 142
-testRect.right 308
-
-PASS testRect.top is 42
-PASS testRect.left is 8
-PASS testRect.width is 300
-PASS testRect.height is 100
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #2
-testRect.top 192
-testRect.left 8
-testRect.width 320
-testRect.height 120
-testRect.bottom 312
-testRect.right 328
-
-PASS testRect.top is 192
-PASS testRect.left is 8
-PASS testRect.width is 320
-PASS testRect.height is 120
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #3
-testRect.top 362
-testRect.left 18
-testRect.width 300
-testRect.height 100
-testRect.bottom 462
-testRect.right 318
-
-PASS testRect.top is 362
-PASS testRect.left is 18
-PASS testRect.width is 300
-PASS testRect.height is 100
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #4
-testRect.top 491
-testRect.left 37
-testRect.width 142
-testRect.height 142
-testRect.bottom 633
-testRect.right 179
-
-PASS testRect.top is 491
-PASS testRect.left is 37
-PASS testRect.width is 142
-PASS testRect.height is 142
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #5
-testRect.top 662
-testRect.left 8
-testRect.width 300
-testRect.height 240
-testRect.bottom 902
-testRect.right 308
-
-PASS testRect.top is 662
-PASS testRect.left is 8
-PASS testRect.width is 300
-PASS testRect.height is 240
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #6
+Test 1
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "40.000"
+PASS rect.width.toFixed(3) is "300.000"
+PASS rect.height.toFixed(3) is "100.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 2
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "188.000"
+PASS rect.width.toFixed(3) is "320.000"
+PASS rect.height.toFixed(3) is "120.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 3
+PASS rect.left.toFixed(3) is "18.000"
+PASS rect.top.toFixed(3) is "356.000"
+PASS rect.width.toFixed(3) is "300.000"
+PASS rect.height.toFixed(3) is "100.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 4
+PASS rect.left.toFixed(3) is "37.289"
+PASS rect.top.toFixed(3) is "483.289"
+PASS rect.width.toFixed(3) is "141.421"
+PASS rect.height.toFixed(3) is "141.421"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 5
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "652.000"
+PASS rect.width.toFixed(3) is "300.000"
+PASS rect.height.toFixed(3) is "374.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 6
Known failure. Skipping.
-Client bounding rect for #7
-testRect.top 1236
-testRect.left 8
-testRect.width 299
-testRect.height 180
-testRect.bottom 1416
-testRect.right 307
-
-PASS testRect.top is 1236
-PASS testRect.left is 8
-PASS testRect.width is 299
-PASS testRect.height is 180
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #8
-testRect.top 1466
-testRect.left 8
-testRect.width 300
-testRect.height 46
-testRect.bottom 1512
-testRect.right 308
-
-PASS testRect.top is 1466
-PASS testRect.left is 8
-PASS testRect.width is 300
-PASS testRect.height is 46
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #9
-testRect.top 1562
-testRect.left 8
-testRect.width 300
-testRect.height 64
-testRect.bottom 1626
-testRect.right 308
-
-PASS testRect.top is 1562
-PASS testRect.left is 8
-PASS testRect.width is 300
-PASS testRect.height is 64
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #10
-testRect.top 1678
-testRect.left 8
-testRect.width 300
-testRect.height 20
-testRect.bottom 1698
-testRect.right 308
-
-PASS testRect.top is 1678
-PASS testRect.left is 8
-PASS testRect.width is 300
-PASS testRect.height is 20
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #11
-testRect.top 1774
-testRect.left 10
-testRect.width 147
-testRect.height 20
-testRect.bottom 1794
-testRect.right 157
-
-PASS testRect.top is 1774
-PASS testRect.left is 10
-PASS testRect.width is 147
-PASS testRect.height is 20
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #12
-testRect.top 1868
-testRect.left 8
-testRect.width 100
-testRect.height 100
-testRect.bottom 1968
-testRect.right 108
-
-PASS testRect.top is 1868
-PASS testRect.left is 8
-PASS testRect.width is 100
-PASS testRect.height is 100
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #13
-testRect.top 2104
-testRect.left 8
-testRect.width 180
-testRect.height 18
-testRect.bottom 2122
-testRect.right 188
-
-PASS testRect.top is 2104
-PASS testRect.left is 8
-PASS testRect.width is 180
-PASS testRect.height is 18
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #14
-testRect.top 2172
-testRect.left 8
-testRect.width 300
-testRect.height 236
-testRect.bottom 2408
-testRect.right 308
-
-PASS testRect.top is 2172
-PASS testRect.left is 8
-FAIL testRect.width should be 200. Was 300.
-PASS testRect.height is 236
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #15
-testRect.top 2458
-testRect.left 8
-testRect.width 0
-testRect.height 0
-testRect.bottom 2458
-testRect.right 8
-
-PASS testRect.top is 2458
-PASS testRect.left is 8
-PASS testRect.width is 0
-PASS testRect.height is 0
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
+Test 7
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "1490.000"
+PASS rect.width.toFixed(3) is "288.000"
+PASS rect.height.toFixed(3) is "464.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 8
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "2002.000"
+PASS rect.width.toFixed(3) is "300.000"
+PASS rect.height.toFixed(3) is "74.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 9
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "2140.000"
+PASS rect.width.toFixed(3) is "300.000"
+PASS rect.height.toFixed(3) is "90.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 10
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "2280.000"
+PASS rect.width.toFixed(3) is "300.000"
+PASS rect.height.toFixed(3) is "34.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 11
+PASS rect.left.toFixed(3) is "10.000"
+PASS rect.top.toFixed(3) is "2402.000"
+PASS rect.width.toFixed(3) is "147.000"
+PASS rect.height.toFixed(3) is "34.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 12
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "2538.000"
+PASS rect.width.toFixed(3) is "100.000"
+PASS rect.height.toFixed(3) is "100.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 13
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "2789.000"
+PASS rect.width.toFixed(3) is "260.000"
+PASS rect.height.toFixed(3) is "16.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 14
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "2869.000"
+PASS rect.width.toFixed(3) is "300.000"
+PASS rect.height.toFixed(3) is "232.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
+Test 15
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "3165.000"
+PASS rect.width.toFixed(3) is "0.000"
+PASS rect.height.toFixed(3) is "0.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
PASS successfullyParsed is true
diff --git a/LayoutTests/fast/dom/Element/getBoundingClientRect.html b/LayoutTests/fast/dom/Element/getBoundingClientRect.html
index d5ee008..8abeac4 100644
--- a/LayoutTests/fast/dom/Element/getBoundingClientRect.html
+++ b/LayoutTests/fast/dom/Element/getBoundingClientRect.html
@@ -1,6 +1,10 @@
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
<script src="../../js/resources/js-test-pre.js"></script>
<style>
+ body {
+ font: 16px Ahem;
+ }
+
#base {
width: 300px;
height: 100px;
@@ -61,12 +65,12 @@
}
.bbox {
- position:absolute;
+ position: absolute;
outline: 5px solid rgba(255, 0, 0, .75);
}
#console {
- position:absolute;
+ position: absolute;
left: 500px;
}
</style>
@@ -95,26 +99,18 @@
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
+ else
+ alert("WARNING:\nThis test may show bogus FAILures if not run in DumpRenderTree, due to platform-specific differences in font metrics.");
- var testRect;
function testClientRect(toTest, expectedRect)
{
- testRect = toTest;
-
- debug("testRect.top " + testRect.top);
- debug("testRect.left " + testRect.left);
- debug("testRect.width " + testRect.width);
- debug("testRect.height " + testRect.height);
- debug("testRect.bottom " + testRect.bottom);
- debug("testRect.right " + testRect.right);
- debug("");
-
- shouldBe("testRect.top", String(expectedRect.top));
- shouldBe("testRect.left", String(expectedRect.left));
- shouldBe("testRect.width", String(expectedRect.width));
- shouldBe("testRect.height", String(expectedRect.height));
- shouldBe("testRect.bottom", "testRect.top + testRect.height");
- shouldBe("testRect.right", "testRect.left + testRect.width");
+ rect = toTest;
+ shouldBeEqualToString("rect.left.toFixed(3)", expectedRect.left.toFixed(3));
+ shouldBeEqualToString("rect.top.toFixed(3)", expectedRect.top.toFixed(3));
+ shouldBeEqualToString("rect.width.toFixed(3)", expectedRect.width.toFixed(3));
+ shouldBeEqualToString("rect.height.toFixed(3)", expectedRect.height.toFixed(3));
+ shouldBe("rect.right", "rect.left + rect.width");
+ shouldBe("rect.bottom", "rect.top + rect.height");
debug("");
}
@@ -123,9 +119,9 @@
var bbox = document.createElement('div');
bbox.className = "bbox";
var style = "";
- style += "left: " + rect.left + "px;";
- style += "top: " + rect.top + "px;";
- style += "width: " + (rect.right - rect.left) + "px;";
+ style += "left: " + rect.left + "px;";
+ style += "top: " + rect.top + "px;";
+ style += "width: " + (rect.right - rect.left) + "px;";
style += "height: " + (rect.bottom - rect.top) + "px;";
bbox.setAttribute("style", style);
document.documentElement.appendChild(bbox);
@@ -134,26 +130,26 @@
var fail = undefined;
var expectedResults = [
- /*1*/ { top: 42, left: 8, width: 300, height: 100 },
- /*2*/ { top: 192, left: 8, width: 320, height: 120 },
- /*3*/ { top: 362, left: 18, width: 300, height: 100 },
- /*4*/ { top: 491, left: 37, width: 142, height: 142 },
- /*5*/ { top: 662, left: 8, width: 300, height: 240 },
- /*6*/ { top: fail, left: fail, width: fail, height: fail },
- /*7*/ { top: 1236, left: 8, width: 299, height: 180 },
- /*8*/ { top: 1466, left: 8, width: 300, height: 46 },
- /*9*/ { top: 1562, left: 8, width: 300, height: 64 },
- /*10*/ { top: 1678, left: 8, width: 300, height: 20 },
- /*11*/ { top: 1774, left: 10, width: 147, height: 20 },
- /*12*/ { top: 1868, left: 8, width: 100, height: 100 },
- /*13*/ { top: 2104, left: 8, width: 180, height: 18 },
- /*14*/ { top: 2172, left: 8, width: 200, height: 236 },
- /*15*/ { top: 2458, left: 8, width: 0, height: 0 }
+ /*1*/ { left: 8, top: 40, width: 300, height: 100 },
+ /*2*/ { left: 8, top: 188, width: 320, height: 120 },
+ /*3*/ { left: 18, top: 356, width: 300, height: 100 },
+ /*4*/ { left: 37.289, top: 483.289, width: 141.421, height: 141.421 },
+ /*5*/ { left: 8, top: 652, width: 300, height: 374 },
+ /*6*/ { left: fail, top: fail, width: fail, height: fail },
+ /*7*/ { left: 8, top: 1490, width: 288, height: 464 },
+ /*8*/ { left: 8, top: 2002, width: 300, height: 74 },
+ /*9*/ { left: 8, top: 2140, width: 300, height: 90 },
+ /*10*/ { left: 8, top: 2280, width: 300, height: 34 },
+ /*11*/ { left: 10, top: 2402, width: 147, height: 34 },
+ /*12*/ { left: 8, top: 2538, width: 100, height: 100 },
+ /*13*/ { left: 8, top: 2789, width: 260, height: 16 },
+ /*14*/ { left: 8, top: 2869, width: 300, height: 232 },
+ /*15*/ { left: 8, top: 3165, width: 0, height: 0 }
];
function test(number, element)
{
- debug("Client bounding rect for #" + number);
+ debug("Test " + number);
if (element.className.match("knownFailure")) {
debug("Known failure. Skipping.");
diff --git a/LayoutTests/fast/dom/Range/getBoundingClientRect-expected.txt b/LayoutTests/fast/dom/Range/getBoundingClientRect-expected.txt
index d4f0a65..8e0d61a 100644
--- a/LayoutTests/fast/dom/Range/getBoundingClientRect-expected.txt
+++ b/LayoutTests/fast/dom/Range/getBoundingClientRect-expected.txt
@@ -1,23 +1,35 @@
Test 1
-PASS rect.left is 8
-PASS rect.top is 8
-PASS rect.width is 400
-PASS rect.height is 160
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "8.000"
+PASS rect.width.toFixed(3) is "400.000"
+PASS rect.height.toFixed(3) is "400.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
Test 2
-PASS rect.left is 8
-PASS rect.top is 215
-PASS rect.width is 398
-PASS rect.height is 138
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "452.000"
+PASS rect.width.toFixed(3) is "400.000"
+PASS rect.height.toFixed(3) is "376.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
Test 3
-PASS rect.left is 8
-PASS rect.top is 451
-PASS rect.width is 398
-PASS rect.height is 58
+PASS rect.left.toFixed(3) is "8.000"
+PASS rect.top.toFixed(3) is "1044.000"
+PASS rect.width.toFixed(3) is "400.000"
+PASS rect.height.toFixed(3) is "96.000"
+PASS rect.right is rect.left + rect.width
+PASS rect.bottom is rect.top + rect.height
+
Test 4
-PASS rect.left is 76
-PASS rect.top is 578
-PASS rect.width is 361
-PASS rect.height is 343
+PASS rect.left.toFixed(3) is "-14.574"
+PASS rect.top.toFixed(3) is "1329.947"
+PASS rect.width.toFixed(3) is "504.009"
+PASS rect.height.toFixed(3) is "535.849"
+PASS Math.abs(rect.left + rect.width - rect.right) < 0.001 is true
+PASS Math.abs(rect.top + rect.height - rect.bottom) < 0.001 is true
+
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/LayoutTests/fast/dom/Range/getBoundingClientRect.html b/LayoutTests/fast/dom/Range/getBoundingClientRect.html
index 0fe7b27..b1a9d15 100644
--- a/LayoutTests/fast/dom/Range/getBoundingClientRect.html
+++ b/LayoutTests/fast/dom/Range/getBoundingClientRect.html
@@ -1,6 +1,10 @@
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
<script src="../../js/resources/js-test-pre.js"></script>
<style>
+body {
+ font: 16px Ahem;
+}
+
.bbox {
position:absolute;
outline: 5px solid rgba(255, 0, 0, .75);
@@ -31,6 +35,7 @@
position:absolute;
left: 500px;
}
+
#testArea {
width: 300px;
}
@@ -56,15 +61,34 @@
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
+ else
+ alert("WARNING:\nThis test may show bogus FAILures if not run in DumpRenderTree, due to platform-specific differences in font metrics.");
+
+ function testClientRect(rect, expectedRect)
+ {
+ shouldBeEqualToString("rect.left.toFixed(3)", expectedRect.left.toFixed(3));
+ shouldBeEqualToString("rect.top.toFixed(3)", expectedRect.top.toFixed(3));
+ shouldBeEqualToString("rect.width.toFixed(3)", expectedRect.width.toFixed(3));
+ shouldBeEqualToString("rect.height.toFixed(3)", expectedRect.height.toFixed(3));
+ if (rect.right == Math.round(rect.right))
+ shouldBe("rect.right", "rect.left + rect.width");
+ else
+ shouldBe("Math.abs(rect.left + rect.width - rect.right) < 0.001", "true");
+ if (rect.bottom == Math.round(rect.bottom))
+ shouldBe("rect.bottom", "rect.top + rect.height");
+ else
+ shouldBe("Math.abs(rect.top + rect.height - rect.bottom) < 0.001", "true");
+ debug("");
+ }
function addBBoxOverClientRect(rect)
{
var bbox = document.createElement('div');
bbox.className = "bbox";
var style = "";
- style += "left: " + rect.left + "px;";
- style += "top: " + rect.top + "px;";
- style += "width: " + (rect.right - rect.left) + "px;";
+ style += "left: " + rect.left + "px;";
+ style += "top: " + rect.top + "px;";
+ style += "width: " + (rect.right - rect.left) + "px;";
style += "height: " + (rect.bottom - rect.top) + "px;";
bbox.setAttribute("style", style);
document.documentElement.appendChild(bbox);
@@ -77,52 +101,41 @@
addBBoxOverClientRect(range.getBoundingClientRect());
}
- // Test 1
+ var expectedResults = [
+ /*1*/ { left: 8, top: 8, width: 400, height: 400 },
+ /*2*/ { left: 8, top: 452, width: 400, height: 376 },
+ /*3*/ { left: 8, top: 1044, width: 400, height: 96 },
+ /*4*/ { left: -14.574, top: 1329.947, width: 504.009, height: 535.849 },
+ ];
+
debug("Test 1")
var range1 = document.createRange();
range1.selectNode(document.getElementById('test1'));
show(range1);
- rect = range1.getBoundingClientRect()
- shouldBe("rect.left", "8");
- shouldBe("rect.top", "8");
- shouldBe("rect.width", "400");
- shouldBe("rect.height", "160");
+ rect = range1.getBoundingClientRect();
+ testClientRect(rect, expectedResults[1 - 1]);
- // Test 2
debug("Test 2")
var range2 = document.createRange();
range2.selectNodeContents(document.getElementById('test2'));
show(range2);
- rect = range2.getBoundingClientRect()
- shouldBe("rect.left", "8");
- shouldBe("rect.top", "215");
- shouldBe("rect.width", "398");
- shouldBe("rect.height", "138");
+ rect = range2.getBoundingClientRect();
+ testClientRect(rect, expectedResults[2 - 1]);
-
- // Test 3
debug("Test 3")
var range3 = document.createRange();
range3.setStart(document.getElementById('test3').firstChild, 100);
range3.setEnd(document.getElementById('test3').lastChild, 150);
show(range3);
rect = range3.getBoundingClientRect()
- shouldBe("rect.left", "8");
- shouldBe("rect.top", "451");
- shouldBe("rect.width", "398");
- shouldBe("rect.height", "58");
-
+ testClientRect(rect, expectedResults[3 - 1]);
- // Test 4
debug("Test 4")
var range4 = document.createRange();
range4.selectNodeContents(document.getElementById('test4'));
show(range4);
rect = range4.getBoundingClientRect()
- shouldBe("rect.left", "76");
- shouldBe("rect.top", "578");
- shouldBe("rect.width", "361");
- shouldBe("rect.height", "343");
+ testClientRect(rect, expectedResults[4 - 1]);
if (window.layoutTestController) {
var area = document.getElementById('testArea');
diff --git a/LayoutTests/platform/chromium-win/fast/dom/Element/getBoundingClientRect-expected.txt b/LayoutTests/platform/chromium-win/fast/dom/Element/getBoundingClientRect-expected.txt
deleted file mode 100644
index 716267a..0000000
--- a/LayoutTests/platform/chromium-win/fast/dom/Element/getBoundingClientRect-expected.txt
+++ /dev/null
@@ -1,216 +0,0 @@
-Client bounding rect for #1
-testRect.top 44
-testRect.left 8
-testRect.width 300
-testRect.height 100
-testRect.bottom 144
-testRect.right 308
-
-FAIL testRect.top should be 42. Was 44.
-PASS testRect.left is 8
-PASS testRect.width is 300
-PASS testRect.height is 100
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #2
-testRect.top 196
-testRect.left 8
-testRect.width 320
-testRect.height 120
-testRect.bottom 316
-testRect.right 328
-
-FAIL testRect.top should be 192. Was 196.
-PASS testRect.left is 8
-PASS testRect.width is 320
-PASS testRect.height is 120
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #3
-testRect.top 368
-testRect.left 18
-testRect.width 300
-testRect.height 100
-testRect.bottom 468
-testRect.right 318
-
-FAIL testRect.top should be 362. Was 368.
-PASS testRect.left is 18
-PASS testRect.width is 300
-PASS testRect.height is 100
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #4
-testRect.top 499
-testRect.left 37
-testRect.width 142
-testRect.height 142
-testRect.bottom 641
-testRect.right 179
-
-FAIL testRect.top should be 491. Was 499.
-PASS testRect.left is 37
-PASS testRect.width is 142
-PASS testRect.height is 142
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #5
-testRect.top 672
-testRect.left 8
-testRect.width 300
-testRect.height 261
-testRect.bottom 933
-testRect.right 308
-
-FAIL testRect.top should be 662. Was 672.
-PASS testRect.left is 8
-PASS testRect.width is 300
-FAIL testRect.height should be 240. Was 261.
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #6
-Known failure. Skipping.
-
-Client bounding rect for #7
-testRect.top 1305
-testRect.left 8
-testRect.width 295
-testRect.height 199
-testRect.bottom 1504
-testRect.right 303
-
-FAIL testRect.top should be 1236. Was 1305.
-PASS testRect.left is 8
-FAIL testRect.width should be 299. Was 295.
-FAIL testRect.height should be 180. Was 199.
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #8
-testRect.top 1557
-testRect.left 8
-testRect.width 300
-testRect.height 50
-testRect.bottom 1607
-testRect.right 308
-
-FAIL testRect.top should be 1466. Was 1557.
-PASS testRect.left is 8
-PASS testRect.width is 300
-FAIL testRect.height should be 46. Was 50.
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #9
-testRect.top 1659
-testRect.left 8
-testRect.width 300
-testRect.height 70
-testRect.bottom 1729
-testRect.right 308
-
-FAIL testRect.top should be 1562. Was 1659.
-PASS testRect.left is 8
-PASS testRect.width is 300
-FAIL testRect.height should be 64. Was 70.
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #10
-testRect.top 1783
-testRect.left 8
-testRect.width 300
-testRect.height 22
-testRect.bottom 1805
-testRect.right 308
-
-FAIL testRect.top should be 1678. Was 1783.
-PASS testRect.left is 8
-PASS testRect.width is 300
-FAIL testRect.height should be 20. Was 22.
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #11
-testRect.top 1885
-testRect.left 10
-testRect.width 147
-testRect.height 22
-testRect.bottom 1907
-testRect.right 157
-
-FAIL testRect.top should be 1774. Was 1885.
-PASS testRect.left is 10
-PASS testRect.width is 147
-FAIL testRect.height should be 20. Was 22.
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #12
-testRect.top 1985
-testRect.left 8
-testRect.width 100
-testRect.height 100
-testRect.bottom 2085
-testRect.right 108
-
-FAIL testRect.top should be 1868. Was 1985.
-PASS testRect.left is 8
-PASS testRect.width is 100
-PASS testRect.height is 100
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #13
-testRect.top 2222
-testRect.left 8
-testRect.width 175
-testRect.height 19
-testRect.bottom 2241
-testRect.right 183
-
-FAIL testRect.top should be 2104. Was 2222.
-PASS testRect.left is 8
-FAIL testRect.width should be 180. Was 175.
-FAIL testRect.height should be 18. Was 19.
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #14
-testRect.top 2294
-testRect.left 8
-testRect.width 300
-testRect.height 239
-testRect.bottom 2533
-testRect.right 308
-
-FAIL testRect.top should be 2172. Was 2294.
-PASS testRect.left is 8
-FAIL testRect.width should be 200. Was 300.
-FAIL testRect.height should be 236. Was 239.
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-Client bounding rect for #15
-testRect.top 2586
-testRect.left 8
-testRect.width 0
-testRect.height 0
-testRect.bottom 2586
-testRect.right 8
-
-FAIL testRect.top should be 2458. Was 2586.
-PASS testRect.left is 8
-PASS testRect.width is 0
-PASS testRect.height is 0
-PASS testRect.bottom is testRect.top + testRect.height
-PASS testRect.right is testRect.left + testRect.width
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
diff --git a/LayoutTests/platform/chromium-win/fast/dom/Range/getBoundingClientRect-expected.txt b/LayoutTests/platform/chromium-win/fast/dom/Range/getBoundingClientRect-expected.txt
deleted file mode 100644
index 082936f..0000000
--- a/LayoutTests/platform/chromium-win/fast/dom/Range/getBoundingClientRect-expected.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Test 1
-PASS rect.left is 8
-PASS rect.top is 8
-PASS rect.width is 400
-PASS rect.height is 160
-Test 2
-PASS rect.left is 8
-FAIL rect.top should be 215. Was 218.
-FAIL rect.width should be 398. Was 380.
-FAIL rect.height should be 138. Was 139.
-Test 3
-PASS rect.left is 8
-FAIL rect.top should be 451. Was 458.
-FAIL rect.width should be 398. Was 378.
-FAIL rect.height should be 58. Was 59.
-Test 4
-PASS rect.left is 76
-FAIL rect.top should be 578. Was 589.
-FAIL rect.width should be 361. Was 351.
-FAIL rect.height should be 343. Was 356.
-PASS successfullyParsed is true
-
-TEST COMPLETE
diff --git a/LayoutTests/svg/custom/getBBox-js.svg b/LayoutTests/svg/custom/getBBox-js.svg
index f3b63da..d05fd24 100644
--- a/LayoutTests/svg/custom/getBBox-js.svg
+++ b/LayoutTests/svg/custom/getBBox-js.svg
@@ -33,7 +33,7 @@
rect.setAttribute("visibility", "hidden");
g.appendChild(rect);
if (rect.getBBox().width > 0 && rect.getBBox().height > 0) {
- textNode.data = "Passed";
+ textNode.data = "Passed";
}
}
}
diff --git a/LayoutTests/svg/custom/getBoundingClientRect-expected.txt b/LayoutTests/svg/custom/getBoundingClientRect-expected.txt
index 535a7b1..5d721b4 100644
--- a/LayoutTests/svg/custom/getBoundingClientRect-expected.txt
+++ b/LayoutTests/svg/custom/getBoundingClientRect-expected.txt
@@ -1,4 +1,4 @@
-This test checks getBoundingClientRect() on a rectangle
+This test checks getBoundingClientRect() on rectangles
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/LayoutTests/svg/custom/getBoundingClientRect.xhtml b/LayoutTests/svg/custom/getBoundingClientRect.xhtml
index 20175e3..fefa14d 100644
--- a/LayoutTests/svg/custom/getBoundingClientRect.xhtml
+++ b/LayoutTests/svg/custom/getBoundingClientRect.xhtml
@@ -1,10 +1,10 @@
<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;">
+<div style="width:500px;height:100px;">
<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" />
@@ -19,13 +19,15 @@
<rect id="r4" x="0" y="50px" width="210px" height="60px" fill="orange" overflow="visible" />
</svg>
</svg>
+</div>
<div id="description"></div>
<div id="console"></div>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
<script>
-description("This test checks getBoundingClientRect() on a rectangle");
+description("This test checks getBoundingClientRect() on rectangles");
debug("Checking a rectangle of absolute size at absolute coordinates:");
var r1 = document.getElementById("r1").getBoundingClientRect();
@@ -55,6 +57,7 @@ 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');
diff --git a/LayoutTests/svg/zoom/page/zoom-getBoundingClientRect-expected.txt b/LayoutTests/svg/zoom/page/zoom-getBoundingClientRect-expected.txt
new file mode 100644
index 0000000..879f646
--- /dev/null
+++ b/LayoutTests/svg/zoom/page/zoom-getBoundingClientRect-expected.txt
@@ -0,0 +1,38 @@
+This test checks getBoundingClientRect() on rectangles
+
+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.toFixed(2) is "20.00"
+PASS r1.top.toFixed(2) is "30.00"
+PASS r1.width.toFixed(2) is "40.00"
+PASS r1.height.toFixed(2) is "50.00"
+PASS r1.right.toFixed(2) is "60.00"
+PASS r1.bottom.toFixed(2) is "80.00"
+
+Checking a resized rectangle at relative coordinates:
+PASS r2.left.toFixed(2) is "180.00"
+PASS r2.top.toFixed(2) is "15.00"
+PASS r2.width.toFixed(2) is "160.00"
+PASS r2.height.toFixed(2) is "25.00"
+PASS r2.right.toFixed(2) is "340.00"
+PASS r2.bottom.toFixed(2) is "40.00"
+
+Checking rectangles with overflow:
+PASS r3.left.toFixed(2) is "300.00"
+PASS r3.top.toFixed(2) is "0.00"
+PASS r3.width.toFixed(2) is "210.00"
+PASS r3.height.toFixed(2) is "50.00"
+PASS r3.right.toFixed(2) is "510.00"
+PASS r3.bottom.toFixed(2) is "50.00"
+PASS r4.left.toFixed(2) is "300.00"
+PASS r4.top.toFixed(2) is "50.00"
+PASS r4.width.toFixed(2) is "210.00"
+PASS r4.height.toFixed(2) is "60.00"
+PASS r4.right.toFixed(2) is "510.00"
+PASS r4.bottom.toFixed(2) is "110.00"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/zoom/page/zoom-getBoundingClientRect.xhtml b/LayoutTests/svg/zoom/page/zoom-getBoundingClientRect.xhtml
new file mode 100644
index 0000000..bdaec4f
--- /dev/null
+++ b/LayoutTests/svg/zoom/page/zoom-getBoundingClientRect.xhtml
@@ -0,0 +1,84 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css"/>
+</head>
+<body style="margin:0; border:0; padding:0;">
+
+<div style="width:500px;height=100px">
+<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>
+
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+function executeTest() {
+ description("This test checks getBoundingClientRect() on rectangles");
+
+ debug("Checking a rectangle of absolute size at absolute coordinates:");
+ r1 = document.getElementById("r1").getBoundingClientRect();
+ shouldBeEqualToString('r1.left.toFixed(2)', '20.00');
+ shouldBeEqualToString('r1.top.toFixed(2)', '30.00');
+ shouldBeEqualToString('r1.width.toFixed(2)', '40.00');
+ shouldBeEqualToString('r1.height.toFixed(2)', '50.00');
+ shouldBeEqualToString('r1.right.toFixed(2)', '60.00');
+ shouldBeEqualToString('r1.bottom.toFixed(2)', '80.00');
+ debug("");
+
+ debug("Checking a resized rectangle at relative coordinates:");
+ r2 = document.getElementById("r2").getBoundingClientRect();
+ shouldBeEqualToString('r2.left.toFixed(2)', '180.00');
+ shouldBeEqualToString('r2.top.toFixed(2)', '15.00');
+ shouldBeEqualToString('r2.width.toFixed(2)', '160.00');
+ shouldBeEqualToString('r2.height.toFixed(2)', '25.00');
+ shouldBeEqualToString('r2.right.toFixed(2)', '340.00');
+ shouldBeEqualToString('r2.bottom.toFixed(2)', '40.00');
+ debug("");
+
+ debug("Checking rectangles with overflow:");
+ r3 = document.getElementById("r3").getBoundingClientRect();
+ shouldBeEqualToString('r3.left.toFixed(2)', '300.00');
+ shouldBeEqualToString('r3.top.toFixed(2)', '0.00');
+ shouldBeEqualToString('r3.width.toFixed(2)', '210.00');
+ shouldBeEqualToString('r3.height.toFixed(2)', '50.00');
+ shouldBeEqualToString('r3.right.toFixed(2)', '510.00');
+ shouldBeEqualToString('r3.bottom.toFixed(2)', '50.00');
+
+ r4 = document.getElementById("r4").getBoundingClientRect();
+ shouldBeEqualToString('r4.left.toFixed(2)', '300.00');
+ shouldBeEqualToString('r4.top.toFixed(2)', '50.00');
+ shouldBeEqualToString('r4.width.toFixed(2)', '210.00');
+ shouldBeEqualToString('r4.height.toFixed(2)', '60.00');
+ shouldBeEqualToString('r4.right.toFixed(2)', '510.00');
+ shouldBeEqualToString('r4.bottom.toFixed(2)', '110.00');
+ debug("");
+}
+</script>
+
+<script>
+if (window.layoutTestController) {
+ window.postZoomCallback = executeTest;
+} else {
+ debug("This test only works in DRT.");
+}
+</script>
+
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script>var zoomCount = 2;</script>
+<script src="../resources/testPageZoom.js"></script>
+
+</body>
+</html>
diff --git a/LayoutTests/svg/zoom/page/zoom-zoom-coords-expected.txt b/LayoutTests/svg/zoom/page/zoom-zoom-coords-expected.txt
new file mode 100644
index 0000000..aeb2793
--- /dev/null
+++ b/LayoutTests/svg/zoom/page/zoom-zoom-coords-expected.txt
@@ -0,0 +1,115 @@
+Test
+Test
+Test
+This test checks getBoundingClientRect() on zoomed HTML and SVG elements
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Gray rectangles: 100x50
+Green rectangles: 100x50, zoom=200%
+Blue rectangles: 200x100, zoom=50%
+
+Checking HTML elements:
+
+PASS div1.left.toFixed(2) is "0.00"
+PASS div1.top.toFixed(2) is "0.00"
+PASS div1.width.toFixed(2) is "100.00"
+PASS div1.height.toFixed(2) is "50.00"
+PASS div1.right.toFixed(2) is "100.00"
+PASS div1.bottom.toFixed(2) is "50.00"
+
+PASS div2.left.toFixed(2) is "0.00"
+PASS div2.top.toFixed(2) is "25.00"
+PASS div2.width.toFixed(2) is "100.00"
+PASS div2.height.toFixed(2) is "50.00"
+PASS div2.right.toFixed(2) is "100.00"
+PASS div2.bottom.toFixed(2) is "75.00"
+
+PASS div3.left.toFixed(2) is "0.00"
+PASS div3.top.toFixed(2) is "300.00"
+PASS div3.width.toFixed(2) is "200.00"
+PASS div3.height.toFixed(2) is "100.00"
+PASS div3.right.toFixed(2) is "200.00"
+PASS div3.bottom.toFixed(2) is "400.00"
+
+Checking SVG elements:
+
+PASS svg1.left.toFixed(2) is "0.00"
+PASS svg1.top.toFixed(2) is "250.00"
+PASS svg1.width.toFixed(2) is "150.00"
+PASS svg1.height.toFixed(2) is "50.00"
+PASS svg1.right.toFixed(2) is "150.00"
+PASS svg1.bottom.toFixed(2) is "300.00"
+PASS rect1.left.toFixed(2) is "0.00"
+PASS rect1.top.toFixed(2) is "250.00"
+PASS rect1.width.toFixed(2) is "100.00"
+PASS rect1.height.toFixed(2) is "50.00"
+PASS rect1.right.toFixed(2) is "100.00"
+PASS rect1.bottom.toFixed(2) is "300.00"
+PASS image1.left.toFixed(2) is "100.00"
+PASS image1.top.toFixed(2) is "250.00"
+PASS image1.width.toFixed(2) is "50.00"
+PASS image1.height.toFixed(2) is "25.00"
+PASS image1.right.toFixed(2) is "150.00"
+PASS image1.bottom.toFixed(2) is "275.00"
+PASS text1.left.toFixed(2) is "100.00"
+PASS text1.top.toFixed(2) is "282.50"
+PASS text1.width.toFixed(2) is "48.00"
+PASS text1.height.toFixed(2) is "6.00"
+PASS text1.right.toFixed(2) is "148.00"
+PASS text1.bottom.toFixed(2) is "288.50"
+
+PASS svg2.left.toFixed(2) is "75.00"
+PASS svg2.top.toFixed(2) is "100.00"
+PASS svg2.width.toFixed(2) is "150.00"
+PASS svg2.height.toFixed(2) is "50.00"
+PASS svg2.right.toFixed(2) is "225.00"
+PASS svg2.bottom.toFixed(2) is "150.00"
+PASS rect2.left.toFixed(2) is "75.00"
+PASS rect2.top.toFixed(2) is "100.00"
+PASS rect2.width.toFixed(2) is "100.00"
+PASS rect2.height.toFixed(2) is "50.00"
+PASS rect2.right.toFixed(2) is "175.00"
+PASS rect2.bottom.toFixed(2) is "150.00"
+PASS image2.left.toFixed(2) is "175.00"
+PASS image2.top.toFixed(2) is "100.00"
+PASS image2.width.toFixed(2) is "50.00"
+PASS image2.height.toFixed(2) is "25.00"
+PASS image2.right.toFixed(2) is "225.00"
+PASS image2.bottom.toFixed(2) is "125.00"
+PASS text2.left.toFixed(2) is "175.00"
+PASS text2.top.toFixed(2) is "132.50"
+PASS text2.width.toFixed(2) is "48.00"
+PASS text2.height.toFixed(2) is "6.00"
+PASS text2.right.toFixed(2) is "223.00"
+PASS text2.bottom.toFixed(2) is "138.50"
+
+PASS svg3.left.toFixed(2) is "900.00"
+PASS svg3.top.toFixed(2) is "500.00"
+PASS svg3.width.toFixed(2) is "300.00"
+PASS svg3.height.toFixed(2) is "100.00"
+PASS svg3.right.toFixed(2) is "1200.00"
+PASS svg3.bottom.toFixed(2) is "600.00"
+PASS rect3.left.toFixed(2) is "900.00"
+PASS rect3.top.toFixed(2) is "500.00"
+PASS rect3.width.toFixed(2) is "200.00"
+PASS rect3.height.toFixed(2) is "100.00"
+PASS rect3.right.toFixed(2) is "1100.00"
+PASS rect3.bottom.toFixed(2) is "600.00"
+PASS image3.left.toFixed(2) is "1100.00"
+PASS image3.top.toFixed(2) is "500.00"
+PASS image3.width.toFixed(2) is "100.00"
+PASS image3.height.toFixed(2) is "50.00"
+PASS image3.right.toFixed(2) is "1200.00"
+PASS image3.bottom.toFixed(2) is "550.00"
+PASS text3.left.toFixed(2) is "1100.00"
+PASS text3.top.toFixed(2) is "565.00"
+PASS text3.width.toFixed(2) is "96.00"
+PASS text3.height.toFixed(2) is "12.00"
+PASS text3.right.toFixed(2) is "1196.00"
+PASS text3.bottom.toFixed(2) is "577.00"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml b/LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml
new file mode 100644
index 0000000..3ed4972
--- /dev/null
+++ b/LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml
@@ -0,0 +1,198 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink">
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css"/>
+<style type="text/css">
+ body {
+ margin:0px;
+ border:0px;
+ padding:0px;
+ }
+ text {
+ font: 12px Ahem;
+ }
+ #div2, #svg2 {
+ zoom:200%;
+ }
+ #div3, #svg3 {
+ zoom:50%;
+ }
+</style>
+</head>
+<body>
+
+<div id="div1" style="width:100px;height:50px;background-color:gray;"></div>
+<div id="div2" style="width:100px;height:50px;background-color:green;"></div>
+<div id="div3" style="width:200px;height:100px;background-color:blue;"></div>
+<div style="width:600px;height=100px;">
+<svg id="svg1" xmlns="http://www.w3.org/2000/svg"
+ width="150px" height="50px" viewBox="0 0 150 100"
+ preserveAspectRatio="none">
+ <rect id="rect1" x="0" y="0" width="100px" height="100px" fill="gray" />
+ <image id="image1" x="100px" y="0" width="50px" height="50px" xlink:href="../../dom/resources/magnify.png" />
+ <text id="text1" x="100px" y="75px">Test</text>
+</svg><svg id="svg2" xmlns="http://www.w3.org/2000/svg"
+ width="150px" height="50px" viewBox="0 0 150 100"
+ preserveAspectRatio="none">
+ <rect id="rect2" x="0" y="0" width="100px" height="100px" fill="green" />
+ <image id="image2" x="100px" y="0" width="50px" height="50px" xlink:href="../../dom/resources/magnify.png" />
+ <text id="text2" x="100px" y="75px">Test</text>
+</svg><svg id="svg3" xmlns="http://www.w3.org/2000/svg"
+ width="300px" height="100px" viewBox="0 0 150 100"
+ preserveAspectRatio="none">
+ <rect id="rect3" x="0" y="0" width="100px" height="100px" fill="blue" />
+ <image id="image3" x="100px" y="0" width="50px" height="50px" xlink:href="../../dom/resources/magnify.png" />
+ <text id="text3" x="100px" y="75px">Test</text>
+</svg>
+</div>
+
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+function executeTest() {
+ description("This test checks getBoundingClientRect() on zoomed HTML and SVG elements");
+
+ debug("Gray rectangles: 100x50");
+ debug("Green rectangles: 100x50, zoom=200%");
+ debug("Blue rectangles: 200x100, zoom=50%");
+ debug("");
+
+ debug("Checking HTML elements:");
+ debug("");
+
+ div1 = document.getElementById("div1").getBoundingClientRect();
+ shouldBeEqualToString('div1.left.toFixed(2)', '0.00');
+ shouldBeEqualToString('div1.top.toFixed(2)', '0.00');
+ shouldBeEqualToString('div1.width.toFixed(2)', '100.00');
+ shouldBeEqualToString('div1.height.toFixed(2)', '50.00');
+ shouldBeEqualToString('div1.right.toFixed(2)', '100.00');
+ shouldBeEqualToString('div1.bottom.toFixed(2)', '50.00');
+ debug("");
+
+ div2 = document.getElementById("div2").getBoundingClientRect();
+ shouldBeEqualToString('div2.left.toFixed(2)', '0.00');
+ shouldBeEqualToString('div2.top.toFixed(2)', '25.00');
+ shouldBeEqualToString('div2.width.toFixed(2)', '100.00');
+ shouldBeEqualToString('div2.height.toFixed(2)', '50.00');
+ shouldBeEqualToString('div2.right.toFixed(2)', '100.00');
+ shouldBeEqualToString('div2.bottom.toFixed(2)', '75.00');
+ debug("");
+
+ div3 = document.getElementById("div3").getBoundingClientRect();
+ shouldBeEqualToString('div3.left.toFixed(2)', '0.00');
+ shouldBeEqualToString('div3.top.toFixed(2)', '300.00');
+ shouldBeEqualToString('div3.width.toFixed(2)', '200.00');
+ shouldBeEqualToString('div3.height.toFixed(2)', '100.00');
+ shouldBeEqualToString('div3.right.toFixed(2)', '200.00');
+ shouldBeEqualToString('div3.bottom.toFixed(2)', '400.00');
+ debug("");
+
+ debug("Checking SVG elements:");
+ debug("");
+
+ svg1 = document.getElementById("svg1").getBoundingClientRect();
+ shouldBeEqualToString('svg1.left.toFixed(2)', '0.00');
+ shouldBeEqualToString('svg1.top.toFixed(2)', '250.00');
+ shouldBeEqualToString('svg1.width.toFixed(2)', '150.00');
+ shouldBeEqualToString('svg1.height.toFixed(2)', '50.00');
+ shouldBeEqualToString('svg1.right.toFixed(2)', '150.00');
+ shouldBeEqualToString('svg1.bottom.toFixed(2)', '300.00');
+ rect1 = document.getElementById("rect1").getBoundingClientRect();
+ shouldBeEqualToString('rect1.left.toFixed(2)', '0.00');
+ shouldBeEqualToString('rect1.top.toFixed(2)', '250.00');
+ shouldBeEqualToString('rect1.width.toFixed(2)', '100.00');
+ shouldBeEqualToString('rect1.height.toFixed(2)', '50.00');
+ shouldBeEqualToString('rect1.right.toFixed(2)', '100.00');
+ shouldBeEqualToString('rect1.bottom.toFixed(2)', '300.00');
+ image1 = document.getElementById("image1").getBoundingClientRect();
+ shouldBeEqualToString('image1.left.toFixed(2)', '100.00');
+ shouldBeEqualToString('image1.top.toFixed(2)', '250.00');
+ shouldBeEqualToString('image1.width.toFixed(2)', '50.00');
+ shouldBeEqualToString('image1.height.toFixed(2)', '25.00');
+ shouldBeEqualToString('image1.right.toFixed(2)', '150.00');
+ shouldBeEqualToString('image1.bottom.toFixed(2)', '275.00');
+ text1 = document.getElementById("text1").getBoundingClientRect();
+ shouldBeEqualToString('text1.left.toFixed(2)', '100.00');
+ shouldBeEqualToString('text1.top.toFixed(2)', '282.50');
+ shouldBeEqualToString('text1.width.toFixed(2)', '48.00');
+ shouldBeEqualToString('text1.height.toFixed(2)', '6.00');
+ shouldBeEqualToString('text1.right.toFixed(2)', '148.00');
+ shouldBeEqualToString('text1.bottom.toFixed(2)', '288.50');
+ debug("");
+
+ svg2 = document.getElementById("svg2").getBoundingClientRect();
+ shouldBeEqualToString('svg2.left.toFixed(2)', '75.00');
+ shouldBeEqualToString('svg2.top.toFixed(2)', '100.00');
+ shouldBeEqualToString('svg2.width.toFixed(2)', '150.00');
+ shouldBeEqualToString('svg2.height.toFixed(2)', '50.00');
+ shouldBeEqualToString('svg2.right.toFixed(2)', '225.00');
+ shouldBeEqualToString('svg2.bottom.toFixed(2)', '150.00');
+ rect2 = document.getElementById("rect2").getBoundingClientRect();
+ shouldBeEqualToString('rect2.left.toFixed(2)', '75.00');
+ shouldBeEqualToString('rect2.top.toFixed(2)', '100.00');
+ shouldBeEqualToString('rect2.width.toFixed(2)', '100.00');
+ shouldBeEqualToString('rect2.height.toFixed(2)', '50.00');
+ shouldBeEqualToString('rect2.right.toFixed(2)', '175.00');
+ shouldBeEqualToString('rect2.bottom.toFixed(2)', '150.00');
+ image2 = document.getElementById("image2").getBoundingClientRect();
+ shouldBeEqualToString('image2.left.toFixed(2)', '175.00');
+ shouldBeEqualToString('image2.top.toFixed(2)', '100.00');
+ shouldBeEqualToString('image2.width.toFixed(2)', '50.00');
+ shouldBeEqualToString('image2.height.toFixed(2)', '25.00');
+ shouldBeEqualToString('image2.right.toFixed(2)', '225.00');
+ shouldBeEqualToString('image2.bottom.toFixed(2)', '125.00');
+ text2 = document.getElementById("text2").getBoundingClientRect();
+ shouldBeEqualToString('text2.left.toFixed(2)', '175.00');
+ shouldBeEqualToString('text2.top.toFixed(2)', '132.50');
+ shouldBeEqualToString('text2.width.toFixed(2)', '48.00');
+ shouldBeEqualToString('text2.height.toFixed(2)', '6.00');
+ shouldBeEqualToString('text2.right.toFixed(2)', '223.00');
+ shouldBeEqualToString('text2.bottom.toFixed(2)', '138.50');
+ debug("");
+
+ svg3 = document.getElementById("svg3").getBoundingClientRect();
+ shouldBeEqualToString('svg3.left.toFixed(2)', '900.00');
+ shouldBeEqualToString('svg3.top.toFixed(2)', '500.00');
+ shouldBeEqualToString('svg3.width.toFixed(2)', '300.00');
+ shouldBeEqualToString('svg3.height.toFixed(2)', '100.00');
+ shouldBeEqualToString('svg3.right.toFixed(2)', '1200.00');
+ shouldBeEqualToString('svg3.bottom.toFixed(2)', '600.00');
+ rect3 = document.getElementById("rect3").getBoundingClientRect();
+ shouldBeEqualToString('rect3.left.toFixed(2)', '900.00');
+ shouldBeEqualToString('rect3.top.toFixed(2)', '500.00');
+ shouldBeEqualToString('rect3.width.toFixed(2)', '200.00');
+ shouldBeEqualToString('rect3.height.toFixed(2)', '100.00');
+ shouldBeEqualToString('rect3.right.toFixed(2)', '1100.00');
+ shouldBeEqualToString('rect3.bottom.toFixed(2)', '600.00');
+ image3 = document.getElementById("image3").getBoundingClientRect();
+ shouldBeEqualToString('image3.left.toFixed(2)', '1100.00');
+ shouldBeEqualToString('image3.top.toFixed(2)', '500.00');
+ shouldBeEqualToString('image3.width.toFixed(2)', '100.00');
+ shouldBeEqualToString('image3.height.toFixed(2)', '50.00');
+ shouldBeEqualToString('image3.right.toFixed(2)', '1200.00');
+ shouldBeEqualToString('image3.bottom.toFixed(2)', '550.00');
+ text3 = document.getElementById("text3").getBoundingClientRect();
+ shouldBeEqualToString('text3.left.toFixed(2)', '1100.00');
+ shouldBeEqualToString('text3.top.toFixed(2)', '565.00');
+ shouldBeEqualToString('text3.width.toFixed(2)', '96.00');
+ shouldBeEqualToString('text3.height.toFixed(2)', '12.00');
+ shouldBeEqualToString('text3.right.toFixed(2)', '1196.00');
+ shouldBeEqualToString('text3.bottom.toFixed(2)', '577.00');
+ debug("");
+}
+</script>
+
+<script>
+if (window.layoutTestController) {
+ window.postZoomCallback = executeTest;
+} else {
+ debug("This test only works in DRT.");
+}
+</script>
+
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script>var zoomCount = 2;</script>
+<script src="../resources/testPageZoom.js"></script>
+
+</body>
+</html>
diff --git a/LayoutTests/svg/zoom/resources/testPageZoom.js b/LayoutTests/svg/zoom/resources/testPageZoom.js
index 4afb16d..7f9fbe9 100644
--- a/LayoutTests/svg/zoom/resources/testPageZoom.js
+++ b/LayoutTests/svg/zoom/resources/testPageZoom.js
@@ -11,6 +11,26 @@ if (window.layoutTestController && window.eventSender) {
eventSender.zoomPageIn();
}
- layoutTestController.notifyDone();
+ if (window.postZoomCallback) {
+ window.setTimeout(function() {
+ window.postZoomCallback();
+ completeDynamicTest();
+ }, 0);
+ } else {
+ layoutTestController.notifyDone();
+ }
}, 0);
}
+
+function completeDynamicTest() {
+ var script = document.createElement("script");
+
+ script.onload = function() {
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ };
+
+ script.src = "../../../fast/js/resources/js-test-post.js";
+ successfullyParsed = true;
+ document.body.appendChild(script);
+}
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e760c6b..58b01e2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2010-11-29 Cosmin Truta <ctruta at chromium.org>
+
+ Reviewed by Nikolas Zimmermann.
+
+ getBoundingClientRect: Do not truncate the coordinates to integers
+ https://bugs.webkit.org/show_bug.cgi?id=48110
+
+ Remove the float-to-int coordinate conversions inside getBoundingClientRect,
+ to comply with the CSSOM View Module API.
+
+ Tests: fast/dom/Element/getBoundingClientRect.html
+ fast/dom/Range/getBoundingClientRect.html
+ svg/zoom/page/zoom-getBoundingClientRect.xhtml
+ svg/zoom/page/zoom-zoom-coords.xhtml
+
+ * dom/ClientRect.cpp:
+ (WebCore::ClientRect::ClientRect): Added overload to allow a FloatRect argument.
+ * dom/ClientRect.h:
+ (WebCore::ClientRect::create): Ditto.
+ * dom/Element.cpp:
+ (Element::getBoundingClientRect): Removed conversion from FloatRect to IntRect.
+ * dom/Range.cpp:
+ (WebCore::Range::getBoundingClientRect): Ditto.
+ * rendering/RenderObject.h:
+ (adjustIntRectForAbsoluteZoom): Removed.
+ (adjustFloatRectForAbsoluteZoom): Added.
+ * rendering/style/RenderStyle.h:
+ (adjustFloatForAbsoluteZoom): Added.
+
2010-11-29 Dimitri Glazkov <dglazkov at chromium.org>
Reviewed by Darin Adler.
diff --git a/WebCore/dom/ClientRect.cpp b/WebCore/dom/ClientRect.cpp
index c69a2ab..b132222 100644
--- a/WebCore/dom/ClientRect.cpp
+++ b/WebCore/dom/ClientRect.cpp
@@ -38,4 +38,9 @@ ClientRect::ClientRect(const IntRect& rect)
{
}
+ClientRect::ClientRect(const FloatRect& rect)
+ : m_rect(rect)
+{
+}
+
} // namespace WebCore
diff --git a/WebCore/dom/ClientRect.h b/WebCore/dom/ClientRect.h
index 349ea85..f9acef0 100644
--- a/WebCore/dom/ClientRect.h
+++ b/WebCore/dom/ClientRect.h
@@ -39,6 +39,7 @@ namespace WebCore {
public:
static PassRefPtr<ClientRect> create() { return adoptRef(new ClientRect); }
static PassRefPtr<ClientRect> create(const IntRect& rect) { return adoptRef(new ClientRect(rect)); }
+ static PassRefPtr<ClientRect> create(const FloatRect& rect) { return adoptRef(new ClientRect(rect)); }
float top() const { return m_rect.y(); }
float right() const { return m_rect.right(); }
@@ -50,6 +51,7 @@ namespace WebCore {
private:
ClientRect();
ClientRect(const IntRect&);
+ ClientRect(const FloatRect&);
FloatRect m_rect;
};
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index 1f2e6c2..8581e69 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -546,16 +546,16 @@ PassRefPtr<ClientRect> Element::getBoundingClientRect() const
if (quads.isEmpty())
return ClientRect::create();
- IntRect result = quads[0].enclosingBoundingBox();
+ FloatRect result = quads[0].boundingBox();
for (size_t i = 1; i < quads.size(); ++i)
- result.unite(quads[i].enclosingBoundingBox());
+ result.unite(quads[i].boundingBox());
if (FrameView* view = document()->view()) {
IntRect visibleContentRect = view->visibleContentRect();
result.move(-visibleContentRect.x(), -visibleContentRect.y());
}
- adjustIntRectForAbsoluteZoom(result, renderer());
+ adjustFloatRectForAbsoluteZoom(result, renderer());
return ClientRect::create(result);
}
diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp
index 5507b83..96acf8e 100644
--- a/WebCore/dom/Range.cpp
+++ b/WebCore/dom/Range.cpp
@@ -1912,9 +1912,9 @@ PassRefPtr<ClientRect> Range::getBoundingClientRect() const
if (quads.isEmpty())
return ClientRect::create();
- IntRect result;
+ FloatRect result;
for (size_t i = 0; i < quads.size(); ++i)
- result.unite(quads[i].enclosingBoundingBox());
+ result.unite(quads[i].boundingBox());
return ClientRect::create(result);
}
diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
index bfc62fe..e16ad46 100644
--- a/WebCore/rendering/RenderObject.h
+++ b/WebCore/rendering/RenderObject.h
@@ -1002,14 +1002,6 @@ inline int adjustForAbsoluteZoom(int value, RenderObject* renderer)
return adjustForAbsoluteZoom(value, renderer->style());
}
-inline void adjustIntRectForAbsoluteZoom(IntRect& rect, RenderObject* renderer)
-{
- rect.setX(adjustForAbsoluteZoom(rect.x(), renderer));
- rect.setY(adjustForAbsoluteZoom(rect.y(), renderer));
- rect.setWidth(adjustForAbsoluteZoom(rect.width(), renderer));
- rect.setHeight(adjustForAbsoluteZoom(rect.height(), renderer));
-}
-
inline FloatPoint adjustFloatPointForAbsoluteZoom(const FloatPoint& point, RenderObject* renderer)
{
// The result here is in floats, so we don't need the truncation hack from the integer version above.
@@ -1027,6 +1019,15 @@ inline void adjustFloatQuadForAbsoluteZoom(FloatQuad& quad, RenderObject* render
quad.setP4(adjustFloatPointForAbsoluteZoom(quad.p4(), renderer));
}
+inline void adjustFloatRectForAbsoluteZoom(FloatRect& rect, RenderObject* renderer)
+{
+ RenderStyle* style = renderer->style();
+ rect.setX(adjustFloatForAbsoluteZoom(rect.x(), style));
+ rect.setY(adjustFloatForAbsoluteZoom(rect.y(), style));
+ rect.setWidth(adjustFloatForAbsoluteZoom(rect.width(), style));
+ rect.setHeight(adjustFloatForAbsoluteZoom(rect.height(), style));
+}
+
} // namespace WebCore
#ifndef NDEBUG
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index 132ef1f..62c4548 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -1332,6 +1332,11 @@ inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
return roundForImpreciseConversion<int, INT_MAX, INT_MIN>(value / zoomFactor);
}
+inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle* style)
+{
+ return value / style->effectiveZoom();
+}
+
} // namespace WebCore
#endif // RenderStyle_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list