Title: [282138] trunk
Revision
282138
Author
mrobin...@webkit.org
Date
2021-09-08 04:48:25 -0700 (Wed, 08 Sep 2021)

Log Message

[css-position-sticky] Sticky constraints are calculated incorrectly when scrolling container has padding and borders
https://bugs.webkit.org/show_bug.cgi?id=229997

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html: This test uses
an identity transform to make a div a containing block for absolutely positioned items. This exposes a bug in
WebKit, but position: relative also does this without exposing the bug. The bug for this issue is
https://bugs.webkit.org/show_bug.cgi?id=229999.
* web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html: Ditto.

Source/WebCore:

No new tests. This is covered by two existing WPT tests:
    web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html
    web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::computeStickyPositionConstraints const): When the containing block and the scroll container
are the same, fix the calculation of the container content rect. layoutOverflowRect() already does not include the border,
so stop adjusting for that. In addition, instead of simply adjusting the rect location by the padding, actually contract
it so that the bottom and right edges of the rectangle are correct.

LayoutTests:

* TestExpectations: Unskip two newly passing tests.
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt: Rebaseline.
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt: Ditto.
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt: Ditto.
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt: Ditto.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (282137 => 282138)


--- trunk/LayoutTests/ChangeLog	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/LayoutTests/ChangeLog	2021-09-08 11:48:25 UTC (rev 282138)
@@ -1,3 +1,16 @@
+2021-09-08  Martin Robinson  <mrobin...@webkit.org>
+
+        [css-position-sticky] Sticky constraints are calculated incorrectly when scrolling container has padding and borders
+        https://bugs.webkit.org/show_bug.cgi?id=229997
+
+        Reviewed by Simon Fraser.
+
+        * TestExpectations: Unskip two newly passing tests.
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt: Rebaseline.
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt: Ditto.
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt: Ditto.
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt: Ditto.
+
 2021-09-08  Kimmo Kinnunen  <kkinnu...@apple.com>
 
         webgl/2.0.y/deqp/functional/gles3/negativeshaderapi.html fails on Metal

Modified: trunk/LayoutTests/TestExpectations (282137 => 282138)


--- trunk/LayoutTests/TestExpectations	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/LayoutTests/TestExpectations	2021-09-08 11:48:25 UTC (rev 282138)
@@ -3486,8 +3486,6 @@
 webkit.org/b/228993 imported/w3c/web-platform-tests/css/css-position/multicol/static-position/vrl-rtl-ltr-in-multicol.tentative.html [ ImageOnlyFailure ]
 webkit.org/b/228993 imported/w3c/web-platform-tests/css/css-position/multicol/static-position/vrl-rtl-rtl-in-multicol.html [ ImageOnlyFailure ]
 webkit.org/b/203450 imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-writing-modes.html [ ImageOnlyFailure ]
-webkit.org/b/203450 imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative.html [ ImageOnlyFailure ]
-webkit.org/b/203450 imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative.html [ ImageOnlyFailure ]
 webkit.org/b/203450 imported/w3c/web-platform-tests/css/css-position/sticky/sticky-after-input.html [ Failure ]
 webkit.org/b/203451 imported/w3c/web-platform-tests/css/css-position/static-position/htb-ltr-ltr.html [ ImageOnlyFailure ]
 webkit.org/b/203451 imported/w3c/web-platform-tests/css/css-position/static-position/htb-ltr-rtl.tentative.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (282137 => 282138)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-08 11:48:25 UTC (rev 282138)
@@ -1,3 +1,16 @@
+2021-09-08  Martin Robinson  <mrobin...@webkit.org>
+
+        [css-position-sticky] Sticky constraints are calculated incorrectly when scrolling container has padding and borders
+        https://bugs.webkit.org/show_bug.cgi?id=229997
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html: This test uses
+        an identity transform to make a div a containing block for absolutely positioned items. This exposes a bug in
+        WebKit, but position: relative also does this without exposing the bug. The bug for this issue is
+        https://bugs.webkit.org/show_bug.cgi?id=229999.
+        * web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html: Ditto.
+
 2021-09-08  Tim Nguyen  <n...@apple.com>
 
         Support animations on ::backdrop

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html (282137 => 282138)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html	2021-09-08 11:48:25 UTC (rev 282138)
@@ -12,7 +12,7 @@
     overflow: auto;
     height: 200px;
     width: 200px;
