Title: [244630] trunk
Revision
244630
Author
[email protected]
Date
2019-04-24 17:46:23 -0700 (Wed, 24 Apr 2019)

Log Message

REGRESSION (r242132): Nested position:sticky elements move incorrectly
https://bugs.webkit.org/show_bug.cgi?id=197255
rdar://problem/50137744

Reviewed by Zalan Bujtas.
Source/WebCore:

Revert to the behavior of the code before r242132, where we looked at the direct parent
scrolling tree node instead of walking up the ancestor chain to find an enclosing scrolling node.
This fixes nested sticky behavior.

Test: scrollingcoordinator/mac/nested-sticky.html

* page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::applyLayerPositions):

LayoutTests:

* scrollingcoordinator/mac/nested-sticky-expected.html: Added.
* scrollingcoordinator/mac/nested-sticky.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (244629 => 244630)


--- trunk/LayoutTests/ChangeLog	2019-04-25 00:14:51 UTC (rev 244629)
+++ trunk/LayoutTests/ChangeLog	2019-04-25 00:46:23 UTC (rev 244630)
@@ -1,3 +1,14 @@
+2019-04-24  Simon Fraser  <[email protected]>
+
+        REGRESSION (r242132): Nested position:sticky elements move incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=197255
+        rdar://problem/50137744
+
+        Reviewed by Zalan Bujtas.
+
+        * scrollingcoordinator/mac/nested-sticky-expected.html: Added.
+        * scrollingcoordinator/mac/nested-sticky.html: Added.
+
 2019-04-24  Alicia Boya GarcĂ­a  <[email protected]>
 
         Unreviewed GTK test gardening

Added: trunk/LayoutTests/scrollingcoordinator/mac/nested-sticky-expected.html (0 => 244630)


--- trunk/LayoutTests/scrollingcoordinator/mac/nested-sticky-expected.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/mac/nested-sticky-expected.html	2019-04-25 00:46:23 UTC (rev 244630)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+        }
+      
+        .outer {
+            background: blue;
+            margin-top: 120px;
+            height: 200px;
+            padding: 10px;
+        }
+
+        .sticky {
+            position: sticky;
+            position: -webkit-sticky;
+            top: 0px;
+        }
+
+       .inner {
+            padding: 10px;
+            background: orange;
+            top: 10px;
+            height: 80px;
+        }
+    </style>
+    <script>
+        function startTest()
+        {
+            document.scrollingElement.scrollTop = 2000;
+        }
+        
+        window.addEventListener('load', startTest, false);
+    </script>
+</head>
+<body>
+  <div class="outer sticky">
+    <div class="inner sticky"></div>
+</body>
+</html>

Added: trunk/LayoutTests/scrollingcoordinator/mac/nested-sticky.html (0 => 244630)


--- trunk/LayoutTests/scrollingcoordinator/mac/nested-sticky.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/mac/nested-sticky.html	2019-04-25 00:46:23 UTC (rev 244630)
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 2000px;
+        }
+      
+        .outer {
+            background: blue;
+            margin-top: 120px;
+            height: 200px;
+            padding: 10px;
+        }
+
+        .sticky {
+            position: sticky;
+            position: -webkit-sticky;
+            top: 0px;
+        }
+
+       .inner {
+            padding: 10px;
+            background: orange;
+            top: 10px;
+            height: 80px;
+        }
+    </style>
+    <script>
+        function scrollTest()
+        {
+            eventSender.mouseMoveTo(20, 20);
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "began", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -100, "changed", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -100, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -100, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "none", "end");
+            eventSender.callAfterScrollingCompletes(() => {
+                testRunner.notifyDone();
+            });
+        }
+
+        function startTest()
+        {
+            if (window.eventSender) {
+                testRunner.waitUntilDone();
+
+                eventSender.monitorWheelEvents();
+                setTimeout(scrollTest, 0);
+            }
+        }
+        
+        window.addEventListener('load', startTest, false);
+    </script>
+</head>
+<body>
+  <div class="outer sticky">
+    <div class="inner sticky"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (244629 => 244630)


--- trunk/Source/WebCore/ChangeLog	2019-04-25 00:14:51 UTC (rev 244629)
+++ trunk/Source/WebCore/ChangeLog	2019-04-25 00:46:23 UTC (rev 244630)
@@ -1,3 +1,20 @@
+2019-04-24  Simon Fraser  <[email protected]>
+
+        REGRESSION (r242132): Nested position:sticky elements move incorrectly
+        https://bugs.webkit.org/show_bug.cgi?id=197255
+        rdar://problem/50137744
+
+        Reviewed by Zalan Bujtas.
+        
+        Revert to the behavior of the code before r242132, where we looked at the direct parent
+        scrolling tree node instead of walking up the ancestor chain to find an enclosing scrolling node.
+        This fixes nested sticky behavior.
+
+        Test: scrollingcoordinator/mac/nested-sticky.html
+
+        * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
+        (WebCore::ScrollingTreeStickyNode::applyLayerPositions):
+
 2019-04-24  Eric Carlson  <[email protected]>
 
         Create AVFoundationSoftLink.{h,mm} to reduce duplicate code

Modified: trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm (244629 => 244630)


--- trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm	2019-04-25 00:14:51 UTC (rev 244629)
+++ trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm	2019-04-25 00:46:23 UTC (rev 244630)
@@ -69,7 +69,7 @@
 {
     FloatRect constrainingRect;
 
-    auto* enclosingScrollingNode = enclosingScrollingNodeIncludingSelf();
+    auto* enclosingScrollingNode = parent();
     if (is<ScrollingTreeOverflowScrollingNode>(enclosingScrollingNode))
         constrainingRect = FloatRect(downcast<ScrollingTreeOverflowScrollingNode>(*enclosingScrollingNode).currentScrollPosition(), m_constraints.constrainingRectAtLastLayout().size());
     else if (is<ScrollingTreeFrameScrollingNode>(enclosingScrollingNode))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to