Title: [245854] trunk
Revision
245854
Author
[email protected]
Date
2019-05-29 10:41:28 -0700 (Wed, 29 May 2019)

Log Message

Scrolling node ordering wrong when a layer has both positioning and fixed/sticky node
https://bugs.webkit.org/show_bug.cgi?id=198329

Reviewed by Darin Adler.

Source/WebCore:

Test: scrollingcoordinator/scrolling-tree/sticky-in-overflow.html

With sticky positioning in non-stacking context overflow you currently get structure like

FrameScrollingNode
  OverflowScrollingNode
  StickyNode
    PositionedNode

where StickyNode and PositionedNode reference the same layer. Sticky doesn't get applied at all when the overflow moves.

This patch reverses the order of sticky and positioned. It doesn't fix sticky positioning during scrolling yet,
but it does make it less jumpy. It is a prerequisite for the full fix.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):

LayoutTests:

* platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt: Added.
* scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt: Added.
* scrollingcoordinator/scrolling-tree/sticky-in-overflow.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (245853 => 245854)


--- trunk/LayoutTests/ChangeLog	2019-05-29 17:23:16 UTC (rev 245853)
+++ trunk/LayoutTests/ChangeLog	2019-05-29 17:41:28 UTC (rev 245854)
@@ -1,3 +1,14 @@
+2019-05-29  Antti Koivisto  <[email protected]>
+
+        Scrolling node ordering wrong when a layer has both positioning and fixed/sticky node
+        https://bugs.webkit.org/show_bug.cgi?id=198329
+
+        Reviewed by Darin Adler.
+
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt: Added.
+        * scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt: Added.
+        * scrollingcoordinator/scrolling-tree/sticky-in-overflow.html: Added.
+
 2019-05-28  Yacine Bandou  <[email protected]>
 
         [MSE][GStreamer] update the readyState correctly in MediaPlayerPrivateGStreamerMSE

Added: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt (0 => 245854)


--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt	2019-05-29 17:41:28 UTC (rev 245854)
@@ -0,0 +1,48 @@
+Sticky content
+
+(Frame scrolling node
+  (scrollable area size 800 600)
+  (contents size 800 600)
+  (parent relative scrollable rect at (0,0) size 800x600)
+  (scrollable area parameters 
+    (horizontal scroll elasticity 1)
+    (vertical scroll elasticity 1)
+    (horizontal scrollbar mode 0)
+    (vertical scrollbar mode 0))
+  (layout viewport at (0,0) size 800x600)
+  (min layout viewport origin (0,0))
+  (max layout viewport origin (0,0))
+  (behavior for fixed 0)
+  (children 2
+    (Overflow scrolling node
+      (scrollable area size 400 300)
+      (contents size 400 1100)
+      (parent relative scrollable rect at (8,8) size 400x300)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 1)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
+    )
+    (Positioned node
+      (layout constraints 
+        (layer-position-at-last-layout (50,50))
+        (positioning-behavior moves))
+      (related overflow nodes 1)
+      (children 1
+        (Sticky node
+          (anchor edges: AnchorEdgeTop )
+          (top offset 10.00)
+          (containing block rect at (50,50) size 300x1000)
+          (sticky box rect at (50,50) size 300x20)
+          (constraining rect at (0,0) size 400x300)
+          (sticky offset at last layout width=0 height=0)
+          (layer position at last layout (50,50))
+        )
+      )
+    )
+  )
+)
+
+

Added: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt (0 => 245854)


--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow-expected.txt	2019-05-29 17:41:28 UTC (rev 245854)
@@ -0,0 +1,48 @@
+Sticky content
+
+(Frame scrolling node
+  (scrollable area size 800 600)
+  (contents size 800 600)
+  (parent relative scrollable rect at (0,0) size 800x600)
+  (scrollable area parameters 
+    (horizontal scroll elasticity 2)
+    (vertical scroll elasticity 2)
+    (horizontal scrollbar mode 0)
+    (vertical scrollbar mode 0))
+  (layout viewport at (0,0) size 800x600)
+  (min layout viewport origin (0,0))
+  (max layout viewport origin (0,0))
+  (behavior for fixed 0)
+  (children 2
+    (Overflow scrolling node
+      (scrollable area size 385 285)
+      (contents size 385 1100)
+      (parent relative scrollable rect at (8,8) size 385x285)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 0)
+        (vertical scroll elasticity 0)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
+    )
+    (Positioned node
+      (layout constraints 
+        (layer-position-at-last-layout (50,50))
+        (positioning-behavior moves))
+      (related overflow nodes 1)
+      (children 1
+        (Sticky node
+          (anchor edges: AnchorEdgeTop )
+          (top offset 10.00)
+          (containing block rect at (50,50) size 285x1000)
+          (sticky box rect at (50,50) size 285x18)
+          (constraining rect at (0,0) size 385x285)
+          (sticky offset at last layout width=0 height=0)
+          (layer position at last layout (50,50))
+        )
+      )
+    )
+  )
+)
+
+

