Title: [287610] trunk
Revision
287610
Author
mrobin...@webkit.org
Date
2022-01-05 02:01:06 -0800 (Wed, 05 Jan 2022)

Log Message

Change offsetParent to match spec change
https://bugs.webkit.org/show_bug.cgi?id=161788
<rdar://problem/28230510>

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-contain/content-visibility/content-visibility-038-expected.txt: Rebase test that fails differently now.
* web-platform-tests/css/css-transforms/preserve-3d-flat-grouping-properties-containing-block-expected.txt: Ditto.
* web-platform-tests/css/cssom-view/offsetParent_element_test.html: Increase the test coverage for this test case.
* web-platform-tests/svg/extensibility/foreignObject/containing-block-expected.txt: Part of this test now passes.

Source/WebCore:

No new tests. This is covered by new test statements in web-platform-tests/css/cssom-view/offsetParent_element_test.html.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::offsetParent const): Update the offsetParent algorithm to return all elements
that create containing blocks for absolutely positioned items and not just positioned elements.

LayoutTests:

* fast/clip/hit-test-with-clip-path.html: Rewrite this test to use getBoundingClientRect.
* fast/forms/resources/common.js:
(searchCancelButtonPosition): Ditto.
* fast/forms/search-transformed.html: Ditto.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287609 => 287610)


--- trunk/LayoutTests/ChangeLog	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/LayoutTests/ChangeLog	2022-01-05 10:01:06 UTC (rev 287610)
@@ -1,3 +1,16 @@
+2022-01-05  Martin Robinson  <mrobin...@webkit.org>
+
+        Change offsetParent to match spec change
+        https://bugs.webkit.org/show_bug.cgi?id=161788
+        <rdar://problem/28230510>
+
+        Reviewed by Simon Fraser.
+
+        * fast/clip/hit-test-with-clip-path.html: Rewrite this test to use getBoundingClientRect.
+        * fast/forms/resources/common.js:
+        (searchCancelButtonPosition): Ditto.
+        * fast/forms/search-transformed.html: Ditto.
+
 2022-01-05  Youenn Fablet  <you...@apple.com>
 
         WebPageProxy::requestUserMediaPermissionForSpeechRecognition should return early in case of no capture devices

Modified: trunk/LayoutTests/fast/clip/hit-test-with-clip-path.html (287609 => 287610)


--- trunk/LayoutTests/fast/clip/hit-test-with-clip-path.html	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/LayoutTests/fast/clip/hit-test-with-clip-path.html	2022-01-05 10:01:06 UTC (rev 287610)
@@ -38,7 +38,8 @@
   </div>
 </div>
 <script>
-result.innerText += "\n" + document.elementFromPoint(candidate1.offsetLeft, candidate1.offsetTop).id;
+let rect1 = candidate1.getBoundingClientRect();
+result.innerText += "\n" + document.elementFromPoint(rect1.left, rect1.top).id;
 </script>
 
 <!-- non-top level paint root hittest -->
@@ -50,7 +51,8 @@
   </div>
 </div>
 <script>
-result.innerText += "\n" + document.elementFromPoint(candidate2.offsetLeft, candidate2.offsetTop).id;
+let rect2 = candidate2.getBoundingClientRect();
+result.innerText += "\n" + document.elementFromPoint(rect2.left, rect2.top).id;
 </script>
 
 <!-- multi-level non-top level paint root hittest -->
@@ -65,5 +67,6 @@
   </div>
 </div>
 <script>
-result.innerText += "\n" + document.elementFromPoint(candidate3.offsetLeft, candidate3.offsetTop).id;
+let rect3 = candidate3.getBoundingClientRect();
+result.innerText += "\n" + document.elementFromPoint(rect3.left, rect3.top).id;
 </script>

Modified: trunk/LayoutTests/fast/forms/resources/common.js (287609 => 287610)


