Title: [245682] trunk
Revision
245682
Author
[email protected]
Date
2019-05-23 08:48:52 -0700 (Thu, 23 May 2019)

Log Message

Create scrolling tree nodes for descendants of position:absolute inside stacking-context overflow
https://bugs.webkit.org/show_bug.cgi?id=198154

Reviewed by Antti Koivisto.
Source/WebCore:

There exists code that creates scrolling tree nodes for position:absolute when the containing block
chain skips an enclosing scroller, but the compositing ancestor tree includes the scroller. However
this code explicitly checked that the layer was position:absolute.

This needed to be generalized for any layer whose containing block ancestor chain includes
a position:absolute that skips the scroller, for example a transformed inside a position:absolute,
so remove an explicit isAbsolutelyPositioned() check and some similar assertions.

Test: scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::collectStationaryLayerRelatedOverflowNodes):
(WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
(WebCore::collectRelatedCoordinatedScrollingNodes):

LayoutTests:

* platform/ios-wk2/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow-expected.txt: Copied from LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt.
* platform/ios-wk2/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt:
* scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow-expected.txt: Copied from LayoutTests/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt.
* scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow.html: Added.
* scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (245681 => 245682)


--- trunk/LayoutTests/ChangeLog	2019-05-23 15:47:10 UTC (rev 245681)
+++ trunk/LayoutTests/ChangeLog	2019-05-23 15:48:52 UTC (rev 245682)
@@ -1,3 +1,16 @@
+2019-05-23  Simon Fraser  <[email protected]>
+
+        Create scrolling tree nodes for descendants of position:absolute inside stacking-context overflow
+        https://bugs.webkit.org/show_bug.cgi?id=198154
+
+        Reviewed by Antti Koivisto.
+
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow-expected.txt: Copied from LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt.
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt:
+        * scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow-expected.txt: Copied from LayoutTests/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt.
+        * scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow.html: Added.
+        * scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt:
+
 2019-05-23  Myles C. Maxfield  <[email protected]>
 
         [WHLSL] Implement property resolver

Copied: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow-expected.txt (from rev 245681, trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt) (0 => 245682)


--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow-expected.txt	2019-05-23 15:48:52 UTC (rev 245682)
@@ -0,0 +1,43 @@
+
+(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 1
+    (Overflow scrolling node
+      (scrollable area size 300 300)
+      (contents size 300 1000)
+      (parent relative scrollable rect at (30,22) size 300x300)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 1)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
+      (children 2
+        (Positioned node
+          (layout constraints 
+            (layer-position-at-last-layout (20,28))
+            (positioning-behavior stationary))
+          (related overflow nodes 1)
+        )
+        (Positioned node
+          (layout constraints 
+            (layer-position-at-last-layout (40,48))
+            (positioning-behavior stationary))
+          (related overflow nodes 1)
+        )
+      )
+    )
+  )
+)
+

Modified: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt (245681 => 245682)


--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt	2019-05-23 15:47:10 UTC (rev 245681)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt	2019-05-23 15:48:52 UTC (rev 245682)
@@ -25,7 +25,7 @@
         (horizontal scrollbar mode 0)
         (vertical scrollbar mode 0)
         (has enabled vertical scrollbar 1))
