haikuwebkit/LayoutTests/fast/css/DOMRect-attributes-prototyp...

52 lines
1.7 KiB
HTML
Raw Permalink Normal View History

Element.getBoundingClientRect() / getClientRects() should return a DOMRect types https://bugs.webkit.org/show_bug.cgi?id=171226 Reviewed by Simon Fraser. LayoutTests/imported/w3c: Add baseline for web-platform-tests that is now passing and unskipped. * web-platform-tests/cssom-view/cssom-getBoundingClientRect-002-expected.txt: Added. Source/WebCore: 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): Source/WebKit2: GTK build fix. * WebProcess/InjectedBundle/API/gtk/DOM/WebKitDOMElement.cpp: (toClientRect): (webkit_dom_element_get_bounding_client_rect): (webkit_dom_element_get_client_rects): LayoutTests: 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: Canonical link: https://commits.webkit.org/188286@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-27 21:00:50 +00:00
<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test-pre.js"></script>
<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="../../resources/js-test-post.js"></script>
</body>
</html>