--- trunk/LayoutTests/fast/forms/resources/common.js	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/LayoutTests/fast/forms/resources/common.js	2022-01-05 10:01:06 UTC (rev 287610)
@@ -106,8 +106,9 @@
 
 function searchCancelButtonPosition(element, isRTL = false) {
     var pos = {};
-    pos.x = element.offsetLeft + (isRTL ? 9 : (element.offsetWidth - 9));
-    pos.y = element.offsetTop + element.offsetHeight / 2;
+    let rect = element.getBoundingClientRect();
+    pos.x = rect.left + (isRTL ? 9 : (rect.width - 9));
+    pos.y = rect.top + rect.height / 2;
     return pos;
 }
 

Modified: trunk/LayoutTests/fast/forms/search-transformed.html (287609 => 287610)


--- trunk/LayoutTests/fast/forms/search-transformed.html	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/LayoutTests/fast/forms/search-transformed.html	2022-01-05 10:01:06 UTC (rev 287610)
@@ -20,9 +20,8 @@
             testRunner.dumpAsText();
         if (window.eventSender) {
             var target = document.getElementById("target");
-            var translationAmount = 50;
             var cancelPos = searchCancelButtonPosition(target);
-            eventSender.mouseMoveTo(cancelPos.x + translationAmount, cancelPos.y + translationAmount);
+            eventSender.mouseMoveTo(cancelPos.x, cancelPos.y);
             eventSender.mouseDown();
             eventSender.mouseUp();
             var result = document.getElementById("result");

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (287609 => 287610)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-05 10:01:06 UTC (rev 287610)
@@ -1,3 +1,16 @@
+2022-01-05  Martin Robinson  <mrobin...@webkit.org>
+
+        Change offsetParent to match spec change
+        https://bugs.webkit.org/show_bug.cgi?id=161788
+        <rdar://problem/28230510>
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/css-contain/content-visibility/content-visibility-038-expected.txt: Rebase test that fails differently now.
+        * web-platform-tests/css/css-transforms/preserve-3d-flat-grouping-properties-containing-block-expected.txt: Ditto.
+        * web-platform-tests/css/cssom-view/offsetParent_element_test.html: Increase the test coverage for this test case.
+        * web-platform-tests/svg/extensibility/foreignObject/containing-block-expected.txt: Part of this test now passes.
+
 2022-01-05  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, reverting r285915.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-038-expected.txt (287609 => 287610)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-038-expected.txt	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-038-expected.txt	2022-01-05 10:01:06 UTC (rev 287610)
@@ -1,3 +1,3 @@
 
-FAIL Measure Forced Layout assert_equals: 0 forced expected 0 but got 8
+FAIL Measure Forced Layout assert_equals: spacer forced expected 8 but got 108
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/preserve-3d-flat-grouping-properties-containing-block-expected.txt (287609 => 287610)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/preserve-3d-flat-grouping-properties-containing-block-expected.txt	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/preserve-3d-flat-grouping-properties-containing-block-expected.txt	2022-01-05 10:01:06 UTC (rev 287610)
@@ -1,4 +1,4 @@
 
 FAIL Preserve-3d element with a grouping property still a containing block assert_equals: expected Element node <div id="parentWithGrouping" style="transform-style: pres... but got Element node <body><div id="parentWithGrouping" style="transform-style...
-FAIL Preserve-3d element without a grouping property still a containing block assert_equals: expected Element node <div id="parentWithoutGrouping" style="transform-style: p... but got Element node <body><div id="parentWithGrouping" style="transform-style...
+PASS Preserve-3d element without a grouping property still a containing block
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/offsetParent_element_test.html (287609 => 287610)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/offsetParent_element_test.html	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/offsetParent_element_test.html	2022-01-05 10:01:06 UTC (rev 287610)
@@ -24,6 +24,26 @@
 #absolute-element {
     position: absolute;
 }
+
+#transform-element {
+    transform: translateX(10px);
+}
+
+#perspective-element {
+    perspective: 10px;
+}
+
+#transform-style-preserve-3d-element {
+    transform-style: preserve-3d;
+}
+
+#filter-element {
+    filter: opacity(25%);
+}
+
+#contain-paint-element {
+    contain: paint;
+}
 </style>
 
 </head>