-      (children 2
+      (children 3
         (Positioned node
           (layout constraints 
             (layer-position-at-last-layout (20,28))
@@ -34,6 +34,12 @@
         )
         (Positioned node
           (layout constraints 
+            (layer-position-at-last-layout (32,60))
+            (positioning-behavior stationary))
+          (related overflow nodes 1)
+        )
+        (Positioned node
+          (layout constraints 
             (layer-position-at-last-layout (47,55))
             (positioning-behavior stationary))
           (related overflow nodes 1)

Copied: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow-expected.txt (from rev 245681, trunk/LayoutTests/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt) (0 => 245682)


--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow-expected.txt	2019-05-23 15:48:52 UTC (rev 245682)
@@ -0,0 +1,43 @@
+
+(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 1
+    (Overflow scrolling node
+      (scrollable area size 285 285)
+      (contents size 285 1000)
+      (parent relative scrollable rect at (30,22) size 285x285)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 0)
+        (vertical scroll elasticity 0)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
+      (children 2
+        (Positioned node
+          (layout constraints 
+            (layer-position-at-last-layout (20,28))
+            (positioning-behavior stationary))
+          (related overflow nodes 1)
+        )
+        (Positioned node
+          (layout constraints 
+            (layer-position-at-last-layout (40,48))
+            (positioning-behavior stationary))
+          (related overflow nodes 1)
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow.html (0 => 245682)


--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow.html	2019-05-23 15:48:52 UTC (rev 245682)
@@ -0,0 +1,58 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <title>Tests that we make a scrolling tree node for composited layers nested inside position:absolute in a stacking-context scroller</title>
+    <style>
+        .scroller {
+            overflow: scroll;
+            margin: 20px;
+            height: 300px;
+            width: 300px;
+            border: 2px solid black;
+            opacity: 0.9;
+        }
+
+        .absolute {
+            position:absolute;
+            left: 50px;
+            top: 50px;
+            width: 200px;
+            height: 120px;
+            padding: 20px;
+            background: gray;
+        }
+        
+        .composited {
+            transform: translateZ(0);
+            width: 100px;
+            height: 100px;
+            background-color: green;
+        }
+        
+        .spacer {
+            height: 500px;
+            width: 10px;
+            background-image: repeating-linear-gradient(to bottom, white, silver 200px);
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        window.addEventListener('load', () => {
+            if (window.internals)
+                document.getElementById('tree').innerText = internals.scrollingStateTreeAsText();
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="scroller">
+        <div class="spacer"></div>
+        <div class="absolute">
+            <div class="composited box"></div>
+        </div>
+        <div class="spacer"></div>
+    </div>
+<pre id="tree"></pre>
+</body>
+</html>

Modified: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt (245681 => 245682)


--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt	2019-05-23 15:47:10 UTC (rev 245681)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/nested-absolute-in-sc-overflow-expected.txt	2019-05-23 15:48:52 UTC (rev 245682)
@@ -25,7 +25,7 @@
         (horizontal scrollbar mode 0)
         (vertical scrollbar mode 0)
         (has enabled vertical scrollbar 1))
-      (children 2
+      (children 3
         (Positioned node
           (layout constraints 
             (layer-position-at-last-layout (20,28))
@@ -34,6 +34,12 @@
         )
         (Positioned node
           (layout constraints 
+            (layer-position-at-last-layout (32,58))
+            (positioning-behavior stationary))
+          (related overflow nodes 1)
+        )
+        (Positioned node
+          (layout constraints 
             (layer-position-at-last-layout (47,55))
             (positioning-behavior stationary))
           (related overflow nodes 1)

Modified: trunk/Source/WebCore/ChangeLog (245681 => 245682)


--- trunk/Source/WebCore/ChangeLog	2019-05-23 15:47:10 UTC (rev 245681)
+++ trunk/Source/WebCore/ChangeLog	2019-05-23 15:48:52 UTC (rev 245682)
@@ -1,3 +1,25 @@
+2019-05-23  Simon Fraser  <[email protected]>
+
+        Create scrolling tree nodes for descendants of position:absolute inside stacking-context overflow
+        https://bugs.webkit.org/show_bug.cgi?id=198154
+
+        Reviewed by Antti Koivisto.
+        
+        There exists code that creates scrolling tree nodes for position:absolute when the containing block
+        chain skips an enclosing scroller, but the compositing ancestor tree includes the scroller. However
+        this code explicitly checked that the layer was position:absolute.
+
+        This needed to be generalized for any layer whose containing block ancestor chain includes
+        a position:absolute that skips the scroller, for example a transformed inside a position:absolute,
+        so remove an explicit isAbsolutelyPositioned() check and some similar assertions.
+
+        Test: scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::collectStationaryLayerRelatedOverflowNodes):
+        (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
+        (WebCore::collectRelatedCoordinatedScrollingNodes):
+
 2019-05-23  Adrian Perez de Castro  <[email protected]>
 
         Fix a few missing header inclusions often masked by by unified sources

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (245681 => 245682)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-05-23 15:47:10 UTC (rev 245681)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-05-23 15:48:52 UTC (rev 245682)
@@ -3110,8 +3110,6 @@
             LOG(Scrolling, "Layer %p doesn't have scrolling node ID yet", &overflowLayer);
     };
 
-    ASSERT(layer.renderer().isAbsolutelyPositioned());
-
     // Collect all the composited scrollers which affect the position of this layer relative to its compositing ancestor (which might be inside the scroller or the scroller itself).
     bool seenPaintOrderAncestor = false;
     traverseAncestorLayers(layer, [&](const RenderLayer& ancestorLayer, bool isContainingBlockChain, bool isPaintOrderAncestor) {
@@ -3147,8 +3145,8 @@
         return ScrollPositioningBehavior::None;
     }
 
-    bool compositedAncestorIsInsideScroller = false;
-    auto* scrollingAncestor = enclosingCompositedScrollingLayer(layer, *compositedAncestor, compositedAncestorIsInsideScroller);
+    bool compositedAncestorIsScrolling = false;
+    auto* scrollingAncestor = enclosingCompositedScrollingLayer(layer, *compositedAncestor, compositedAncestorIsScrolling);
     if (!scrollingAncestor) {
         ASSERT_NOT_REACHED(); // layer.hasCompositedScrollingAncestor() should guarantee we have one.
         return ScrollPositioningBehavior::None;
@@ -3157,16 +3155,14 @@
     // There are two cases we have to deal with here:
     // 1. There's a composited overflow:scroll in the parent chain between the renderer and its containing block, and the layer's
     //    composited (z-order) ancestor is inside the scroller or is the scroller. In this case, we have to compensate for scroll position
-    //    changes to make the positioned layer stay in the same place. This only applies to position:absolute (since we handle fixed elsewhere).
-    if (layer.renderer().isAbsolutelyPositioned()) {
-        if (compositedAncestorIsInsideScroller && isNonScrolledLayerInsideScrolledCompositedAncestor(layer, *compositedAncestor, *scrollingAncestor))
-            return ScrollPositioningBehavior::Stationary;
-    }
+    //    changes to make the positioned layer stay in the same place. This only applies to position:absolute or descendants of position:absolute.
+    if (compositedAncestorIsScrolling && isNonScrolledLayerInsideScrolledCompositedAncestor(layer, *compositedAncestor, *scrollingAncestor))
+        return ScrollPositioningBehavior::Stationary;
 
     // 2. The layer's containing block is the overflow or inside the overflow:scroll, but its z-order ancestor is
     //    outside the overflow:scroll. In that case, we have to move the layer via the scrolling tree to make
     //    it move along with the overflow scrolling.
-    if (!compositedAncestorIsInsideScroller && isScrolledByOverflowScrollLayer(layer, *scrollingAncestor))
+    if (!compositedAncestorIsScrolling && isScrolledByOverflowScrollLayer(layer, *scrollingAncestor))
         return ScrollPositioningBehavior::Moves;
 
     return ScrollPositioningBehavior::None;
@@ -3192,7 +3188,6 @@
         break;
     }
     case ScrollPositioningBehavior::Stationary: {
-        ASSERT(layer.renderer().isAbsolutelyPositioned());
         auto* compositedAncestor = layer.ancestorCompositingLayer();
         if (!compositedAncestor)
             return overflowNodeData;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to