-    transform: scale(1);
+    position: relative;
   }
 
   .block {

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html (282137 => 282138)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html	2021-09-08 11:48:25 UTC (rev 282138)
@@ -11,7 +11,7 @@
     overflow: auto;
     height: 200px;
     width: 200px;
-    transform: scale(1);
+    position: relative;
   }
 
   .block {

Modified: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt (282137 => 282138)


--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-expected.txt	2021-09-08 11:48:25 UTC (rev 282138)
@@ -41,7 +41,7 @@
                   (anchor edges: AnchorEdgeTop AnchorEdgeBottom)
                   (top offset 10.00)
                   (bottom offset 10.00)
-                  (containing block rect at (2,2) size 400x1760)
+                  (containing block rect at (0,0) size 400x1760)
                   (sticky box rect at (0,830) size 100x100)
                   (constraining rect at (0,0) size 400x300)
                   (sticky offset at last layout width=0 height=-640)

Modified: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt (282137 => 282138)


--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-gain-scrolling-ancestor-expected.txt	2021-09-08 11:48:25 UTC (rev 282138)
@@ -46,7 +46,7 @@
                       (anchor edges: AnchorEdgeTop AnchorEdgeBottom)
                       (top offset 10.00)
                       (bottom offset 10.00)
-                      (containing block rect at (2,2) size 400x1760)
+                      (containing block rect at (0,0) size 400x1760)
                       (sticky box rect at (0,830) size 100x100)
                       (constraining rect at (0,0) size 400x300)
                       (sticky offset at last layout width=0 height=-640)

Modified: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt (282137 => 282138)


--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-in-fixed-expected.txt	2021-09-08 11:48:25 UTC (rev 282138)
@@ -46,7 +46,7 @@
                       (anchor edges: AnchorEdgeTop AnchorEdgeBottom)
                       (top offset 10.00)
                       (bottom offset 10.00)
-                      (containing block rect at (2,2) size 400x1760)
+                      (containing block rect at (0,0) size 400x1760)
                       (sticky box rect at (0,830) size 100x100)
                       (constraining rect at (0,0) size 400x300)
                       (sticky offset at last layout width=0 height=-640)

Modified: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt (282137 => 282138)


--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/coordinated-frame-lose-scrolling-ancestor-expected.txt	2021-09-08 11:48:25 UTC (rev 282138)
@@ -41,7 +41,7 @@
                   (anchor edges: AnchorEdgeTop AnchorEdgeBottom)
                   (top offset 10.00)
                   (bottom offset 10.00)
-                  (containing block rect at (2,2) size 400x1760)
+                  (containing block rect at (0,0) size 400x1760)
                   (sticky box rect at (0,830) size 100x100)
                   (constraining rect at (0,0) size 400x300)
                   (sticky offset at last layout width=0 height=-640)

Modified: trunk/Source/WebCore/ChangeLog (282137 => 282138)


--- trunk/Source/WebCore/ChangeLog	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/Source/WebCore/ChangeLog	2021-09-08 11:48:25 UTC (rev 282138)
@@ -1,3 +1,20 @@
+2021-09-08  Martin Robinson  <mrobin...@webkit.org>
+
+        [css-position-sticky] Sticky constraints are calculated incorrectly when scrolling container has padding and borders
+        https://bugs.webkit.org/show_bug.cgi?id=229997
+
+        Reviewed by Simon Fraser.
+
+        No new tests. This is covered by two existing WPT tests:
+            web-platform-tests/css/css-position/sticky/position-sticky-large-top-2.tentative-expected.html
+            web-platform-tests/css/css-position/sticky/position-sticky-large-top.tentative-expected.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::computeStickyPositionConstraints const): When the containing block and the scroll container
+        are the same, fix the calculation of the container content rect. layoutOverflowRect() already does not include the border,
+        so stop adjusting for that. In addition, instead of simply adjusting the rect location by the padding, actually contract
+        it so that the bottom and right edges of the rectangle are correct.
+
 2021-09-08  Jean-Yves Avenard  <j...@apple.com>
 
         Safari TP 131 audio canPlayType() reports false negatives

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (282137 => 282138)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2021-09-08 11:01:18 UTC (rev 282137)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2021-09-08 11:48:25 UTC (rev 282138)
@@ -469,9 +469,9 @@
         containerContentRect = containingBlock->contentBoxRect();
     } else {
         containerContentRect = containingBlock->layoutOverflowRect();
-        LayoutPoint containerLocation = containerContentRect.location() + LayoutPoint(containingBlock->borderLeft() + containingBlock->paddingLeft(),
-            containingBlock->borderTop() + containingBlock->paddingTop());
-        containerContentRect.setLocation(containerLocation);
+        containerContentRect.contract(LayoutBoxExtent {
+            containingBlock->computedCSSPaddingTop(), containingBlock->computedCSSPaddingRight(),
+            containingBlock->computedCSSPaddingBottom(), containingBlock->computedCSSPaddingLeft() });
     }
 
     LayoutUnit maxWidth = containingBlock->availableLogicalWidth();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to