@@ -39,6 +59,22 @@
     <div id="absolute-element-child"></div>
 </div>
 
+<div id="transform-element">
+    <div id="transform-element-child"></div>
+</div>
+
+<div id="transform-style-preserve-3d-element">
+    <div id="transform-style-preserve-3d-element-child"></div>
+</div>
+
+<div id="perspective-element">
+    <div id="perspective-element-child"></div>
+</div>
+
+<div id="contain-paint-element">
+    <div id="contain-paint-element-child"></div>
+</div>
+
 <table id="table-element">
     <caption>
         <div id="caption-element-child"></div>
@@ -122,6 +158,21 @@
     assert_equals(caption_element_child.offsetParent,table_element);
     assert_equals(window.getComputedStyle(td_element).position,'static');
     assert_equals(td_element.offsetParent,table_element);
+
+    let transform_element = document.getElementById('transform-element');
+    assert_equals(transform_element.children[0].offsetParent, transform_element);
+
+    let perspective_element = document.getElementById('perspective-element');
+    assert_equals(perspective_element.children[0].offsetParent, perspective_element);
+
+    let transform_style_preserve_3d_element = document.getElementById('transform-style-preserve-3d-element');
+    assert_equals(transform_style_preserve_3d_element.children[0].offsetParent,
+                  transform_style_preserve_3d_element);
+
+    let contain_paint_element = document.getElementById('contain-paint-element');
+    assert_equals(contain_paint_element.children[0].offsetParent, contain_paint_element);
+
+
 }, "Valid the algorithm rule of offsetParent check step 2");
 
 </script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/svg/extensibility/foreignObject/containing-block-expected.txt (287609 => 287610)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/svg/extensibility/foreignObject/containing-block-expected.txt	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/svg/extensibility/foreignObject/containing-block-expected.txt	2022-01-05 10:01:06 UTC (rev 287610)
@@ -1,3 +1,3 @@
 
-FAIL position assert_equals: offsetLeft expected 5 but got 15
+FAIL position assert_equals: offsetTop expected 5 but got 0
 

Modified: trunk/Source/WebCore/ChangeLog (287609 => 287610)


--- trunk/Source/WebCore/ChangeLog	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/Source/WebCore/ChangeLog	2022-01-05 10:01:06 UTC (rev 287610)
@@ -1,3 +1,17 @@
+2022-01-05  Martin Robinson  <mrobin...@webkit.org>
+
+        Change offsetParent to match spec change
+        https://bugs.webkit.org/show_bug.cgi?id=161788
+        <rdar://problem/28230510>
+
+        Reviewed by Simon Fraser.
+
+        No new tests. This is covered by new test statements in web-platform-tests/css/cssom-view/offsetParent_element_test.html.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::offsetParent const): Update the offsetParent algorithm to return all elements
+        that create containing blocks for absolutely positioned items and not just positioned elements.
+
 2022-01-05  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, reverting r285915.

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (287609 => 287610)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2022-01-05 09:52:25 UTC (rev 287609)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2022-01-05 10:01:06 UTC (rev 287610)
@@ -1704,7 +1704,8 @@
     
     // Return the nearest ancestor element of A for which at least one of the following is
     // true and stop this algorithm if such an ancestor is found:
-    //     * The computed value of the position property is not static.
+    //     * The element is a containing block of absolutely-positioned descendants (regardless
+    //       of whether there are any absolutely-positioned descendants).
     //     * It is the HTML body element.
     //     * The computed value of the position property of A is static and the ancestor
     //       is one of the following HTML elements: td, th, or table.
@@ -1713,7 +1714,7 @@
     bool skipTables = isPositioned();
     float currZoom = style().effectiveZoom();
     auto current = parent();
-    while (current && (!current->element() || (!current->isPositioned() && !current->isBody()))) {
+    while (current && (!current->element() || (!current->canContainAbsolutelyPositionedObjects() && !current->isBody()))) {
         Element* element = current->element();
         if (!skipTables && element && (is<HTMLTableElement>(*element) || is<HTMLTableCellElement>(*element)))
             break;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to