Added: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow.html (0 => 245854)


--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow.html	2019-05-29 17:41:28 UTC (rev 245854)
@@ -0,0 +1,51 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <title>
+        Check that overflow is nested inside fixed
+    </title>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        function doTest() {
+            if (window.internals)
+                document.getElementById('scrollingTree').innerText = window.internals.scrollingStateTreeAsText() + "\n";
+
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+
+        window.addEventListener('load', doTest, false);
+    </script>
+    <style>
+        .sticky {
+            position: -webkit-sticky;
+            background-color: silver;
+            top: 10px;
+        }
+
+        .scrolling {
+            width: 400px;
+            height: 300px;
+            overflow: scroll;
+        }
+
+        .scrolling-content {
+            margin: 50px;
+            height: 1000px;
+        }
+    </style>
+</head>
+<body>
+    <div class="scrolling">
+        <div class="scrolling-content">
+            <div class="sticky">
+                Sticky content
+            </div>
+        </div>
+    </div>
+    <pre id="scrollingTree"></pre>
+</body>
+</html>
+

Modified: trunk/Source/WebCore/ChangeLog (245853 => 245854)


--- trunk/Source/WebCore/ChangeLog	2019-05-29 17:23:16 UTC (rev 245853)
+++ trunk/Source/WebCore/ChangeLog	2019-05-29 17:41:28 UTC (rev 245854)
@@ -1,3 +1,27 @@
+2019-05-29  Antti Koivisto  <[email protected]>
+
+        Scrolling node ordering wrong when a layer has both positioning and fixed/sticky node
+        https://bugs.webkit.org/show_bug.cgi?id=198329
+
+        Reviewed by Darin Adler.
+
+        Test: scrollingcoordinator/scrolling-tree/sticky-in-overflow.html
+
+        With sticky positioning in non-stacking context overflow you currently get structure like
+
+        FrameScrollingNode
+          OverflowScrollingNode
+          StickyNode
+            PositionedNode
+
+        where StickyNode and PositionedNode reference the same layer. Sticky doesn't get applied at all when the overflow moves.
+
+        This patch reverses the order of sticky and positioned. It doesn't fix sticky positioning during scrolling yet,
+        but it does make it less jumpy. It is a prerequisite for the full fix.
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
+
 2019-05-29  Ludovico de Nittis  <[email protected]>
 
         Prepend KEY_ to the last key alias in PlatformEventKeyboardGtk

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (245853 => 245854)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-05-29 17:23:16 UTC (rev 245853)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-05-29 17:41:28 UTC (rev 245854)
@@ -4211,6 +4211,14 @@
     ScrollingTreeState childTreeState;
     ScrollingTreeState* currentTreeState = &treeState;
 
+    // If there's a positioning node, it's the parent scrolling node for fixed/sticky/scrolling/frame hosting.
+    if (roles.contains(ScrollCoordinationRole::Positioning)) {
+        newNodeID = updateScrollingNodeForPositioningRole(layer, *currentTreeState, changes);
+        childTreeState.parentNodeID = newNodeID;
+        currentTreeState = &childTreeState;
+    } else
+        detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::Positioning);
+
     // If is fixed or sticky, it's the parent scrolling node for scrolling/frame hosting.
     if (roles.contains(ScrollCoordinationRole::ViewportConstrained)) {
         newNodeID = updateScrollingNodeForViewportConstrainedRole(layer, *currentTreeState, changes);
@@ -4220,14 +4228,6 @@
     } else
         detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::ViewportConstrained);
 
-    // If there's a positioning node, it's the parent scrolling node for scrolling/frame hosting.
-    if (roles.contains(ScrollCoordinationRole::Positioning)) {
-        newNodeID = updateScrollingNodeForPositioningRole(layer, *currentTreeState, changes);
-        childTreeState.parentNodeID = newNodeID;
-        currentTreeState = &childTreeState;
-    } else
-        detachScrollCoordinatedLayer(layer, ScrollCoordinationRole::Positioning);
-
     if (roles.contains(ScrollCoordinationRole::Scrolling))
         newNodeID = updateScrollingNodeForScrollingRole(layer, *currentTreeState, changes);
     else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to