Diff
Modified: trunk/LayoutTests/ChangeLog (215891 => 215892)
--- trunk/LayoutTests/ChangeLog 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/ChangeLog 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1,3 +1,32 @@
+2017-04-27 Chris Dumez <[email protected]>
+
+ Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
+ https://bugs.webkit.org/show_bug.cgi?id=171226
+
+ Reviewed by Simon Fraser.
+
+ Update existing tests to reflect behavior change.
+
+ * TestExpectations:
+ * css3/flexbox/align-absolute-child-expected.txt:
+ * fast/css/ClientRect-attributes-prototype-expected.txt: Removed.
+ * fast/css/ClientRect-attributes-prototype.html: Removed.
+ * fast/css/ClientRect-serialization-expected.txt: Removed.
+ * fast/css/ClientRect-serialization.html: Removed.
+ * fast/css/DOMRect-attributes-prototype-expected.txt: Added.
+ * fast/css/DOMRect-attributes-prototype.html: Added.
+ * fast/css/DOMRect-serialization-expected.txt: Added.
+ * fast/css/DOMRect-serialization.html: Added.
+ * fast/dom/Element/getClientRects-return-type-expected.txt: Added.
+ * fast/dom/Element/getClientRects-return-type.html: Added.
+ * fast/dom/collection-iterators-expected.txt:
+ * fast/dom/collection-iterators.html:
+ * fast/visual-viewport/zoomed-fixed-expected.txt:
+ * fast/visual-viewport/zoomed-fixed-header-and-footer-expected.txt:
+ * fast/zooming/client-rect-in-fixed-zoomed-expected.txt:
+ * fast/zooming/client-rect-in-fixed-zoomed.html:
+ * js/resources/JSON-stringify.js:
+
2017-04-27 Ryan Haddad <[email protected]>
Mark media/modern-media-controls/fullscreen-button/fullscreen-button.html as flaky.
Modified: trunk/LayoutTests/TestExpectations (215891 => 215892)
--- trunk/LayoutTests/TestExpectations 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/TestExpectations 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1266,7 +1266,6 @@
# CSSOM View module
webkit.org/b/153137 imported/w3c/web-platform-tests/cssom-view/elementsFromPoint.html [ Skip ]
webkit.org/b/5991 imported/w3c/web-platform-tests/cssom-view/scrollingElement.html [ Skip ]
-webkit.org/b/171226 imported/w3c/web-platform-tests/cssom-view/cssom-getBoundingClientRect-002.html [ Skip ]
### END OF -disabled tests
########################################
Modified: trunk/LayoutTests/css3/flexbox/align-absolute-child-expected.txt (215891 => 215892)
--- trunk/LayoutTests/css3/flexbox/align-absolute-child-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/css3/flexbox/align-absolute-child-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1,10 +1,12 @@
+PASS position of x
+PASS position of y
+PASS position of width
+PASS position of height
PASS position of top
PASS position of right
PASS position of bottom
PASS position of left
-PASS position of width
-PASS position of height
PASS position of toJSON
PASS .flexbox 1
PASS .flexbox 2
Deleted: trunk/LayoutTests/fast/css/ClientRect-attributes-prototype-expected.txt (215891 => 215892)
--- trunk/LayoutTests/fast/css/ClientRect-attributes-prototype-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/fast/css/ClientRect-attributes-prototype-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1,78 +0,0 @@
-Test that ClientRect's properties are on the prototype.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS clientRect.__proto__ is ClientRect.prototype
-PASS Object.getOwnPropertyNames(clientRect).length is 0
-PASS Object.hasOwnProperty(clientRect, 'top') is false
-PASS Object.hasOwnProperty(clientRect, 'right') is false
-PASS Object.hasOwnProperty(clientRect, 'bottom') is false
-PASS Object.hasOwnProperty(clientRect, 'left') is false
-PASS Object.hasOwnProperty(clientRect, 'width') is false
-PASS Object.hasOwnProperty(clientRect, 'height') is false
-
-* clientRect.__proto__.top
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* ClientRect.prototype.top
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* clientRect.__proto__.right
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* ClientRect.prototype.right
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* clientRect.__proto__.bottom
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* ClientRect.prototype.bottom
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* clientRect.__proto__.left
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* ClientRect.prototype.left
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* clientRect.__proto__.width
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* ClientRect.prototype.width
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* clientRect.__proto__.height
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-* ClientRect.prototype.height
-PASS descriptor.get is an instance of Function
-PASS descriptor.enumerable is true
-PASS descriptor.configurable is true
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/fast/css/ClientRect-attributes-prototype.html (215891 => 215892)
--- trunk/LayoutTests/fast/css/ClientRect-attributes-prototype.html 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/fast/css/ClientRect-attributes-prototype.html 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<script src=""
-<script>
-description("Test that ClientRect's properties are on the prototype.");
-
-var clientRect = document.body.getBoundingClientRect();
-shouldBe("clientRect.__proto__", "ClientRect.prototype");
-shouldBe("Object.getOwnPropertyNames(clientRect).length", "0");
-shouldBeFalse("Object.hasOwnProperty(clientRect, 'top')");
-shouldBeFalse("Object.hasOwnProperty(clientRect, 'right')");
-shouldBeFalse("Object.hasOwnProperty(clientRect, 'bottom')");
-shouldBeFalse("Object.hasOwnProperty(clientRect, 'left')");
-shouldBeFalse("Object.hasOwnProperty(clientRect, 'width')");
-shouldBeFalse("Object.hasOwnProperty(clientRect, 'height')");
-
-function checkAttributeGetter(prototype, propertyName)
-{
- descriptor = Object.getOwnPropertyDescriptor(prototype, propertyName);
- shouldBeType("descriptor.get", "Function");
- shouldBeTrue("descriptor.enumerable");
- shouldBeTrue("descriptor.configurable");
-}
-
-for (var propertyName of ['top', 'right', 'bottom', 'left', 'width', 'height']) {
- debug("");
- debug("* clientRect.__proto__." + propertyName);
- checkAttributeGetter(clientRect.__proto__, propertyName);
-
- debug("");
- debug("* ClientRect.prototype." + propertyName);
- checkAttributeGetter(ClientRect.prototype, propertyName);
-}
-
-debug("");
-</script>
-<script src=""
-</body>
-</html>
Deleted: trunk/LayoutTests/fast/css/ClientRect-serialization-expected.txt (215891 => 215892)
--- trunk/LayoutTests/fast/css/ClientRect-serialization-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/fast/css/ClientRect-serialization-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1,28 +0,0 @@
-Test that ClientRect has a serializer
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS clientRect.__proto__ is ClientRect.prototype
-PASS toJSONDescriptor.value is an instance of Function
-PASS toJSONDescriptor.enumerable is true
-PASS toJSONDescriptor.configurable is true
-PASS toJSONDescriptor.writable is true
-PASS jsonObject = clientRect.toJSON() did not throw exception.
-PASS jsonObject.top is clientRect.top
-PASS jsonObject.right is clientRect.right
-PASS jsonObject.bottom is clientRect.bottom
-PASS jsonObject.left is clientRect.left
-PASS jsonObject.width is clientRect.width
-PASS jsonObject.height is clientRect.height
-PASS parsedJSONObject = JSON.parse(JSON.stringify(clientRect)) did not throw exception.
-PASS parsedJSONObject.top is clientRect.top
-PASS parsedJSONObject.right is clientRect.right
-PASS parsedJSONObject.bottom is clientRect.bottom
-PASS parsedJSONObject.left is clientRect.left
-PASS parsedJSONObject.width is clientRect.width
-PASS parsedJSONObject.height is clientRect.height
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/fast/css/ClientRect-serialization.html (215891 => 215892)
--- trunk/LayoutTests/fast/css/ClientRect-serialization.html 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/fast/css/ClientRect-serialization.html 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<script src=""
-<script>
-description("Test that ClientRect has a serializer");
-
-var clientRect = document.body.getBoundingClientRect();
-shouldBe("clientRect.__proto__", "ClientRect.prototype");
-var toJSONDescriptor = Object.getOwnPropertyDescriptor(clientRect.__proto__, "toJSON");
-shouldBeType("toJSONDescriptor.value", "Function");
-shouldBeTrue("toJSONDescriptor.enumerable");
-shouldBeTrue("toJSONDescriptor.configurable");
-shouldBeTrue("toJSONDescriptor.writable");
-
-shouldNotThrow("jsonObject = clientRect.toJSON()");
-shouldBe("jsonObject.top", "clientRect.top");
-shouldBe("jsonObject.right", "clientRect.right");
-shouldBe("jsonObject.bottom", "clientRect.bottom");
-shouldBe("jsonObject.left", "clientRect.left");
-shouldBe("jsonObject.width", "clientRect.width");
-shouldBe("jsonObject.height", "clientRect.height");
-
-shouldNotThrow("parsedJSONObject = JSON.parse(JSON.stringify(clientRect))");
-shouldBe("parsedJSONObject.top", "clientRect.top");
-shouldBe("parsedJSONObject.right", "clientRect.right");
-shouldBe("parsedJSONObject.bottom", "clientRect.bottom");
-shouldBe("parsedJSONObject.left", "clientRect.left");
-shouldBe("parsedJSONObject.width", "clientRect.width");
-shouldBe("parsedJSONObject.height", "clientRect.height");
-</script>
-<script src=""
-</body>
-</html>
Added: trunk/LayoutTests/fast/css/DOMRect-attributes-prototype-expected.txt (0 => 215892)
--- trunk/LayoutTests/fast/css/DOMRect-attributes-prototype-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/DOMRect-attributes-prototype-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -0,0 +1,139 @@
+Test that DOMRect's properties are on the prototype.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rect.__proto__ is DOMRect.prototype
+PASS rect.__proto__.__proto__ is DOMRectReadOnly.prototype
+PASS Object.getOwnPropertyNames(rect).length is 0
+PASS Object.hasOwnProperty(rect, 'top') is false
+PASS Object.hasOwnProperty(rect, 'right') is false
+PASS Object.hasOwnProperty(rect, 'bottom') is false
+PASS Object.hasOwnProperty(rect, 'left') is false
+PASS Object.hasOwnProperty(rect, 'width') is false
+PASS Object.hasOwnProperty(rect, 'height') is false
+
+* rect.__proto__.x
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRect.prototype.x
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.y
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRect.prototype.y
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.width
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRect.prototype.width
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.height
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRect.prototype.height
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.__proto__.x
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRectReadonly.prototype.x
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.__proto__.y
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRectReadonly.prototype.y
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.__proto__.width
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRectReadonly.prototype.width
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.__proto__.height
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRectReadonly.prototype.height
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.__proto__.top
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRectReadonly.prototype.top
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.__proto__.right
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRectReadonly.prototype.right
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.__proto__.bottom
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRectReadonly.prototype.bottom
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* rect.__proto__.__proto__.left
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+* DOMRectReadonly.prototype.left
+PASS descriptor.get is an instance of Function
+PASS descriptor.enumerable is true
+PASS descriptor.configurable is true
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/DOMRect-attributes-prototype.html (0 => 215892)
--- trunk/LayoutTests/fast/css/DOMRect-attributes-prototype.html (rev 0)
+++ trunk/LayoutTests/fast/css/DOMRect-attributes-prototype.html 2017-04-27 21:00:50 UTC (rev 215892)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Test that DOMRect's properties are on the prototype.");
+
+var rect = document.body.getBoundingClientRect();
+shouldBe("rect.__proto__", "DOMRect.prototype");
+shouldBe("rect.__proto__.__proto__", "DOMRectReadOnly.prototype");
+shouldBe("Object.getOwnPropertyNames(rect).length", "0");
+shouldBeFalse("Object.hasOwnProperty(rect, 'top')");
+shouldBeFalse("Object.hasOwnProperty(rect, 'right')");
+shouldBeFalse("Object.hasOwnProperty(rect, 'bottom')");
+shouldBeFalse("Object.hasOwnProperty(rect, 'left')");
+shouldBeFalse("Object.hasOwnProperty(rect, 'width')");
+shouldBeFalse("Object.hasOwnProperty(rect, 'height')");
+
+function checkAttributeGetter(prototype, propertyName)
+{
+ descriptor = Object.getOwnPropertyDescriptor(prototype, propertyName);
+ shouldBeType("descriptor.get", "Function");
+ shouldBeTrue("descriptor.enumerable");
+ shouldBeTrue("descriptor.configurable");
+}
+
+for (var propertyName of ['x', 'y', 'width', 'height']) {
+ debug("");
+ debug("* rect.__proto__." + propertyName);
+ checkAttributeGetter(rect.__proto__, propertyName);
+
+ debug("");
+ debug("* DOMRect.prototype." + propertyName);
+ checkAttributeGetter(DOMRect.prototype, propertyName);
+}
+
+for (var propertyName of ['x', 'y', 'width', 'height', 'top', 'right', 'bottom', 'left']) {
+ debug("");
+ debug("* rect.__proto__.__proto__." + propertyName);
+ checkAttributeGetter(rect.__proto__.__proto__, propertyName);
+
+ debug("");
+ debug("* DOMRectReadonly.prototype." + propertyName);
+ checkAttributeGetter(DOMRectReadOnly.prototype, propertyName);
+}
+
+debug("");
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/DOMRect-serialization-expected.txt (0 => 215892)
--- trunk/LayoutTests/fast/css/DOMRect-serialization-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/css/DOMRect-serialization-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -0,0 +1,28 @@
+Test that DOMRect has a serializer
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rect.__proto__ is DOMRect.prototype
+PASS toJSONDescriptor.value is an instance of Function
+PASS toJSONDescriptor.enumerable is true
+PASS toJSONDescriptor.configurable is true
+PASS toJSONDescriptor.writable is true
+PASS jsonObject = rect.toJSON() did not throw exception.
+PASS jsonObject.top is rect.top
+PASS jsonObject.right is rect.right
+PASS jsonObject.bottom is rect.bottom
+PASS jsonObject.left is rect.left
+PASS jsonObject.width is rect.width
+PASS jsonObject.height is rect.height
+PASS parsedJSONObject = JSON.parse(JSON.stringify(rect)) did not throw exception.
+PASS parsedJSONObject.top is rect.top
+PASS parsedJSONObject.right is rect.right
+PASS parsedJSONObject.bottom is rect.bottom
+PASS parsedJSONObject.left is rect.left
+PASS parsedJSONObject.width is rect.width
+PASS parsedJSONObject.height is rect.height
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/css/DOMRect-serialization.html (0 => 215892)
--- trunk/LayoutTests/fast/css/DOMRect-serialization.html (rev 0)
+++ trunk/LayoutTests/fast/css/DOMRect-serialization.html 2017-04-27 21:00:50 UTC (rev 215892)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Test that DOMRect has a serializer");
+
+var rect = document.body.getBoundingClientRect();
+shouldBe("rect.__proto__", "DOMRect.prototype");
+var toJSONDescriptor = Object.getOwnPropertyDescriptor(rect.__proto__.__proto__, "toJSON");
+shouldBeType("toJSONDescriptor.value", "Function");
+shouldBeTrue("toJSONDescriptor.enumerable");
+shouldBeTrue("toJSONDescriptor.configurable");
+shouldBeTrue("toJSONDescriptor.writable");
+
+shouldNotThrow("jsonObject = rect.toJSON()");
+shouldBe("jsonObject.top", "rect.top");
+shouldBe("jsonObject.right", "rect.right");
+shouldBe("jsonObject.bottom", "rect.bottom");
+shouldBe("jsonObject.left", "rect.left");
+shouldBe("jsonObject.width", "rect.width");
+shouldBe("jsonObject.height", "rect.height");
+
+shouldNotThrow("parsedJSONObject = JSON.parse(JSON.stringify(rect))");
+shouldBe("parsedJSONObject.top", "rect.top");
+shouldBe("parsedJSONObject.right", "rect.right");
+shouldBe("parsedJSONObject.bottom", "rect.bottom");
+shouldBe("parsedJSONObject.left", "rect.left");
+shouldBe("parsedJSONObject.width", "rect.width");
+shouldBe("parsedJSONObject.height", "rect.height");
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/Element/getClientRects-return-type-expected.txt (0 => 215892)
--- trunk/LayoutTests/fast/dom/Element/getClientRects-return-type-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/getClientRects-return-type-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -0,0 +1,12 @@
+Tests that Element.getClientRects() returns an array of DOMRect objects.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rects.__proto__ is Array.prototype
+PASS rects.length is 1
+PASS rects[0].__proto__ is DOMRect.prototype
+PASS successfullyParsed is true
+
+TEST COMPLETE
+>
Added: trunk/LayoutTests/fast/dom/Element/getClientRects-return-type.html (0 => 215892)
--- trunk/LayoutTests/fast/dom/Element/getClientRects-return-type.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/getClientRects-return-type.html 2017-04-27 21:00:50 UTC (rev 215892)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests that Element.getClientRects() returns an array of DOMRect objects.");
+
+const rects = document.body.getClientRects();
+shouldBe("rects.__proto__", "Array.prototype");
+shouldBe("rects.length", "1");
+shouldBe("rects[0].__proto__", "DOMRect.prototype");
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/dom/collection-iterators-expected.txt (215891 => 215892)
--- trunk/LayoutTests/fast/dom/collection-iterators-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/fast/dom/collection-iterators-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -12,15 +12,6 @@
PASS 'forEach' in obj is false
PASS 'values' in obj is false
-* ClientRectList
-PASS obj.__proto__ is ClientRectList.prototype
-PASS Symbol.iterator in obj is true
-PASS for..of did not throw an exception
-PASS 'entries' in obj is false
-PASS 'keys' in obj is false
-PASS 'forEach' in obj is false
-PASS 'values' in obj is false
-
* CSSRuleList
PASS obj.__proto__ is CSSRuleList.prototype
PASS Symbol.iterator in obj is true
Modified: trunk/LayoutTests/fast/dom/collection-iterators.html (215891 => 215892)
--- trunk/LayoutTests/fast/dom/collection-iterators.html 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/fast/dom/collection-iterators.html 2017-04-27 21:00:50 UTC (rev 215892)
@@ -41,7 +41,6 @@
var media = document.createElement("video");
checkHasIterator("AudioTrackList", media.audioTracks);
-checkHasIterator("ClientRectList", document.body.getClientRects());
checkHasIterator("CSSRuleList", window.getMatchedCSSRules(document.body));
checkHasIterator("CSSStyleDeclaration", window.getComputedStyle(document.body));
checkHasIterator("CSSValueList", window.getComputedStyle(document.body).getPropertyCSSValue('background-position'));
Modified: trunk/LayoutTests/fast/visual-viewport/zoomed-fixed-expected.txt (215891 => 215892)
--- trunk/LayoutTests/fast/visual-viewport/zoomed-fixed-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/fast/visual-viewport/zoomed-fixed-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -6,49 +6,49 @@
JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":785,"bottom":585,"left":0,"width":785,"height":585}
JSON.stringify(internals.visualViewportRect()) is {"top":0,"right":392.5,"bottom":292.5,"left":0,"width":392.5,"height":292.5}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":785,"bottom":100,"left":0,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":0,"width":785,"height":100,"top":0,"right":785,"bottom":100,"left":0}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":485,"right":785,"bottom":585,"left":0,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":485,"width":785,"height":100,"top":485,"right":785,"bottom":585,"left":0}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":100,"bottom":585,"left":0,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":0,"width":100,"height":585,"top":0,"right":100,"bottom":585,"left":0}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":785,"bottom":585,"left":685,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":685,"y":0,"width":100,"height":585,"top":0,"right":785,"bottom":585,"left":685}
Scrolled to 475, 525
JSON.stringify(internals.layoutViewportRect()) is {"top":232.5,"right":867.5,"bottom":817.5,"left":82.5,"width":785,"height":585}
JSON.stringify(internals.visualViewportRect()) is {"top":525,"right":867.5,"bottom":817.5,"left":475,"width":392.5,"height":292.5}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-292.5,"right":392.5,"bottom":-192.5,"left":-392.5,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-392.5,"y":-292.5,"width":785,"height":100,"top":-292.5,"right":392.5,"bottom":-192.5,"left":-392.5}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":192.5,"right":392.5,"bottom":292.5,"left":-392.5,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-392.5,"y":192.5,"width":785,"height":100,"top":192.5,"right":392.5,"bottom":292.5,"left":-392.5}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-292.5,"right":-292.5,"bottom":292.5,"left":-392.5,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-392.5,"y":-292.5,"width":100,"height":585,"top":-292.5,"right":-292.5,"bottom":292.5,"left":-392.5}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-292.5,"right":392.5,"bottom":292.5,"left":292.5,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":292.5,"y":-292.5,"width":100,"height":585,"top":-292.5,"right":392.5,"bottom":292.5,"left":292.5}
Scrolled to 100, 776
JSON.stringify(internals.layoutViewportRect()) is {"top":483.5,"right":867.5,"bottom":1068.5,"left":82.5,"width":785,"height":585}
JSON.stringify(internals.visualViewportRect()) is {"top":776,"right":492.5,"bottom":1068.5,"left":100,"width":392.5,"height":292.5}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-292.5,"right":767.5,"bottom":-192.5,"left":-17.5,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-17.5,"y":-292.5,"width":785,"height":100,"top":-292.5,"right":767.5,"bottom":-192.5,"left":-17.5}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":192.5,"right":767.5,"bottom":292.5,"left":-17.5,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-17.5,"y":192.5,"width":785,"height":100,"top":192.5,"right":767.5,"bottom":292.5,"left":-17.5}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-292.5,"right":82.5,"bottom":292.5,"left":-17.5,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-17.5,"y":-292.5,"width":100,"height":585,"top":-292.5,"right":82.5,"bottom":292.5,"left":-17.5}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-292.5,"right":767.5,"bottom":292.5,"left":667.5,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":667.5,"y":-292.5,"width":100,"height":585,"top":-292.5,"right":767.5,"bottom":292.5,"left":667.5}
Scrolled to 50, 300
JSON.stringify(internals.layoutViewportRect()) is {"top":300,"right":835,"bottom":885,"left":50,"width":785,"height":585}
JSON.stringify(internals.visualViewportRect()) is {"top":300,"right":442.5,"bottom":592.5,"left":50,"width":392.5,"height":292.5}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":785,"bottom":100,"left":0,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":0,"width":785,"height":100,"top":0,"right":785,"bottom":100,"left":0}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":485,"right":785,"bottom":585,"left":0,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":485,"width":785,"height":100,"top":485,"right":785,"bottom":585,"left":0}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":100,"bottom":585,"left":0,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":0,"width":100,"height":585,"top":0,"right":100,"bottom":585,"left":0}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":785,"bottom":585,"left":685,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":685,"y":0,"width":100,"height":585,"top":0,"right":785,"bottom":585,"left":685}
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/visual-viewport/zoomed-fixed-header-and-footer-expected.txt (215891 => 215892)
--- trunk/LayoutTests/fast/visual-viewport/zoomed-fixed-header-and-footer-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/fast/visual-viewport/zoomed-fixed-header-and-footer-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -6,49 +6,49 @@
JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":785,"bottom":585,"left":0,"width":785,"height":585}
JSON.stringify(internals.visualViewportRect()) is {"top":0,"right":392.5,"bottom":271,"left":0,"width":392.5,"height":271}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":785,"bottom":100,"left":0,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":0,"width":785,"height":100,"top":0,"right":785,"bottom":100,"left":0}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":485,"right":785,"bottom":585,"left":0,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":485,"width":785,"height":100,"top":485,"right":785,"bottom":585,"left":0}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":100,"bottom":585,"left":0,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":0,"width":100,"height":585,"top":0,"right":100,"bottom":585,"left":0}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":785,"bottom":585,"left":685,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":685,"y":0,"width":100,"height":585,"top":0,"right":785,"bottom":585,"left":685}
Scrolled to 475, 525
JSON.stringify(internals.layoutViewportRect()) is {"top":211,"right":867.5,"bottom":796,"left":82.5,"width":785,"height":585}
JSON.stringify(internals.visualViewportRect()) is {"top":503.5,"right":867.5,"bottom":796,"left":475,"width":392.5,"height":292.5}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-314,"right":392.5,"bottom":-214,"left":-392.5,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-392.5,"y":-314,"width":785,"height":100,"top":-314,"right":392.5,"bottom":-214,"left":-392.5}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":171,"right":392.5,"bottom":271,"left":-392.5,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-392.5,"y":171,"width":785,"height":100,"top":171,"right":392.5,"bottom":271,"left":-392.5}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-314,"right":-292.5,"bottom":271,"left":-392.5,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-392.5,"y":-314,"width":100,"height":585,"top":-314,"right":-292.5,"bottom":271,"left":-392.5}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-314,"right":392.5,"bottom":271,"left":292.5,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":292.5,"y":-314,"width":100,"height":585,"top":-314,"right":392.5,"bottom":271,"left":292.5}
Scrolled to 100, 776
JSON.stringify(internals.layoutViewportRect()) is {"top":462,"right":867.5,"bottom":1047,"left":82.5,"width":785,"height":585}
JSON.stringify(internals.visualViewportRect()) is {"top":754.5,"right":492.5,"bottom":1047,"left":100,"width":392.5,"height":292.5}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-314,"right":767.5,"bottom":-214,"left":-17.5,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-17.5,"y":-314,"width":785,"height":100,"top":-314,"right":767.5,"bottom":-214,"left":-17.5}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":171,"right":767.5,"bottom":271,"left":-17.5,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-17.5,"y":171,"width":785,"height":100,"top":171,"right":767.5,"bottom":271,"left":-17.5}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-314,"right":82.5,"bottom":271,"left":-17.5,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-17.5,"y":-314,"width":100,"height":585,"top":-314,"right":82.5,"bottom":271,"left":-17.5}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-314,"right":767.5,"bottom":271,"left":667.5,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":667.5,"y":-314,"width":100,"height":585,"top":-314,"right":767.5,"bottom":271,"left":667.5}
Scrolled to 50, 300
JSON.stringify(internals.layoutViewportRect()) is {"top":278.5,"right":835,"bottom":863.5,"left":50,"width":785,"height":585}
JSON.stringify(internals.visualViewportRect()) is {"top":278.5,"right":442.5,"bottom":571,"left":50,"width":392.5,"height":292.5}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-21.5,"right":785,"bottom":78.5,"left":0,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":-21.5,"width":785,"height":100,"top":-21.5,"right":785,"bottom":78.5,"left":0}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":463.5,"right":785,"bottom":563.5,"left":0,"width":785,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":463.5,"width":785,"height":100,"top":463.5,"right":785,"bottom":563.5,"left":0}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-21.5,"right":100,"bottom":563.5,"left":0,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":-21.5,"width":100,"height":585,"top":-21.5,"right":100,"bottom":563.5,"left":0}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-21.5,"right":785,"bottom":563.5,"left":685,"width":100,"height":585}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":685,"y":-21.5,"width":100,"height":585,"top":-21.5,"right":785,"bottom":563.5,"left":685}
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/zooming/client-rect-in-fixed-zoomed-expected.txt (215891 => 215892)
--- trunk/LayoutTests/fast/zooming/client-rect-in-fixed-zoomed-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/fast/zooming/client-rect-in-fixed-zoomed-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -4,7 +4,7 @@
PASS internals.pageScaleFactor() is 2
-PASS JSON.stringify(clientRect) is JSON.stringify({top: -108, right: 42, bottom: -98, left: 22, width: 20, height: 10})
+PASS JSON.stringify(clientRect) is JSON.stringify({x: 22, y: -108, width: 20, height: 10, top: -108, right: 42, bottom: -98, left: 22})
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/zooming/client-rect-in-fixed-zoomed.html (215891 => 215892)
--- trunk/LayoutTests/fast/zooming/client-rect-in-fixed-zoomed.html 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/fast/zooming/client-rect-in-fixed-zoomed.html 2017-04-27 21:00:50 UTC (rev 215892)
@@ -40,7 +40,7 @@
var box = document.getElementById('box');
clientRect = box.getBoundingClientRect();
- shouldBe('JSON.stringify(clientRect)', 'JSON.stringify({top: -108, right: 42, bottom: -98, left: 22, width: 20, height: 10})');
+ shouldBe('JSON.stringify(clientRect)', 'JSON.stringify({x: 22, y: -108, width: 20, height: 10, top: -108, right: 42, bottom: -98, left: 22})');
finishJSTest();
}
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (215891 => 215892)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1,3 +1,14 @@
+2017-04-27 Chris Dumez <[email protected]>
+
+ Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
+ https://bugs.webkit.org/show_bug.cgi?id=171226
+
+ Reviewed by Simon Fraser.
+
+ Add baseline for web-platform-tests that is now passing and unskipped.
+
+ * web-platform-tests/cssom-view/cssom-getBoundingClientRect-002-expected.txt: Added.
+
2017-04-27 Frederic Wang <[email protected]>
Fix some tests from platform-tests/cssom-view/cssom-view/
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/cssom-view/cssom-getBoundingClientRect-002-expected.txt (0 => 215892)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/cssom-view/cssom-getBoundingClientRect-002-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/cssom-view/cssom-getBoundingClientRect-002-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -0,0 +1,3 @@
+
+PASS getBoundingClientRect on a newly-created Element not yet inserted into the DOM should return an all-zeroes DOMRect
+
Modified: trunk/LayoutTests/js/resources/JSON-stringify.js (215891 => 215892)
--- trunk/LayoutTests/js/resources/JSON-stringify.js 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/js/resources/JSON-stringify.js 2017-04-27 21:00:50 UTC (rev 215892)
@@ -316,7 +316,7 @@
result.push(function(jsonObject){
return jsonObject.stringify(clientRect);
});
- result[result.length - 1].expected = JSON.stringify({top : clientRect.top, right : clientRect.right, bottom: clientRect.bottom, left : clientRect.left, width : clientRect.width, height : clientRect.height });
+ result[result.length - 1].expected = JSON.stringify({x: clientRect.x, y: clientRect.y, width : clientRect.width, height : clientRect.height, top : clientRect.top, right : clientRect.right, bottom: clientRect.bottom, left : clientRect.left });
result.push(function(jsonObject){
return jsonObject.stringify(objectWithSideEffectGetter);
});
Modified: trunk/LayoutTests/media/track/track-cue-overlap-snap-to-lines-not-set.html (215891 => 215892)
--- trunk/LayoutTests/media/track/track-cue-overlap-snap-to-lines-not-set.html 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/media/track/track-cue-overlap-snap-to-lines-not-set.html 2017-04-27 21:00:50 UTC (rev 215892)
@@ -11,7 +11,7 @@
var cueDisplayElement;
- ClientRect.prototype.intersects = function(that)
+ DOMRect.prototype.intersects = function(that)
{
// Separating axis theorem:
return Math.abs(this.top - that.top) < Math.abs(this.height + that.height) / 2
Modified: trunk/LayoutTests/platform/ios/fast/dom/collection-iterators-expected.txt (215891 => 215892)
--- trunk/LayoutTests/platform/ios/fast/dom/collection-iterators-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/platform/ios/fast/dom/collection-iterators-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -12,15 +12,6 @@
PASS 'forEach' in obj is false
PASS 'values' in obj is false
-* ClientRectList
-PASS obj.__proto__ is ClientRectList.prototype
-PASS Symbol.iterator in obj is true
-PASS for..of did not throw an exception
-PASS 'entries' in obj is false
-PASS 'keys' in obj is false
-PASS 'forEach' in obj is false
-PASS 'values' in obj is false
-
* CSSRuleList
PASS obj.__proto__ is CSSRuleList.prototype
PASS Symbol.iterator in obj is true
Modified: trunk/LayoutTests/platform/ios/fast/visual-viewport/zoomed-fixed-expected.txt (215891 => 215892)
--- trunk/LayoutTests/platform/ios/fast/visual-viewport/zoomed-fixed-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/platform/ios/fast/visual-viewport/zoomed-fixed-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -6,49 +6,49 @@
JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
JSON.stringify(internals.visualViewportRect()) is {"top":0,"right":400,"bottom":300,"left":0,"width":400,"height":300}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":800,"bottom":100,"left":0,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":0,"width":800,"height":100,"top":0,"right":800,"bottom":100,"left":0}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":500,"right":800,"bottom":600,"left":0,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":500,"width":800,"height":100,"top":500,"right":800,"bottom":600,"left":0}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":100,"bottom":600,"left":0,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":0,"width":100,"height":600,"top":0,"right":100,"bottom":600,"left":0}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":800,"bottom":600,"left":700,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":700,"y":0,"width":100,"height":600,"top":0,"right":800,"bottom":600,"left":700}
Scrolled to 475, 525
-JSON.stringify(internals.layoutViewportRect()) is {"top":225,"right":875,"bottom":825,"left":75,"width":800,"height":600}
+JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
JSON.stringify(internals.visualViewportRect()) is {"top":525,"right":875,"bottom":825,"left":475,"width":400,"height":300}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":400,"bottom":-200,"left":-400,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-475,"y":-525,"width":800,"height":100,"top":-525,"right":325,"bottom":-425,"left":-475}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":200,"right":400,"bottom":300,"left":-400,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-475,"y":-25,"width":800,"height":100,"top":-25,"right":325,"bottom":75,"left":-475}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":-300,"bottom":300,"left":-400,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-475,"y":-525,"width":100,"height":600,"top":-525,"right":-375,"bottom":75,"left":-475}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":400,"bottom":300,"left":300,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":225,"y":-525,"width":100,"height":600,"top":-525,"right":325,"bottom":75,"left":225}
Scrolled to 100, 776
-JSON.stringify(internals.layoutViewportRect()) is {"top":476,"right":875,"bottom":1076,"left":75,"width":800,"height":600}
+JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
JSON.stringify(internals.visualViewportRect()) is {"top":776,"right":500,"bottom":1076,"left":100,"width":400,"height":300}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":775,"bottom":-200,"left":-25,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-100,"y":-776,"width":800,"height":100,"top":-776,"right":700,"bottom":-676,"left":-100}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":200,"right":775,"bottom":300,"left":-25,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-100,"y":-276,"width":800,"height":100,"top":-276,"right":700,"bottom":-176,"left":-100}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":75,"bottom":300,"left":-25,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-100,"y":-776,"width":100,"height":600,"top":-776,"right":0,"bottom":-176,"left":-100}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":775,"bottom":300,"left":675,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":600,"y":-776,"width":100,"height":600,"top":-776,"right":700,"bottom":-176,"left":600}
Scrolled to 50, 300
-JSON.stringify(internals.layoutViewportRect()) is {"top":300,"right":850,"bottom":900,"left":50,"width":800,"height":600}
+JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
JSON.stringify(internals.visualViewportRect()) is {"top":300,"right":450,"bottom":600,"left":50,"width":400,"height":300}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":800,"bottom":100,"left":0,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-50,"y":-300,"width":800,"height":100,"top":-300,"right":750,"bottom":-200,"left":-50}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":500,"right":800,"bottom":600,"left":0,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-50,"y":200,"width":800,"height":100,"top":200,"right":750,"bottom":300,"left":-50}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":100,"bottom":600,"left":0,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-50,"y":-300,"width":100,"height":600,"top":-300,"right":50,"bottom":300,"left":-50}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":800,"bottom":600,"left":700,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":650,"y":-300,"width":100,"height":600,"top":-300,"right":750,"bottom":300,"left":650}
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/platform/ios/fast/visual-viewport/zoomed-fixed-header-and-footer-expected.txt (215891 => 215892)
--- trunk/LayoutTests/platform/ios/fast/visual-viewport/zoomed-fixed-header-and-footer-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/platform/ios/fast/visual-viewport/zoomed-fixed-header-and-footer-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -6,49 +6,49 @@
JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
JSON.stringify(internals.visualViewportRect()) is {"top":0,"right":400,"bottom":257,"left":0,"width":400,"height":257}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":800,"bottom":100,"left":0,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":0,"width":800,"height":100,"top":0,"right":800,"bottom":100,"left":0}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":500,"right":800,"bottom":600,"left":0,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":500,"width":800,"height":100,"top":500,"right":800,"bottom":600,"left":0}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":100,"bottom":600,"left":0,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":0,"y":0,"width":100,"height":600,"top":0,"right":100,"bottom":600,"left":0}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":800,"bottom":600,"left":700,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":700,"y":0,"width":100,"height":600,"top":0,"right":800,"bottom":600,"left":700}
Scrolled to 475, 525
JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
JSON.stringify(internals.visualViewportRect()) is {"top":482,"right":875,"bottom":782,"left":475,"width":400,"height":300}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-525,"right":325,"bottom":-425,"left":-475,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-475,"y":-525,"width":800,"height":100,"top":-525,"right":325,"bottom":-425,"left":-475}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-25,"right":325,"bottom":75,"left":-475,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-475,"y":-25,"width":800,"height":100,"top":-25,"right":325,"bottom":75,"left":-475}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-525,"right":-375,"bottom":75,"left":-475,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-475,"y":-525,"width":100,"height":600,"top":-525,"right":-375,"bottom":75,"left":-475}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-525,"right":325,"bottom":75,"left":225,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":225,"y":-525,"width":100,"height":600,"top":-525,"right":325,"bottom":75,"left":225}
Scrolled to 100, 776
JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
JSON.stringify(internals.visualViewportRect()) is {"top":733,"right":500,"bottom":1033,"left":100,"width":400,"height":300}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-776,"right":700,"bottom":-676,"left":-100,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-100,"y":-776,"width":800,"height":100,"top":-776,"right":700,"bottom":-676,"left":-100}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-276,"right":700,"bottom":-176,"left":-100,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-100,"y":-276,"width":800,"height":100,"top":-276,"right":700,"bottom":-176,"left":-100}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-776,"right":0,"bottom":-176,"left":-100,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-100,"y":-776,"width":100,"height":600,"top":-776,"right":0,"bottom":-176,"left":-100}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-776,"right":700,"bottom":-176,"left":600,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":600,"y":-776,"width":100,"height":600,"top":-776,"right":700,"bottom":-176,"left":600}
Scrolled to 50, 300
JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
JSON.stringify(internals.visualViewportRect()) is {"top":257,"right":450,"bottom":557,"left":50,"width":400,"height":300}
client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":750,"bottom":-200,"left":-50,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-50,"y":-300,"width":800,"height":100,"top":-300,"right":750,"bottom":-200,"left":-50}
client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":200,"right":750,"bottom":300,"left":-50,"width":800,"height":100}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-50,"y":200,"width":800,"height":100,"top":200,"right":750,"bottom":300,"left":-50}
client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":50,"bottom":300,"left":-50,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":-50,"y":-300,"width":100,"height":600,"top":-300,"right":50,"bottom":300,"left":-50}
client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":750,"bottom":300,"left":650,"width":100,"height":600}
+JSON.stringify(fixedElement.getBoundingClientRect()) is {"x":650,"y":-300,"width":100,"height":600,"top":-300,"right":750,"bottom":300,"left":650}
PASS successfullyParsed is true
TEST COMPLETE
Deleted: trunk/LayoutTests/platform/ios-wk2/fast/visual-viewport/zoomed-fixed-expected.txt (215891 => 215892)
--- trunk/LayoutTests/platform/ios-wk2/fast/visual-viewport/zoomed-fixed-expected.txt 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/LayoutTests/platform/ios-wk2/fast/visual-viewport/zoomed-fixed-expected.txt 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1,55 +0,0 @@
-This test zooms and scrolls the page and checks the positions of fixed-position objects.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
-JSON.stringify(internals.visualViewportRect()) is {"top":0,"right":400,"bottom":300,"left":0,"width":400,"height":300}
-client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":800,"bottom":100,"left":0,"width":800,"height":100}
-client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":500,"right":800,"bottom":600,"left":0,"width":800,"height":100}
-client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":100,"bottom":600,"left":0,"width":100,"height":600}
-client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":0,"right":800,"bottom":600,"left":700,"width":100,"height":600}
-
-Scrolled to 475, 525
-JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
-JSON.stringify(internals.visualViewportRect()) is {"top":525,"right":875,"bottom":825,"left":475,"width":400,"height":300}
-client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-525,"right":325,"bottom":-425,"left":-475,"width":800,"height":100}
-client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-25,"right":325,"bottom":75,"left":-475,"width":800,"height":100}
-client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-525,"right":-375,"bottom":75,"left":-475,"width":100,"height":600}
-client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-525,"right":325,"bottom":75,"left":225,"width":100,"height":600}
-
-Scrolled to 100, 776
-JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
-JSON.stringify(internals.visualViewportRect()) is {"top":776,"right":500,"bottom":1076,"left":100,"width":400,"height":300}
-client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-776,"right":700,"bottom":-676,"left":-100,"width":800,"height":100}
-client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-276,"right":700,"bottom":-176,"left":-100,"width":800,"height":100}
-client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-776,"right":0,"bottom":-176,"left":-100,"width":100,"height":600}
-client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-776,"right":700,"bottom":-176,"left":600,"width":100,"height":600}
-
-Scrolled to 50, 300
-JSON.stringify(internals.layoutViewportRect()) is {"top":0,"right":800,"bottom":600,"left":0,"width":800,"height":600}
-JSON.stringify(internals.visualViewportRect()) is {"top":300,"right":450,"bottom":600,"left":50,"width":400,"height":300}
-client rect of top:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":750,"bottom":-200,"left":-50,"width":800,"height":100}
-client rect of bottom:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":200,"right":750,"bottom":300,"left":-50,"width":800,"height":100}
-client rect of left:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":50,"bottom":300,"left":-50,"width":100,"height":600}
-client rect of right:
-JSON.stringify(fixedElement.getBoundingClientRect()) is {"top":-300,"right":750,"bottom":300,"left":650,"width":100,"height":600}
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Modified: trunk/Source/WebCore/ChangeLog (215891 => 215892)
--- trunk/Source/WebCore/ChangeLog 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebCore/ChangeLog 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1,3 +1,37 @@
+2017-04-27 Chris Dumez <[email protected]>
+
+ Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
+ https://bugs.webkit.org/show_bug.cgi?id=171226
+
+ Reviewed by Simon Fraser.
+
+ Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
+ as per:
+ - https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface
+
+ DOMRect is compatible with ClientRect, which we used to return so the risk should
+ be low.
+
+ Tests: fast/css/DOMRect-attributes-prototype.html
+ fast/css/DOMRect-serialization.html
+ fast/dom/Element/getClientRects-return-type.html
+
+ * dom/ClientRectList.cpp:
+ (WebCore::ClientRectList::ClientRectList):
+ * dom/ClientRectList.h:
+ (WebCore::ClientRectList::create):
+ * dom/DOMRect.h:
+ (WebCore::DOMRect::create):
+ * dom/DOMRectReadOnly.h:
+ * dom/Element.cpp:
+ (WebCore::toDOMRectVector):
+ (WebCore::Element::getClientRects):
+ (WebCore::Element::getBoundingClientRect):
+ * dom/Element.h:
+ * dom/Element.idl:
+ * html/track/VTTRegion.cpp:
+ (WebCore::VTTRegion::displayLastTextTrackCueBox):
+
2017-04-27 Joanmarie Diggs <[email protected]>
AX: Expose elements with the ARIA "feed" role
Modified: trunk/Source/WebCore/dom/ClientRectList.cpp (215891 => 215892)
--- trunk/Source/WebCore/dom/ClientRectList.cpp 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebCore/dom/ClientRectList.cpp 2017-04-27 21:00:50 UTC (rev 215892)
@@ -42,6 +42,11 @@
m_list.uncheckedAppend(ClientRect::create(quad.enclosingBoundingBox()));
}
+ClientRectList::ClientRectList(Vector<Ref<ClientRect>>&& rects)
+ : m_list(WTFMove(rects))
+{
+}
+
ClientRectList::~ClientRectList()
{
}
Modified: trunk/Source/WebCore/dom/ClientRectList.h (215891 => 215892)
--- trunk/Source/WebCore/dom/ClientRectList.h 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebCore/dom/ClientRectList.h 2017-04-27 21:00:50 UTC (rev 215892)
@@ -39,6 +39,7 @@
public:
static Ref<ClientRectList> create() { return adoptRef(*new ClientRectList); }
static Ref<ClientRectList> create(const Vector<FloatQuad>& quads) { return adoptRef(*new ClientRectList(quads)); }
+ static Ref<ClientRectList> create(Vector<Ref<ClientRect>>&& rects) { return adoptRef(*new ClientRectList(WTFMove(rects))); }
WEBCORE_EXPORT ~ClientRectList();
unsigned length() const;
@@ -47,6 +48,7 @@
private:
WEBCORE_EXPORT ClientRectList();
WEBCORE_EXPORT explicit ClientRectList(const Vector<FloatQuad>&);
+ WEBCORE_EXPORT explicit ClientRectList(Vector<Ref<ClientRect>>&&);
Vector<Ref<ClientRect>> m_list;
};
Modified: trunk/Source/WebCore/dom/DOMRect.h (215891 => 215892)
--- trunk/Source/WebCore/dom/DOMRect.h 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebCore/dom/DOMRect.h 2017-04-27 21:00:50 UTC (rev 215892)
@@ -26,6 +26,8 @@
#pragma once
#include "DOMRectReadOnly.h"
+#include "FloatRect.h"
+#include "IntRect.h"
namespace WebCore {
@@ -32,7 +34,10 @@
class DOMRect : public DOMRectReadOnly {
WTF_MAKE_FAST_ALLOCATED;
public:
+ static Ref<DOMRect> create() { return adoptRef(*new DOMRect()); }
static Ref<DOMRect> create(double x, double y, double width, double height) { return adoptRef(*new DOMRect(x, y, width, height)); }
+ static Ref<DOMRect> create(FloatRect rect) { return adoptRef(*new DOMRect(rect.x(), rect.y(), rect.width(), rect.height())); }
+ static Ref<DOMRect> create(IntRect rect) { return adoptRef(*new DOMRect(rect.x(), rect.y(), rect.width(), rect.height())); }
static Ref<DOMRect> fromRect(const DOMRectInit& init) { return create(init.x, init.y, init.width, init.height); }
void setX(double x) { m_x = x; }
@@ -46,6 +51,8 @@
: DOMRectReadOnly(x, y, width, height)
{
}
+
+ DOMRect() = default;
};
}
Modified: trunk/Source/WebCore/dom/DOMRectReadOnly.h (215891 => 215892)
--- trunk/Source/WebCore/dom/DOMRectReadOnly.h 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebCore/dom/DOMRectReadOnly.h 2017-04-27 21:00:50 UTC (rev 215892)
@@ -59,11 +59,13 @@
{
}
+ DOMRectReadOnly() = default;
+
// Any of these can be NaN or Inf.
- double m_x;
- double m_y;
- double m_width; // Can be negative.
- double m_height; // Can be negative.
+ double m_x { 0 };
+ double m_y { 0 };
+ double m_width { 0 }; // Can be negative.
+ double m_height { 0 }; // Can be negative.
};
}
Modified: trunk/Source/WebCore/dom/Element.cpp (215891 => 215892)
--- trunk/Source/WebCore/dom/Element.cpp 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebCore/dom/Element.cpp 2017-04-27 21:00:50 UTC (rev 215892)
@@ -39,6 +39,7 @@
#include "ContainerNodeAlgorithms.h"
#include "CustomElementReactionQueue.h"
#include "CustomElementRegistry.h"
+#include "DOMRect.h"
#include "DOMTokenList.h"
#include "DocumentAnimation.h"
#include "DocumentSharedObjectPool.h"
@@ -1145,13 +1146,22 @@
return absoluteEventBoundsOfElementAndDescendants(includesFixedPositionElements);
}
-Ref<ClientRectList> Element::getClientRects()
+static Vector<Ref<DOMRect>> toDOMRectVector(const Vector<FloatQuad>& quads)
{
+ Vector<Ref<DOMRect>> result;
+ result.reserveInitialCapacity(quads.size());
+ for (auto& quad : quads)
+ result.uncheckedAppend(DOMRect::create(quad.enclosingBoundingBox()));
+ return result;
+}
+
+Vector<Ref<DOMRect>> Element::getClientRects()
+{
document().updateLayoutIgnorePendingStylesheets();
RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject();
if (!renderBoxModelObject)
- return ClientRectList::create();
+ return { };
// FIXME: Handle SVG elements.
// FIXME: Handle table/inline-table with a caption.
@@ -1159,10 +1169,10 @@
Vector<FloatQuad> quads;
renderBoxModelObject->absoluteQuads(quads);
document().adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale(quads, renderBoxModelObject->style());
- return ClientRectList::create(quads);
+ return toDOMRectVector(quads);
}
-Ref<ClientRect> Element::getBoundingClientRect()
+Ref<DOMRect> Element::getBoundingClientRect()
{
document().updateLayoutIgnorePendingStylesheets();
@@ -1180,7 +1190,7 @@
}
if (quads.isEmpty())
- return ClientRect::create();
+ return DOMRect::create();
FloatRect result = quads[0].boundingBox();
for (size_t i = 1; i < quads.size(); ++i)
@@ -1187,7 +1197,7 @@
result.unite(quads[i].boundingBox());
document().adjustFloatRectForScrollAndAbsoluteZoomAndFrameScale(result, renderer()->style());
- return ClientRect::create(result);
+ return DOMRect::create(result);
}
IntRect Element::clientRect() const
Modified: trunk/Source/WebCore/dom/Element.h (215891 => 215892)
--- trunk/Source/WebCore/dom/Element.h 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebCore/dom/Element.h 2017-04-27 21:00:50 UTC (rev 215892)
@@ -37,10 +37,9 @@
namespace WebCore {
-class ClientRect;
-class ClientRectList;
class CustomElementReactionQueue;
class DatasetDOMStringMap;
+class DOMRect;
class DOMTokenList;
class ElementRareData;
class HTMLDocument;
@@ -173,8 +172,8 @@
WEBCORE_EXPORT IntRect boundsInRootViewSpace();
- Ref<ClientRectList> getClientRects();
- Ref<ClientRect> getBoundingClientRect();
+ Vector<Ref<DOMRect>> getClientRects();
+ Ref<DOMRect> getBoundingClientRect();
// Returns the absolute bounding box translated into client coordinates.
WEBCORE_EXPORT IntRect clientRect() const;
Modified: trunk/Source/WebCore/dom/Element.idl (215891 => 215892)
--- trunk/Source/WebCore/dom/Element.idl 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebCore/dom/Element.idl 2017-04-27 21:00:50 UTC (rev 215892)
@@ -108,8 +108,8 @@
[ImplementedAs=matches, MayThrowException] boolean webkitMatchesSelector(DOMString selectors);
// CSSOM View Module API
- ClientRectList getClientRects();
- ClientRect getBoundingClientRect();
+ sequence<DOMRect> getClientRects();
+ [NewObject] DOMRect getBoundingClientRect();
#if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
// Mozilla version
Modified: trunk/Source/WebCore/html/track/VTTRegion.cpp (215891 => 215892)
--- trunk/Source/WebCore/html/track/VTTRegion.cpp 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebCore/html/track/VTTRegion.cpp 2017-04-27 21:00:50 UTC (rev 215892)
@@ -35,6 +35,7 @@
#if ENABLE(VIDEO_TRACK)
#include "ClientRect.h"
+#include "DOMRect.h"
#include "DOMTokenList.h"
#include "ElementChildIterator.h"
#include "ExceptionCode.h"
@@ -311,7 +312,7 @@
// Find first cue that is not entirely displayed and scroll it upwards.
for (auto& child : childrenOfType<Element>(*m_cueContainer)) {
- Ref<ClientRect> rect = child.getBoundingClientRect();
+ auto rect = child.getBoundingClientRect();
float childTop = rect->top();
float childBottom = rect->bottom();
Modified: trunk/Source/WebKit2/ChangeLog (215891 => 215892)
--- trunk/Source/WebKit2/ChangeLog 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebKit2/ChangeLog 2017-04-27 21:00:50 UTC (rev 215892)
@@ -1,3 +1,17 @@
+2017-04-27 Chris Dumez <[email protected]>
+
+ Element.getBoundingClientRect() / getClientRects() should return a DOMRect types
+ https://bugs.webkit.org/show_bug.cgi?id=171226
+
+ Reviewed by Simon Fraser.
+
+ GTK build fix.
+
+ * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp:
+ (toClientRect):
+ (webkit_dom_element_get_bounding_client_rect):
+ (webkit_dom_element_get_client_rects):
+
2017-04-27 Brady Eidson <[email protected]>
Update NetworkStorageSession to support multiple persistent sessions and explicitly set cookie storages.
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp (215891 => 215892)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp 2017-04-27 20:58:04 UTC (rev 215891)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp 2017-04-27 21:00:50 UTC (rev 215892)
@@ -24,6 +24,7 @@
#include "DOMObjectCache.h"
#include <WebCore/ClientRect.h>
#include <WebCore/ClientRectList.h>
+#include <WebCore/DOMRect.h>
#include <WebCore/Document.h>
#include <WebCore/ExceptionCode.h>
#include <WebCore/ExceptionCodeDescription.h>
@@ -1225,21 +1226,35 @@
return result;
}
+static Ref<WebCore::ClientRect> toClientRect(WebCore::DOMRect& rect)
+{
+ return WebCore::ClientRect::create(WebCore::FloatRect(rect.x(), rect.y(), rect.width(), rect.height()));
+}
+
WebKitDOMClientRect* webkit_dom_element_get_bounding_client_rect(WebKitDOMElement* self)
{
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_ELEMENT(self), nullptr);
WebCore::Element* item = WebKit::core(self);
- auto clientRect = item->getBoundingClientRect();
+ auto clientRect = toClientRect(item->getBoundingClientRect());
return WebKit::kit(clientRect.ptr());
}
+static Vector<Ref<WebCore::ClientRect>> toClientRectVector(Vector<Ref<WebCore::DOMRect>>&& rects)
+{
+ Vector<Ref<WebCore::ClientRect>> clientRects;
+ clientRects.reserveInitialCapacity(rects.size());
+ for (auto& rect : rects)
+ clientRects.uncheckedAppend(toClientRect(rect));
+ return clientRects;
+}
+
WebKitDOMClientRectList* webkit_dom_element_get_client_rects(WebKitDOMElement* self)
{
WebCore::JSMainThreadNullState state;
g_return_val_if_fail(WEBKIT_DOM_IS_ELEMENT(self), nullptr);
WebCore::Element* item = WebKit::core(self);
- auto clientRects = item->getClientRects();
+ auto clientRects = WebCore::ClientRectList::create(toClientRectVector(item->getClientRects()));
return WebKit::kit(clientRects.ptr());
}