Title: [242913] trunk
Revision
242913
Author
[email protected]
Date
2019-03-13 15:06:18 -0700 (Wed, 13 Mar 2019)

Log Message

Source/WebCore:
Scrolling tree should reposition non-stacking order descendents of overflow:scroll
https://bugs.webkit.org/show_bug.cgi?id=195608

Reviewed by Zalan Bujtas.

Step 1: add scrolling tree positioning nodes classes (but don't create them yet).

Add Scrolling{State,Tree}PositionedNode to track composited layers that have to be repositioned when
an async overflow:scroll scrolls. There are two instances in which this is necessary, reflected by
the values of ScrollPositioningBehavior:

ScrollPositioningBehavior::Moves - a composited layer whose containing block chain includes an
    async overflow scroller, but whose composited (i.e. z-order) parent is outside of the overflow.
    When the overflow scrolls, this layer has to move along with the overflow.

ScrollPositioningBehavior::Stationary - a composited layer whose containing block chain skips the
    overflow scroller, but whose compositing (z-order) parent is the scroller, or inside the scroller.
    This only applies to position:absolute, on, for example, an overflow:scroll ith opacity.

PositionedNodes are modeled after Fixed/Sticky nodes, with a new type of layout constraint just called LayoutConstraints.

This patch adds support for PositionedNodes in the scrolling trees, but RenderLayerCompositor::computeCoordinatedPositioningForLayer()
is just a stub so the new node types aren't created yet.

RenderLayerBacking stores a ScrollingNodeID for the positioning role (just like the other roles). Since the Positioning
role is about position relative to ancestors, a node with both Positioning and FrameHosting or Scrolling roles treats
the Positioning node as the parent of the other types. A node should never have both Positioning and ViewportConstrained roles.

Test: scrollingcoordinator/scrolling-tree/positioned-nodes.html

* Sources.txt:
* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::setPositionedNodeGeometry):
(WebCore::AsyncScrollingCoordinator::setRelatedOverflowScrollingNodes):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingConstraints.cpp:
(WebCore::operator<<):
* page/scrolling/ScrollingConstraints.h:
(WebCore::LayoutConstraints::LayoutConstraints):
(WebCore::LayoutConstraints::operator== const):
(WebCore::LayoutConstraints::operator!= const):
(WebCore::LayoutConstraints::alignmentOffset const):
(WebCore::LayoutConstraints::setAlignmentOffset):
(WebCore::LayoutConstraints::layerPositionAtLastLayout const):
(WebCore::LayoutConstraints::setLayerPositionAtLastLayout):
(WebCore::LayoutConstraints::scrollPositioningBehavior const):
(WebCore::LayoutConstraints::setScrollPositioningBehavior):
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::operator<<):
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::setPositionedNodeGeometry):
(WebCore::ScrollingCoordinator::setRelatedOverflowScrollingNodes):
* page/scrolling/ScrollingCoordinatorTypes.h:
* page/scrolling/ScrollingStateNode.h:
(WebCore::ScrollingStateNode::isPositionedNode const):
* page/scrolling/ScrollingStatePositionedNode.cpp: Added.
(WebCore::ScrollingStatePositionedNode::create):
(WebCore::ScrollingStatePositionedNode::ScrollingStatePositionedNode):
(WebCore::ScrollingStatePositionedNode::clone):
(WebCore::ScrollingStatePositionedNode::setAllPropertiesChanged):
(WebCore::ScrollingStatePositionedNode::setRelatedOverflowScrollingNodes):
(WebCore::ScrollingStatePositionedNode::updateConstraints):
(WebCore::ScrollingStatePositionedNode::dumpProperties const):
* page/scrolling/ScrollingStatePositionedNode.h: Added.
* page/scrolling/ScrollingStateTree.cpp:
(WebCore::ScrollingStateTree::createNode):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::updateTreeFromStateNode):
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeNode.h:
(WebCore::ScrollingTreeNode::isPositionedNode const):
* page/scrolling/cocoa/ScrollingTreePositionedNode.h: Copied from Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.h.
* page/scrolling/cocoa/ScrollingTreePositionedNode.mm: Added.
(WebCore::ScrollingTreePositionedNode::create):
(WebCore::ScrollingTreePositionedNode::ScrollingTreePositionedNode):
(WebCore::ScrollingTreePositionedNode::~ScrollingTreePositionedNode):
(WebCore::ScrollingTreePositionedNode::commitStateBeforeChildren):
(WebCore::ScrollingTreePositionedNode::applyLayerPositions):
(WebCore::ScrollingTreePositionedNode::relatedNodeScrollPositionDidChange):
(WebCore::ScrollingTreePositionedNode::dumpProperties const):
* page/scrolling/cocoa/ScrollingTreeStickyNode.h:
* page/scrolling/mac/ScrollingTreeMac.cpp:
(ScrollingTreeMac::createScrollingTreeNode):
* platform/ScrollTypes.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::coordinatedScrollingRoles const):
(WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
(WebCore::scrollCoordinationRoleForNodeType):
(WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
(WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
(WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
(WebCore::RenderLayerCompositor::updateScrollingNodeForPositioningRole):
* rendering/RenderLayerCompositor.h:

Source/WebKit:
Scrolling tree should reposition non-stacking order descendents of overflow:scroll.
https://bugs.webkit.org/show_bug.cgi?id=195608

Reviewed by Zalan Bujtas.

Step 1: add scrolling tree positioning nodes classes (but don't create them yet).

Add Scrolling{State,Tree}PositionedNode to track composited layers that have to be repositioned when
an async overflow:scroll scrolls. There are two instances in which this is necessary, reflected by
the values of ScrollPositioningBehavior:

ScrollPositioningBehavior::Moves - a composited layer whose containing block chain includes an
    async overflow scroller, but whose composited (i.e. z-order) parent is outside of the overflow.
    When the overflow scrolls, this layer has to move along with the overflow.

ScrollPositioningBehavior::Stationary - a composited layer whose containing block chain skips the
    overflow scroller, but whose compositing (z-order) parent is the scroller, or inside the scroller.
    This only applies to position:absolute, on, for example, an overflow:scroll ith opacity.

PositionedNodes are modeled after Fixed/Sticky nodes, with a new type of layout constraint just called LayoutConstraints.

This patch adds support for PositionedNodes in the scrolling trees, but RenderLayerCompositor::computeCoordinatedPositioningForLayer()
is just a stub so the new node types aren't created yet.

RenderLayerBacking stores a ScrollingNodeID for the positioning role (just like the other roles). Since the Positioning
role is about position relative to ancestors, a node with both Positioning and FrameHosting or Scrolling roles treats
the Positioning node as the parent of the other types. A node should never have both Positioning and ViewportConstrained roles.

* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
(ArgumentCoder<ScrollingStatePositionedNode>::encode):
(ArgumentCoder<ScrollingStatePositionedNode>::decode):
(WebKit::encodeNodeAndDescendants):
(WebKit::RemoteScrollingCoordinatorTransaction::decode):
(WebKit::dump):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<LayoutConstraints>::encode):
(IPC::ArgumentCoder<LayoutConstraints>::decode):
(IPC::ArgumentCoder<StickyPositionViewportConstraints>::decode):
* Shared/WebCoreArgumentCoders.h:
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::createScrollingTreeNode):
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):

LayoutTests:
Scrolling tree should reposition non-stacking order descendents of overflow:scroll
https://bugs.webkit.org/show_bug.cgi?id=195608

Reviewed by Zalan Bujtas.

The results of this test will change when we enable positioned nodes. It tests various
combinations of overflow and stacking.

* platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt: Added.
* scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt: Added.
* scrollingcoordinator/scrolling-tree/positioned-nodes.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (242912 => 242913)


--- trunk/LayoutTests/ChangeLog	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/LayoutTests/ChangeLog	2019-03-13 22:06:18 UTC (rev 242913)
@@ -1,3 +1,17 @@
+2019-03-13  Simon Fraser  <[email protected]>
+
+        Scrolling tree should reposition non-stacking order descendents of overflow:scroll
+        https://bugs.webkit.org/show_bug.cgi?id=195608
+
+        Reviewed by Zalan Bujtas.
+
+        The results of this test will change when we enable positioned nodes. It tests various
+        combinations of overflow and stacking.
+        
+        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt: Added.
+        * scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt: Added.
+        * scrollingcoordinator/scrolling-tree/positioned-nodes.html: Added.
+
 2019-03-13  Youenn Fablet  <[email protected]>
 
         Check IDB quota usage through QuotaManager

Added: trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt (0 => 242913)


--- trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt	2019-03-13 22:06:18 UTC (rev 242913)
@@ -0,0 +1,82 @@
+Scrolling content
+Scrolling content
+Scrolling content
+Scrolling content
+Scrolling content
+
+(Frame scrolling node
+  (scrollable area size 800 600)
+  (contents size 800 741)
+  (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,141))
+  (behavior for fixed 0)
+  (children 4
+    (Overflow scrolling node
+      (scrollable area size 220 170)
+      (contents size 220 1020)
+      (parent relative scrollable rect at (19,11) size 220x170)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 1)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
+    )
+    (Overflow scrolling node
+      (scrollable area size 220 170)
+      (contents size 242 1020)
+      (parent relative scrollable rect at (19,193) size 220x170)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 1)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled horizontal scrollbar 1)
+        (has enabled vertical scrollbar 1))
+      (children 1
+        (Overflow scrolling node
+          (scrollable area size 220 170)
+          (contents size 220 1020)
+          (parent relative scrollable rect at (22,42) size 220x170)
+          (scrollable area parameters 
+            (horizontal scroll elasticity 1)
+            (vertical scroll elasticity 1)
+            (horizontal scrollbar mode 0)
+            (vertical scrollbar mode 0)
+            (has enabled vertical scrollbar 1))
+        )
+      )
+    )
+    (Overflow scrolling node
+      (scrollable area size 220 170)
+      (contents size 220 1020)
+      (parent relative scrollable rect at (19,375) size 220x170)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 1)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
+    )
+    (Overflow scrolling node
+      (scrollable area size 220 170)
+      (contents size 220 1020)
+      (parent relative scrollable rect at (19,557) size 220x170)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 1)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
+    )
+  )
+)
+
+

Added: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt (0 => 242913)


--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt	2019-03-13 22:06:18 UTC (rev 242913)
@@ -0,0 +1,83 @@
+Scrolling content
+Scrolling content
+Scrolling content
+Scrolling content
+Scrolling content
+
+(Frame scrolling node
+  (scrollable area size 785 600)
+  (contents size 785 741)
+  (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)
+    (has enabled vertical scrollbar 1))
+  (layout viewport at (0,0) size 785x600)
+  (min layout viewport origin (0,0))
+  (max layout viewport origin (0,141))
+  (behavior for fixed 0)
+  (children 4
+    (Overflow scrolling node
+      (scrollable area size 205 155)
+      (contents size 205 1020)
+      (parent relative scrollable rect at (19,11) size 205x155)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 0)
+        (vertical scroll elasticity 0)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
+    )
+    (Overflow scrolling node
+      (scrollable area size 205 155)
+      (contents size 242 1020)
+      (parent relative scrollable rect at (19,193) size 205x155)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 0)
+        (vertical scroll elasticity 0)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled horizontal scrollbar 1)
+        (has enabled vertical scrollbar 1))
+      (children 1
+        (Overflow scrolling node
+          (scrollable area size 205 155)
+          (contents size 205 1020)
+          (parent relative scrollable rect at (22,40) size 205x155)
+          (scrollable area parameters 
+            (horizontal scroll elasticity 0)
+            (vertical scroll elasticity 0)
+            (horizontal scrollbar mode 0)
+            (vertical scrollbar mode 0)
+            (has enabled vertical scrollbar 1))
+        )
+      )
+    )
+    (Overflow scrolling node
+      (scrollable area size 205 155)
+      (contents size 205 1020)
+      (parent relative scrollable rect at (19,375) size 205x155)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 0)
+        (vertical scroll elasticity 0)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
+    )
+    (Overflow scrolling node
+      (scrollable area size 205 155)
+      (contents size 205 1020)
+      (parent relative scrollable rect at (19,557) size 205x155)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 0)
+        (vertical scroll elasticity 0)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (has enabled vertical scrollbar 1))
+    )
+  )
+)
+
+

Added: trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes.html (0 => 242913)


--- trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes.html	2019-03-13 22:06:18 UTC (rev 242913)
@@ -0,0 +1,99 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>Test scrolling tree stucture with various positioning and clipping configurations</title>
+    <style>
+        .scroller {
+            margin: 10px;
+            background-color: silver;
+            border: 1px solid black;
+            padding: 10px;
+            width: 200px;
+            height: 150px;
+            overflow: scroll;
+        }
+        
+        .stacking-containing {
+            position: relative;
+            z-index: 0;
+        }
+
+        .stacking {
+            opacity: 0.75;
+        }
+        
+        .box {
+            width: 100px;
+            height: 100px;
+            background-color: blue;
+        }
+
+        .absolute {
+            position: absolute;
+            left: 100px;
+        }
+        
+        .composited {
+            transform: translateZ(0);
+            background-color: orange;
+        }
+
+        .scrolling-content {
+            height: 1000px;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        if (window.internals)
+            window.internals.settings.setAsyncOverflowScrollingEnabled(true);
+
+        function doTest() {
+            if (window.internals)
+                document.getElementById('scrollingTree').innerText = window.internals.scrollingStateTreeAsText() + "\n";
+        }
+
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div class="scroller">
+        <div class="scrolling-content">
+            Scrolling content
+            <div class="absolute box"></div>
+            <div class="composited box"></div>
+        </div>
+    </div>
+
+    <div class="scroller">
+        <div class="scrolling-content">
+            Scrolling content
+            <div class="scroller">
+                <div class="scrolling-content">
+                    Scrolling content
+                    <div class="absolute box"></div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div class="scroller stacking-containing">
+        <div class="scrolling-content">
+            Scrolling content
+            <div class="absolute box"></div>
+            <div class="composited box"></div>
+        </div>
+    </div>
+
+    <div class="scroller stacking">
+        <div class="scrolling-content">
+            Scrolling content
+            <div class="absolute box"></div>
+            <div class="composited box"></div>
+        </div>
+    </div>
+
+    <pre id="scrollingTree"></pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (242912 => 242913)


--- trunk/Source/WebCore/ChangeLog	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/ChangeLog	2019-03-13 22:06:18 UTC (rev 242913)
@@ -1,3 +1,104 @@
+2019-03-13  Simon Fraser  <[email protected]>
+
+        Scrolling tree should reposition non-stacking order descendents of overflow:scroll
+        https://bugs.webkit.org/show_bug.cgi?id=195608
+
+        Reviewed by Zalan Bujtas.
+        
+        Step 1: add scrolling tree positioning nodes classes (but don't create them yet).
+
+        Add Scrolling{State,Tree}PositionedNode to track composited layers that have to be repositioned when
+        an async overflow:scroll scrolls. There are two instances in which this is necessary, reflected by
+        the values of ScrollPositioningBehavior:
+
+        ScrollPositioningBehavior::Moves - a composited layer whose containing block chain includes an
+            async overflow scroller, but whose composited (i.e. z-order) parent is outside of the overflow.
+            When the overflow scrolls, this layer has to move along with the overflow.
+
+        ScrollPositioningBehavior::Stationary - a composited layer whose containing block chain skips the
+            overflow scroller, but whose compositing (z-order) parent is the scroller, or inside the scroller.
+            This only applies to position:absolute, on, for example, an overflow:scroll ith opacity.
+
+        PositionedNodes are modeled after Fixed/Sticky nodes, with a new type of layout constraint just called LayoutConstraints.
+        
+        This patch adds support for PositionedNodes in the scrolling trees, but RenderLayerCompositor::computeCoordinatedPositioningForLayer()
+        is just a stub so the new node types aren't created yet.
+        
+        RenderLayerBacking stores a ScrollingNodeID for the positioning role (just like the other roles). Since the Positioning
+        role is about position relative to ancestors, a node with both Positioning and FrameHosting or Scrolling roles treats
+        the Positioning node as the parent of the other types. A node should never have both Positioning and ViewportConstrained roles.
+
+        Test: scrollingcoordinator/scrolling-tree/positioned-nodes.html
+
+        * Sources.txt:
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::setPositionedNodeGeometry):
+        (WebCore::AsyncScrollingCoordinator::setRelatedOverflowScrollingNodes):
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ScrollingConstraints.cpp:
+        (WebCore::operator<<):
+        * page/scrolling/ScrollingConstraints.h:
+        (WebCore::LayoutConstraints::LayoutConstraints):
+        (WebCore::LayoutConstraints::operator== const):
+        (WebCore::LayoutConstraints::operator!= const):
+        (WebCore::LayoutConstraints::alignmentOffset const):
+        (WebCore::LayoutConstraints::setAlignmentOffset):
+        (WebCore::LayoutConstraints::layerPositionAtLastLayout const):
+        (WebCore::LayoutConstraints::setLayerPositionAtLastLayout):
+        (WebCore::LayoutConstraints::scrollPositioningBehavior const):
+        (WebCore::LayoutConstraints::setScrollPositioningBehavior):
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::operator<<):
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::setPositionedNodeGeometry):
+        (WebCore::ScrollingCoordinator::setRelatedOverflowScrollingNodes):
+        * page/scrolling/ScrollingCoordinatorTypes.h:
+        * page/scrolling/ScrollingStateNode.h:
+        (WebCore::ScrollingStateNode::isPositionedNode const):
+        * page/scrolling/ScrollingStatePositionedNode.cpp: Added.
+        (WebCore::ScrollingStatePositionedNode::create):
+        (WebCore::ScrollingStatePositionedNode::ScrollingStatePositionedNode):
+        (WebCore::ScrollingStatePositionedNode::clone):
+        (WebCore::ScrollingStatePositionedNode::setAllPropertiesChanged):
+        (WebCore::ScrollingStatePositionedNode::setRelatedOverflowScrollingNodes):
+        (WebCore::ScrollingStatePositionedNode::updateConstraints):
+        (WebCore::ScrollingStatePositionedNode::dumpProperties const):
+        * page/scrolling/ScrollingStatePositionedNode.h: Added.
+        * page/scrolling/ScrollingStateTree.cpp:
+        (WebCore::ScrollingStateTree::createNode):
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::updateTreeFromStateNode):
+        * page/scrolling/ScrollingTree.h:
+        * page/scrolling/ScrollingTreeNode.h:
+        (WebCore::ScrollingTreeNode::isPositionedNode const):
+        * page/scrolling/cocoa/ScrollingTreePositionedNode.h: Copied from Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.h.
+        * page/scrolling/cocoa/ScrollingTreePositionedNode.mm: Added.
+        (WebCore::ScrollingTreePositionedNode::create):
+        (WebCore::ScrollingTreePositionedNode::ScrollingTreePositionedNode):
+        (WebCore::ScrollingTreePositionedNode::~ScrollingTreePositionedNode):
+        (WebCore::ScrollingTreePositionedNode::commitStateBeforeChildren):
+        (WebCore::ScrollingTreePositionedNode::applyLayerPositions):
+        (WebCore::ScrollingTreePositionedNode::relatedNodeScrollPositionDidChange):
+        (WebCore::ScrollingTreePositionedNode::dumpProperties const):
+        * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
+        * page/scrolling/mac/ScrollingTreeMac.cpp:
+        (ScrollingTreeMac::createScrollingTreeNode):
+        * platform/ScrollTypes.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::coordinatedScrollingRoles const):
+        (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
+        * rendering/RenderLayerBacking.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
+        (WebCore::scrollCoordinationRoleForNodeType):
+        (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
+        (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
+        (WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
+        (WebCore::RenderLayerCompositor::updateScrollingNodeForPositioningRole):
+        * rendering/RenderLayerCompositor.h:
+
 2019-03-13  Youenn Fablet  <[email protected]>
 
         Check IDB quota usage through QuotaManager

Modified: trunk/Source/WebCore/Sources.txt (242912 => 242913)


--- trunk/Source/WebCore/Sources.txt	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/Sources.txt	2019-03-13 22:06:18 UTC (rev 242913)
@@ -1595,6 +1595,7 @@
 page/scrolling/ScrollingStateFrameScrollingNode.cpp
 page/scrolling/ScrollingStateNode.cpp
 page/scrolling/ScrollingStateOverflowScrollingNode.cpp
+page/scrolling/ScrollingStatePositionedNode.cpp
 page/scrolling/ScrollingStateScrollingNode.cpp
 page/scrolling/ScrollingStateStickyNode.cpp
 page/scrolling/ScrollingStateTree.cpp

Modified: trunk/Source/WebCore/SourcesCocoa.txt (242912 => 242913)


--- trunk/Source/WebCore/SourcesCocoa.txt	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2019-03-13 22:06:18 UTC (rev 242913)
@@ -148,6 +148,7 @@
 
 page/scrolling/cocoa/ScrollingStateNode.mm
 page/scrolling/cocoa/ScrollingTreeFixedNode.mm
+page/scrolling/cocoa/ScrollingTreePositionedNode.mm
 page/scrolling/cocoa/ScrollingTreeStickyNode.mm
 
 page/scrolling/mac/ScrollingCoordinatorMac.mm

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (242912 => 242913)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-03-13 22:06:18 UTC (rev 242913)
@@ -362,6 +362,8 @@
 		0F8B45761DC41DBA00443C3F /* JSIntersectionObserverCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F8B45741DC41DBA00443C3F /* JSIntersectionObserverCallback.h */; };
 		0F94B6472208FE3600157014 /* ScrollingTreeFixedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F94B6422208F70100157014 /* ScrollingTreeFixedNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F94B6492208FE3B00157014 /* ScrollingTreeStickyNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F94B6432208F70200157014 /* ScrollingTreeStickyNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		0F94B6522209150600157014 /* ScrollingStatePositionedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F94B651220914FF00157014 /* ScrollingStatePositionedNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		0F94B655220931E400157014 /* ScrollingTreePositionedNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F94B6532209156C00157014 /* ScrollingTreePositionedNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0F9DAA0F1FD1C66A0079C5B2 /* DOMGCOutputConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F9DAA0E1FD1C6640079C5B2 /* DOMGCOutputConstraint.h */; };
 		0FA24D7A162DF91900A3F4C0 /* GraphicsLayerUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FA24D78162DF91900A3F4C0 /* GraphicsLayerUpdater.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		0FB6252F18DE1B1500A07C05 /* GeometryUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB6252D18DE1B1500A07C05 /* GeometryUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5808,6 +5810,10 @@
 		0F94B6432208F70200157014 /* ScrollingTreeStickyNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ScrollingTreeStickyNode.h; path = page/scrolling/cocoa/ScrollingTreeStickyNode.h; sourceTree = SOURCE_ROOT; };
 		0F94B6442208F70200157014 /* ScrollingTreeFixedNode.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = ScrollingTreeFixedNode.mm; path = page/scrolling/cocoa/ScrollingTreeFixedNode.mm; sourceTree = SOURCE_ROOT; };
 		0F94B6452208F70300157014 /* ScrollingTreeStickyNode.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = ScrollingTreeStickyNode.mm; path = page/scrolling/cocoa/ScrollingTreeStickyNode.mm; sourceTree = SOURCE_ROOT; };
+		0F94B64F220914FE00157014 /* ScrollingStatePositionedNode.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingStatePositionedNode.cpp; sourceTree = "<group>"; };
+		0F94B651220914FF00157014 /* ScrollingStatePositionedNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollingStatePositionedNode.h; sourceTree = "<group>"; };
+		0F94B6532209156C00157014 /* ScrollingTreePositionedNode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollingTreePositionedNode.h; sourceTree = "<group>"; };
+		0F94B6542209156C00157014 /* ScrollingTreePositionedNode.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingTreePositionedNode.mm; sourceTree = "<group>"; };
 		0F97A657155DA81E00FADD4C /* DisplayRefreshMonitorIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DisplayRefreshMonitorIOS.mm; sourceTree = "<group>"; };
 		0F9DAA0C1FD1C6630079C5B2 /* DOMGCOutputConstraint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMGCOutputConstraint.cpp; sourceTree = "<group>"; };
 		0F9DAA0E1FD1C6640079C5B2 /* DOMGCOutputConstraint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMGCOutputConstraint.h; sourceTree = "<group>"; };
@@ -16980,6 +16986,8 @@
 				931CBD07161A44E900E4C874 /* ScrollingStateNode.h */,
 				0FEA3E81191B31BF000F1B55 /* ScrollingStateOverflowScrollingNode.cpp */,
 				0FEA3E82191B31BF000F1B55 /* ScrollingStateOverflowScrollingNode.h */,
+				0F94B64F220914FE00157014 /* ScrollingStatePositionedNode.cpp */,
+				0F94B651220914FF00157014 /* ScrollingStatePositionedNode.h */,
 				931CBD08161A44E900E4C874 /* ScrollingStateScrollingNode.cpp */,
 				931CBD09161A44E900E4C874 /* ScrollingStateScrollingNode.h */,
 				0FB8890C167D30160010CDA5 /* ScrollingStateStickyNode.cpp */,
@@ -21870,6 +21878,8 @@
 				93EF7D541954E98F00DFB71D /* ScrollingStateNode.mm */,
 				0F94B6422208F70100157014 /* ScrollingTreeFixedNode.h */,
 				0F94B6442208F70200157014 /* ScrollingTreeFixedNode.mm */,
+				0F94B6532209156C00157014 /* ScrollingTreePositionedNode.h */,
+				0F94B6542209156C00157014 /* ScrollingTreePositionedNode.mm */,
 				0F94B6432208F70200157014 /* ScrollingTreeStickyNode.h */,
 				0F94B6452208F70300157014 /* ScrollingTreeStickyNode.mm */,
 			);
@@ -31547,6 +31557,7 @@
 				0FEA3E7B191B2FC5000F1B55 /* ScrollingStateFrameScrollingNode.h in Headers */,
 				931CBD0D161A44E900E4C874 /* ScrollingStateNode.h in Headers */,
 				0FEA3E84191B31BF000F1B55 /* ScrollingStateOverflowScrollingNode.h in Headers */,
+				0F94B6522209150600157014 /* ScrollingStatePositionedNode.h in Headers */,
 				931CBD0F161A44E900E4C874 /* ScrollingStateScrollingNode.h in Headers */,
 				0FB8890F167D30160010CDA5 /* ScrollingStateStickyNode.h in Headers */,
 				931CBD11161A44E900E4C874 /* ScrollingStateTree.h in Headers */,
@@ -31560,6 +31571,7 @@
 				1AAADDE414DC8C8F00AF64B3 /* ScrollingTreeNode.h in Headers */,
 				0FEA3E80191B3169000F1B55 /* ScrollingTreeOverflowScrollingNode.h in Headers */,
 				0F73B769222B3A0C00805316 /* ScrollingTreeOverflowScrollingNodeMac.h in Headers */,
+				0F94B655220931E400157014 /* ScrollingTreePositionedNode.h in Headers */,
 				9391A99D1629D70000297330 /* ScrollingTreeScrollingNode.h in Headers */,
 				A6D5A99D1629D70000297330 /* ScrollingTreeScrollingNodeDelegate.h in Headers */,
 				0F37F0852202BF9800A89C0B /* ScrollingTreeScrollingNodeDelegateMac.h in Headers */,

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -43,6 +43,7 @@
 #include "ScrollingStateFrameHostingNode.h"
 #include "ScrollingStateFrameScrollingNode.h"
 #include "ScrollingStateOverflowScrollingNode.h"
+#include "ScrollingStatePositionedNode.h"
 #include "ScrollingStateStickyNode.h"
 #include "ScrollingStateTree.h"
 #include "Settings.h"
@@ -685,6 +686,28 @@
     }
 }
 
+void AsyncScrollingCoordinator::setPositionedNodeGeometry(ScrollingNodeID nodeID, const LayoutConstraints& constraints)
+{
+    auto* node = m_scrollingStateTree->stateNodeForID(nodeID);
+    if (!node)
+        return;
+
+    ASSERT(is<ScrollingStatePositionedNode>(*node));
+    if (auto* positionedNode = downcast<ScrollingStatePositionedNode>(node))
+        positionedNode->updateConstraints(constraints);
+}
+
+void AsyncScrollingCoordinator::setRelatedOverflowScrollingNodes(ScrollingNodeID nodeID, Vector<ScrollingNodeID>&& relatedNodes)
+{
+    auto* node = m_scrollingStateTree->stateNodeForID(nodeID);
+    if (!node)
+        return;
+
+    ASSERT(is<ScrollingStatePositionedNode>(*node));
+    if (auto* positionedNode = downcast<ScrollingStatePositionedNode>(node))
+        positionedNode->setRelatedOverflowScrollingNodes(WTFMove(relatedNodes));
+}
+
 void AsyncScrollingCoordinator::setSynchronousScrollingReasons(FrameView& frameView, SynchronousScrollingReasons reasons)
 {
     auto* scrollingStateNode = static_cast<ScrollingStateFrameScrollingNode*>(m_scrollingStateTree->stateNodeForID(frameView.scrollingNodeID()));

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -115,6 +115,8 @@
     WEBCORE_EXPORT void setScrollingNodeScrollableAreaGeometry(ScrollingNodeID, ScrollableArea&) override;
     WEBCORE_EXPORT void setFrameScrollingNodeState(ScrollingNodeID, const FrameView&) override;
     WEBCORE_EXPORT void setViewportConstraintedNodeConstraints(ScrollingNodeID, const ViewportConstraints&) override;
+    WEBCORE_EXPORT void setPositionedNodeGeometry(ScrollingNodeID, const LayoutConstraints&) override;
+    WEBCORE_EXPORT void setRelatedOverflowScrollingNodes(ScrollingNodeID, Vector<ScrollingNodeID>&&) override;
 
     WEBCORE_EXPORT void reconcileScrollingState(FrameView&, const FloatPoint&, const LayoutViewportOriginOrOverrideRect&, bool programmaticScroll, ViewportRectStability, ScrollingLayerPositionAction) override;
     void reconcileScrollPosition(FrameView&, ScrollingLayerPositionAction);

Modified: trunk/Source/WebCore/page/scrolling/ScrollingConstraints.cpp (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingConstraints.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/ScrollingConstraints.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -100,6 +100,24 @@
     return m_layerPositionAtLastLayout + offset - m_stickyOffsetAtLastLayout;
 }
 
+TextStream& operator<<(TextStream& ts, ScrollPositioningBehavior behavior)
+{
+    switch (behavior) {
+    case ScrollPositioningBehavior::None: ts << "none"; break;
+    case ScrollPositioningBehavior::Stationary: ts << "stationary"; break;
+    case ScrollPositioningBehavior::Moves: ts << "moves"; break;
+    }
+    return ts;
+}
+
+TextStream& operator<<(TextStream& ts, const LayoutConstraints& constraints)
+{
+    ts.dumpProperty("layer-position-at-last-layout", constraints.layerPositionAtLastLayout());
+    ts.dumpProperty("positioning-behavior", constraints.scrollPositioningBehavior());
+
+    return ts;
+}
+
 TextStream& operator<<(TextStream& ts, const FixedPositionViewportConstraints& constraints)
 {
     ts.dumpProperty("viewport-rect-at-last-layout", constraints.viewportRectAtLastLayout());

Modified: trunk/Source/WebCore/page/scrolling/ScrollingConstraints.h (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingConstraints.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/ScrollingConstraints.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -26,9 +26,48 @@
 #pragma once
 
 #include "FloatRect.h"
+#include "ScrollTypes.h"
 
 namespace WebCore {
 
+// LayoutConstraints classes encapsulate data and logic required to reposition elements whose layout
+// depends on the scroll position of ancestor elements.
+class LayoutConstraints {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    LayoutConstraints() = default;
+
+    LayoutConstraints(const LayoutConstraints& other)
+        : m_alignmentOffset(other.alignmentOffset())
+        , m_layerPositionAtLastLayout(other.layerPositionAtLastLayout())
+        , m_scrollPositioningBehavior(other.scrollPositioningBehavior())
+    {
+    }
+
+    bool operator==(const LayoutConstraints& other) const
+    {
+        return alignmentOffset() == other.alignmentOffset()
+            && layerPositionAtLastLayout() == other.layerPositionAtLastLayout()
+            && scrollPositioningBehavior() == other.scrollPositioningBehavior();
+    }
+
+    bool operator!=(const LayoutConstraints& other) const { return !(*this == other); }
+    
+    FloatSize alignmentOffset() const { return m_alignmentOffset; }
+    void setAlignmentOffset(FloatSize offset) { m_alignmentOffset = offset; }
+
+    FloatPoint layerPositionAtLastLayout() const { return m_layerPositionAtLastLayout; }
+    void setLayerPositionAtLastLayout(FloatPoint position) { m_layerPositionAtLastLayout = position; }
+    
+    ScrollPositioningBehavior scrollPositioningBehavior() const { return m_scrollPositioningBehavior; }
+    void setScrollPositioningBehavior(ScrollPositioningBehavior behavior) { m_scrollPositioningBehavior = behavior; }
+
+private:
+    FloatSize m_alignmentOffset;
+    FloatPoint m_layerPositionAtLastLayout;
+    ScrollPositioningBehavior m_scrollPositioningBehavior { ScrollPositioningBehavior::None };
+};
+
 // ViewportConstraints classes encapsulate data and logic required to reposition elements whose layout
 // depends on the viewport rect (positions fixed and sticky), when scrolling and zooming.
 class ViewportConstraints {
@@ -62,7 +101,7 @@
     void setAnchorEdges(AnchorEdges edges) { m_anchorEdges = edges; }
     
     FloatSize alignmentOffset() const { return m_alignmentOffset; }
-    void setAlignmentOffset(const FloatSize& offset) { m_alignmentOffset = offset; }
+    void setAlignmentOffset(FloatSize offset) { m_alignmentOffset = offset; }
 
 protected:
     ViewportConstraints()
@@ -91,7 +130,7 @@
     void setViewportRectAtLastLayout(const FloatRect& rect) { m_viewportRectAtLastLayout = rect; }
 
     const FloatPoint& layerPositionAtLastLayout() const { return m_layerPositionAtLastLayout; }
-    void setLayerPositionAtLastLayout(const FloatPoint& point) { m_layerPositionAtLastLayout = point; }
+    void setLayerPositionAtLastLayout(FloatPoint position) { m_layerPositionAtLastLayout = position; }
 
     bool operator==(const FixedPositionViewportConstraints& other) const
     {
@@ -135,12 +174,12 @@
     FloatSize computeStickyOffset(const FloatRect& constrainingRect) const;
 
     const FloatSize stickyOffsetAtLastLayout() const { return m_stickyOffsetAtLastLayout; }
-    void setStickyOffsetAtLastLayout(const FloatSize& offset) { m_stickyOffsetAtLastLayout = offset; }
+    void setStickyOffsetAtLastLayout(FloatSize offset) { m_stickyOffsetAtLastLayout = offset; }
 
     WEBCORE_EXPORT FloatPoint layerPositionForConstrainingRect(const FloatRect& constrainingRect) const;
 
     const FloatPoint& layerPositionAtLastLayout() const { return m_layerPositionAtLastLayout; }
-    void setLayerPositionAtLastLayout(const FloatPoint& point) { m_layerPositionAtLastLayout = point; }
+    void setLayerPositionAtLastLayout(FloatPoint position) { m_layerPositionAtLastLayout = position; }
 
     float leftOffset() const { return m_leftOffset; }
     float rightOffset() const { return m_rightOffset; }
@@ -195,6 +234,9 @@
     FloatPoint m_layerPositionAtLastLayout;
 };
 
+
+WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, ScrollPositioningBehavior);
+WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const LayoutConstraints&);
 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const FixedPositionViewportConstraints&);
 WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const StickyPositionViewportConstraints&);
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -464,6 +464,9 @@
     case ScrollingNodeType::Sticky:
         ts << "sticky";
         break;
+    case ScrollingNodeType::Positioned:
+        ts << "positioned";
+        break;
     }
     return ts;
 }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -56,6 +56,7 @@
 class Frame;
 class FrameView;
 class GraphicsLayer;
+class LayoutConstraints;
 class Page;
 class Region;
 class RenderLayer;
@@ -148,6 +149,8 @@
     virtual void setScrollingNodeScrollableAreaGeometry(ScrollingNodeID, ScrollableArea&) { }
     virtual void setFrameScrollingNodeState(ScrollingNodeID, const FrameView&) { }
     virtual void setViewportConstraintedNodeConstraints(ScrollingNodeID, const ViewportConstraints&) { }
+    virtual void setPositionedNodeGeometry(ScrollingNodeID, const LayoutConstraints&) { }
+    virtual void setRelatedOverflowScrollingNodes(ScrollingNodeID, Vector<ScrollingNodeID>&&) { }
 
     virtual void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect&, ScrollingLayerPositionAction) { }
     virtual String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -37,7 +37,8 @@
     FrameHosting,
     Overflow,
     Fixed,
-    Sticky
+    Sticky,
+    Positioned,
 };
 
 enum ScrollingStateTreeAsTextBehaviorFlags {

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -198,6 +198,7 @@
 
     bool isFixedNode() const { return m_nodeType == ScrollingNodeType::Fixed; }
     bool isStickyNode() const { return m_nodeType == ScrollingNodeType::Sticky; }
+    bool isPositionedNode() const { return m_nodeType == ScrollingNodeType::Positioned; }
     bool isScrollingNode() const { return isFrameScrollingNode() || isOverflowScrollingNode(); }
     bool isFrameScrollingNode() const { return m_nodeType == ScrollingNodeType::MainFrame || m_nodeType == ScrollingNodeType::Subframe; }
     bool isFrameHostingNode() const { return m_nodeType == ScrollingNodeType::FrameHosting; }

Added: trunk/Source/WebCore/page/scrolling/ScrollingStatePositionedNode.cpp (0 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingStatePositionedNode.cpp	                        (rev 0)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStatePositionedNode.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScrollingStatePositionedNode.h"
+
+#include "GraphicsLayer.h"
+#include "Logging.h"
+#include "ScrollingStateTree.h"
+#include <wtf/text/TextStream.h>
+
+#if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
+
+namespace WebCore {
+
+Ref<ScrollingStatePositionedNode> ScrollingStatePositionedNode::create(ScrollingStateTree& stateTree, ScrollingNodeID nodeID)
+{
+    return adoptRef(*new ScrollingStatePositionedNode(stateTree, nodeID));
+}
+
+ScrollingStatePositionedNode::ScrollingStatePositionedNode(ScrollingStateTree& tree, ScrollingNodeID nodeID)
+    : ScrollingStateNode(ScrollingNodeType::Positioned, tree, nodeID)
+{
+}
+
+ScrollingStatePositionedNode::ScrollingStatePositionedNode(const ScrollingStatePositionedNode& node, ScrollingStateTree& adoptiveTree)
+    : ScrollingStateNode(node, adoptiveTree)
+    , m_relatedOverflowScrollingNodes(node.relatedOverflowScrollingNodes())
+    , m_constraints(node.layoutConstraints())
+{
+}
+
+ScrollingStatePositionedNode::~ScrollingStatePositionedNode() = default;
+
+Ref<ScrollingStateNode> ScrollingStatePositionedNode::clone(ScrollingStateTree& adoptiveTree)
+{
+    return adoptRef(*new ScrollingStatePositionedNode(*this, adoptiveTree));
+}
+
+void ScrollingStatePositionedNode::setAllPropertiesChanged()
+{
+    setPropertyChangedBit(RelatedOverflowScrollingNodes);
+    setPropertyChangedBit(LayoutConstraintData);
+    ScrollingStateNode::setAllPropertiesChanged();
+}
+
+void ScrollingStatePositionedNode::setRelatedOverflowScrollingNodes(Vector<ScrollingNodeID>&& nodes)
+{
+    if (nodes == m_relatedOverflowScrollingNodes)
+        return;
+
+    m_relatedOverflowScrollingNodes = WTFMove(nodes);
+    setPropertyChanged(RelatedOverflowScrollingNodes);
+}
+
+void ScrollingStatePositionedNode::updateConstraints(const LayoutConstraints& constraints)
+{
+    if (m_constraints == constraints)
+        return;
+
+    LOG_WITH_STREAM(Scrolling, stream << "ScrollingStatePositionedNode " << scrollingNodeID() << " updateConstraints " << constraints);
+
+    m_constraints = constraints;
+    setPropertyChanged(LayoutConstraintData);
+}
+
+void ScrollingStatePositionedNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const
+{
+    ts << "Positioned node";
+    ScrollingStateNode::dumpProperties(ts, behavior);
+
+    ts.dumpProperty("layout constraints", m_constraints);
+    ts.dumpProperty("related overflow nodes", m_relatedOverflowScrollingNodes.size());
+
+    if (behavior & ScrollingStateTreeAsTextBehaviorIncludeNodeIDs) {
+        if (!m_relatedOverflowScrollingNodes.isEmpty()) {
+            TextStream::GroupScope scope(ts);
+            ts << "overflow nodes";
+            for (auto nodeID : m_relatedOverflowScrollingNodes)
+                ts << "\n" << indent << "nodeID " << nodeID;
+        }
+    }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)

Added: trunk/Source/WebCore/page/scrolling/ScrollingStatePositionedNode.h (0 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingStatePositionedNode.h	                        (rev 0)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStatePositionedNode.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
+
+#include "ScrollingConstraints.h"
+#include "ScrollingStateNode.h"
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+// ScrollingStatePositionedNode is used to manage the layers for z-order composited descendants of overflow:scroll
+// which are not containing block descendants. These layers must have their position inside their ancestor clipping
+// layer adjusted on the scrolling thread.
+class ScrollingStatePositionedNode final : public ScrollingStateNode {
+public:
+    static Ref<ScrollingStatePositionedNode> create(ScrollingStateTree&, ScrollingNodeID);
+
+    Ref<ScrollingStateNode> clone(ScrollingStateTree&) override;
+
+    virtual ~ScrollingStatePositionedNode();
+
+    enum {
+        RelatedOverflowScrollingNodes = NumStateNodeBits,
+        LayoutConstraintData,
+    };
+
+    // These are the overflow scrolling nodes whose scroll position affects the layers in this node.
+    const Vector<ScrollingNodeID>& relatedOverflowScrollingNodes() const { return m_relatedOverflowScrollingNodes; }
+    WEBCORE_EXPORT void setRelatedOverflowScrollingNodes(Vector<ScrollingNodeID>&&);
+
+    WEBCORE_EXPORT void updateConstraints(const LayoutConstraints&);
+    const LayoutConstraints& layoutConstraints() const { return m_constraints; }
+
+private:
+    ScrollingStatePositionedNode(ScrollingStateTree&, ScrollingNodeID);
+    ScrollingStatePositionedNode(const ScrollingStatePositionedNode&, ScrollingStateTree&);
+
+    void setAllPropertiesChanged() override;
+
+    void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override;
+
+    Vector<ScrollingNodeID> m_relatedOverflowScrollingNodes;
+    LayoutConstraints m_constraints;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_SCROLLING_STATE_NODE(ScrollingStatePositionedNode, isPositionedNode())
+
+#endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -75,6 +75,8 @@
         return ScrollingStateFixedNode::create(*this, nodeID);
     case ScrollingNodeType::Sticky:
         return ScrollingStateStickyNode::create(*this, nodeID);
+    case ScrollingNodeType::Positioned:
+        return ScrollingStatePositionedNode::create(*this, nodeID);
     }
     ASSERT_NOT_REACHED();
     return ScrollingStateFixedNode::create(*this, nodeID);

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -220,7 +220,14 @@
         ASSERT_WITH_SECURITY_IMPLICATION(parentIt != m_nodeMap.end());
         if (parentIt != m_nodeMap.end()) {
             auto* parent = parentIt->value;
-            node->setParent(parent);
+
+            auto* oldParent = node->parent();
+            if (oldParent)
+                oldParent->removeChild(*node);
+
+            if (oldParent != parent)
+                node->setParent(parent);
+
             parent->appendChild(*node);
         } else {
             // FIXME: Use WeakPtr in m_nodeMap.

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -72,6 +72,8 @@
     WEBCORE_EXPORT void applyLayerPositions();
 
     virtual Ref<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) = 0;
+    
+    ScrollingTreeNode* nodeForID(ScrollingNodeID) const;
 
     // Called after a scrolling tree node has handled a scroll and updated its layers.
     // Updates FrameView/RenderLayer scrolling state and GraphicsLayers.
@@ -154,8 +156,6 @@
     using OrphanScrollingNodeMap = HashMap<ScrollingNodeID, RefPtr<ScrollingTreeNode>>;
     void updateTreeFromStateNode(const ScrollingStateNode*, OrphanScrollingNodeMap&, HashSet<ScrollingNodeID>& unvisitedNodes);
 
-    ScrollingTreeNode* nodeForID(ScrollingNodeID) const;
-
     void applyLayerPositionsRecursive(ScrollingTreeNode&, FloatRect layoutViewport, FloatSize cumulativeDelta);
 
     void notifyRelatedNodesRecursive(ScrollingTreeScrollingNode& changedNode, ScrollingTreeNode& currNode, const FloatRect& layoutViewport, FloatSize cumulativeDelta);

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -51,6 +51,7 @@
     
     bool isFixedNode() const { return nodeType() == ScrollingNodeType::Fixed; }
     bool isStickyNode() const { return nodeType() == ScrollingNodeType::Sticky; }
+    bool isPositionedNode() const { return nodeType() == ScrollingNodeType::Positioned; }
     bool isScrollingNode() const { return isFrameScrollingNode() || isOverflowScrollingNode(); }
     bool isFrameScrollingNode() const { return nodeType() == ScrollingNodeType::MainFrame || nodeType() == ScrollingNodeType::Subframe; }
     bool isFrameHostingNode() const { return nodeType() == ScrollingNodeType::FrameHosting; }

Copied: trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNode.h (from rev 242912, trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.h) (0 => 242913)


--- trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNode.h	                        (rev 0)
+++ trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNode.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(ASYNC_SCROLLING)
+
+#include "ScrollingConstraints.h"
+#include "ScrollingTreeNode.h"
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS CALayer;
+
+namespace WebCore {
+
+class ScrollingTreePositionedNode : public ScrollingTreeNode {
+public:
+    WEBCORE_EXPORT static Ref<ScrollingTreePositionedNode> create(ScrollingTree&, ScrollingNodeID);
+
+    virtual ~ScrollingTreePositionedNode();
+
+private:
+    ScrollingTreePositionedNode(ScrollingTree&, ScrollingNodeID);
+
+    void commitStateBeforeChildren(const ScrollingStateNode&) override;
+    void relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode& changedNode, const FloatRect& layoutViewport, FloatSize& cumulativeDelta) override;
+
+    void applyLayerPositions(const FloatRect& layoutViewport, FloatSize& cumulativeDelta) override;
+
+    void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override;
+
+    Vector<ScrollingNodeID> m_relatedOverflowScrollingNodes;
+    LayoutConstraints m_constraints;
+    RetainPtr<CALayer> m_layer;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_SCROLLING_NODE(ScrollingTreePositionedNode, isPositionedNode())
+
+#endif // ENABLE(ASYNC_SCROLLING)

Added: trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNode.mm (0 => 242913)


--- trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNode.mm	                        (rev 0)
+++ trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNode.mm	2019-03-13 22:06:18 UTC (rev 242913)
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "ScrollingTreePositionedNode.h"
+
+#if ENABLE(ASYNC_SCROLLING)
+
+#import "Logging.h"
+#import "ScrollingStatePositionedNode.h"
+#import "ScrollingTree.h"
+#import "ScrollingTreeScrollingNode.h"
+#import <QuartzCore/CALayer.h>
+#import <wtf/text/TextStream.h>
+
+namespace WebCore {
+
+Ref<ScrollingTreePositionedNode> ScrollingTreePositionedNode::create(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
+{
+    return adoptRef(*new ScrollingTreePositionedNode(scrollingTree, nodeID));
+}
+
+ScrollingTreePositionedNode::ScrollingTreePositionedNode(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
+    : ScrollingTreeNode(scrollingTree, ScrollingNodeType::Positioned, nodeID)
+{
+}
+
+ScrollingTreePositionedNode::~ScrollingTreePositionedNode() = default;
+
+void ScrollingTreePositionedNode::commitStateBeforeChildren(const ScrollingStateNode& stateNode)
+{
+    const ScrollingStatePositionedNode& positionedStateNode = downcast<ScrollingStatePositionedNode>(stateNode);
+
+    if (positionedStateNode.hasChangedProperty(ScrollingStateNode::Layer))
+        m_layer = positionedStateNode.layer();
+
+    if (positionedStateNode.hasChangedProperty(ScrollingStatePositionedNode::RelatedOverflowScrollingNodes))
+        m_relatedOverflowScrollingNodes = positionedStateNode.relatedOverflowScrollingNodes();
+
+    if (positionedStateNode.hasChangedProperty(ScrollingStatePositionedNode::LayoutConstraintData))
+        m_constraints = positionedStateNode.layoutConstraints();
+}
+
+void ScrollingTreePositionedNode::applyLayerPositions(const FloatRect&, FloatSize& cumulativeDelta)
+{
+    FloatSize layerOffset; // FIXME: layerOffset needs to be computed by looking at scrolling tree deltas
+    // in the overflow nodes that affect this node. Some of that may come in via cumulativeDelta.
+
+    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreePositionedNode " << scrollingNodeID() << " applyLayerPositions: total overflow delta " << layerOffset);
+
+    layerOffset += cumulativeDelta;
+    // Stationary nodes move in the opposite direction.
+    if (m_constraints.scrollPositioningBehavior() == ScrollPositioningBehavior::Stationary)
+        layerOffset = -layerOffset;
+
+    FloatPoint layerPosition = m_constraints.layerPositionAtLastLayout() - layerOffset;
+    [m_layer _web_setLayerTopLeftPosition:layerPosition - m_constraints.alignmentOffset()];
+
+    cumulativeDelta += layerPosition - m_constraints.layerPositionAtLastLayout();
+}
+
+void ScrollingTreePositionedNode::relatedNodeScrollPositionDidChange(const ScrollingTreeScrollingNode& changedNode, const FloatRect& layoutViewport, FloatSize& cumulativeDelta)
+{
+    UNUSED_PARAM(changedNode);
+    // FIXME: This will avoid doing work if we can determine that changedNode doesn't affect this positioned node.
+    applyLayerPositions(layoutViewport, cumulativeDelta);
+}
+
+void ScrollingTreePositionedNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const
+{
+    ts << "positioned node";
+    ScrollingTreeNode::dumpProperties(ts, behavior);
+
+    ts.dumpProperty("layout constraints", m_constraints);
+    ts.dumpProperty("related overflow nodes", m_relatedOverflowScrollingNodes.size());
+
+    if (behavior & ScrollingStateTreeAsTextBehaviorIncludeNodeIDs) {
+        if (!m_relatedOverflowScrollingNodes.isEmpty()) {
+            TextStream::GroupScope scope(ts);
+            ts << "overflow nodes";
+            for (auto nodeID : m_relatedOverflowScrollingNodes)
+                ts << "\n" << indent << "nodeID " << nodeID;
+        }
+    }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(ASYNC_SCROLLING)

Modified: trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.h (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -35,8 +35,6 @@
 
 namespace WebCore {
 
-class StickyPositionViewportConstraints;
-
 class ScrollingTreeStickyNode : public ScrollingTreeNode {
 public:
     WEBCORE_EXPORT static Ref<ScrollingTreeStickyNode> create(ScrollingTree&, ScrollingNodeID);

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.cpp (242912 => 242913)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -30,6 +30,7 @@
 #include "ScrollingTreeFrameHostingNode.h"
 #include "ScrollingTreeFrameScrollingNodeMac.h"
 #include "ScrollingTreeOverflowScrollingNodeMac.h"
+#include "ScrollingTreePositionedNode.h"
 #include "ScrollingTreeStickyNode.h"
 
 #if ENABLE(ASYNC_SCROLLING) && PLATFORM(MAC)
@@ -61,6 +62,8 @@
         return ScrollingTreeFixedNode::create(*this, nodeID);
     case ScrollingNodeType::Sticky:
         return ScrollingTreeStickyNode::create(*this, nodeID);
+    case ScrollingNodeType::Positioned:
+        return ScrollingTreePositionedNode::create(*this, nodeID);
     }
     ASSERT_NOT_REACHED();
     return ScrollingTreeFixedNode::create(*this, nodeID);

Modified: trunk/Source/WebCore/platform/ScrollTypes.h (242912 => 242913)


--- trunk/Source/WebCore/platform/ScrollTypes.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/platform/ScrollTypes.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -214,6 +214,12 @@
     DoNotReveal
 };
 
+enum class ScrollPositioningBehavior : uint8_t {
+    None,
+    Moves,
+    Stationary
+};
+
 using ScrollbarControlState = unsigned;
 using ScrollbarControlPartMask = unsigned;
 using ScrollingNodeID = uint64_t;

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (242912 => 242913)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -1797,12 +1797,15 @@
     if (compositor.isLayerForIFrameWithScrollCoordinatedContents(m_owningLayer))
         coordinationRoles.add(ScrollCoordinationRole::FrameHosting);
 
+    if (compositor.computeCoordinatedPositioningForLayer(m_owningLayer) != ScrollPositioningBehavior::None)
+        coordinationRoles.add(ScrollCoordinationRole::Positioning);
+
     return coordinationRoles;
 }
 
 void RenderLayerBacking::detachFromScrollingCoordinator(OptionSet<ScrollCoordinationRole> roles)
 {
-    if (!m_scrollingNodeID && !m_frameHostingNodeID && !m_viewportConstrainedNodeID)
+    if (!m_scrollingNodeID && !m_frameHostingNodeID && !m_viewportConstrainedNodeID && !m_positioningNodeID)
         return;
 
     auto* scrollingCoordinator = m_owningLayer.page().scrollingCoordinator();
@@ -1826,6 +1829,12 @@
         scrollingCoordinator->unparentChildrenAndDestroyNode(m_viewportConstrainedNodeID);
         m_viewportConstrainedNodeID = 0;
     }
+
+    if (roles.contains(ScrollCoordinationRole::Positioning) && m_positioningNodeID) {
+        LOG(Compositing, "Detaching Positioned node %" PRIu64, m_positioningNodeID);
+        scrollingCoordinator->unparentChildrenAndDestroyNode(m_positioningNodeID);
+        m_positioningNodeID = 0;
+    }
 }
 
 void RenderLayerBacking::setIsScrollCoordinatedWithViewportConstrainedRole(bool viewportCoordinated)

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (242912 => 242913)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -121,6 +121,8 @@
             return m_frameHostingNodeID;
         case ScrollCoordinationRole::ViewportConstrained:
             return m_viewportConstrainedNodeID;
+        case ScrollCoordinationRole::Positioning:
+            return m_positioningNodeID;
         }
         return 0;
     }
@@ -138,12 +140,24 @@
             m_viewportConstrainedNodeID = nodeID;
             setIsScrollCoordinatedWithViewportConstrainedRole(nodeID);
             break;
+        case ScrollCoordinationRole::Positioning:
+            m_positioningNodeID = nodeID;
+            break;
         }
     }
 
     ScrollingNodeID scrollingNodeIDForChildren() const
     {
-        return m_frameHostingNodeID ? m_frameHostingNodeID : (m_scrollingNodeID ? m_scrollingNodeID : m_viewportConstrainedNodeID);
+        if (m_frameHostingNodeID)
+            return m_frameHostingNodeID;
+
+        if (m_scrollingNodeID)
+            return m_scrollingNodeID;
+
+        if (m_viewportConstrainedNodeID)
+            return m_viewportConstrainedNodeID;
+
+        return m_positioningNodeID;
     }
 
     void setIsScrollCoordinatedWithViewportConstrainedRole(bool);
@@ -395,6 +409,7 @@
     ScrollingNodeID m_viewportConstrainedNodeID { 0 };
     ScrollingNodeID m_scrollingNodeID { 0 };
     ScrollingNodeID m_frameHostingNodeID { 0 };
+    ScrollingNodeID m_positioningNodeID { 0 };
 
     bool m_artificiallyInflatedBounds { false }; // bounds had to be made non-zero to make transform-origin work
     bool m_isMainFrameRenderViewLayer { false };

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (242912 => 242913)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -2869,6 +2869,17 @@
     return false;
 }
 
+ScrollPositioningBehavior RenderLayerCompositor::computeCoordinatedPositioningForLayer(const RenderLayer& layer) const
+{
+    if (layer.isRenderViewLayer())
+        return ScrollPositioningBehavior::None;
+
+    // FIXME: This will look at the containing block and stacking context ancestor chains and determine
+    // whether this layer needs to be repositioned when a composited overflow scroll scrolls.
+
+    return ScrollPositioningBehavior::None;
+}
+
 bool RenderLayerCompositor::isLayerForIFrameWithScrollCoordinatedContents(const RenderLayer& layer) const
 {
     if (!is<RenderWidget>(layer.renderer()))
@@ -3766,6 +3777,8 @@
     case ScrollingNodeType::Fixed:
     case ScrollingNodeType::Sticky:
         return ScrollCoordinationRole::ViewportConstrained;
+    case ScrollingNodeType::Positioned:
+        return ScrollCoordinationRole::Positioning;
     }
     ASSERT_NOT_REACHED();
     return ScrollCoordinationRole::Scrolling;
@@ -3871,18 +3884,26 @@
 
     auto newNodeID = treeState.parentNodeID.valueOr(0);
 
-    ScrollingTreeState viewportConstrainedChildTreeState;
+    ScrollingTreeState childTreeState;
     ScrollingTreeState* currentTreeState = &treeState;
 
-    // If a node plays both roles, fixed/sticky is always the ancestor node of scrolling/frame hosting.
+    // 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);
         // ViewportConstrained nodes are the parent of same-layer scrolling nodes, so adjust the ScrollingTreeState.
-        viewportConstrainedChildTreeState.parentNodeID = newNodeID;
-        currentTreeState = &viewportConstrainedChildTreeState;
+        childTreeState.parentNodeID = newNodeID;
+        currentTreeState = &childTreeState;
     } 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
@@ -3925,10 +3946,7 @@
         case ScrollingNodeType::Sticky:
             scrollingCoordinator->setViewportConstraintedNodeConstraints(newNodeID, computeStickyViewportConstraints(layer));
             break;
-        case ScrollingNodeType::MainFrame:
-        case ScrollingNodeType::Subframe:
-        case ScrollingNodeType::FrameHosting:
-        case ScrollingNodeType::Overflow:
+        default:
             break;
         }
     }
@@ -3970,8 +3988,9 @@
             fixedRootBackgroundLayer(), clipLayer(), rootContentsLayer(),
             frameView.layerForHorizontalScrollbar(), frameView.layerForVerticalScrollbar() });
     } else {
-        scrollingCoordinator.setNodeLayers(nodeID, { layer.backing()->graphicsLayer(),
-            layer.backing()->scrollContainerLayer(), layer.backing()->scrolledContentsLayer(),
+        auto& backing = *layer.backing();
+        scrollingCoordinator.setNodeLayers(nodeID, { backing.graphicsLayer(),
+            backing.scrollContainerLayer(), backing.scrolledContentsLayer(),
             nullptr, nullptr, nullptr,
             layer.layerForHorizontalScrollbar(), layer.layerForVerticalScrollbar() });
     }
@@ -4043,6 +4062,37 @@
     return newNodeID;
 }
 
+ScrollingNodeID RenderLayerCompositor::updateScrollingNodeForPositioningRole(RenderLayer& layer, ScrollingTreeState& treeState, OptionSet<ScrollingNodeChangeFlags> changes)
+{
+    auto* scrollingCoordinator = this->scrollingCoordinator();
+
+    auto newNodeID = attachScrollingNode(layer, ScrollingNodeType::Positioned, treeState);
+    if (!newNodeID) {
+        ASSERT_NOT_REACHED();
+        return treeState.parentNodeID.valueOr(0);
+    }
+
+    if (changes & ScrollingNodeChangeFlags::Layer) {
+        auto& backing = *layer.backing();
+        scrollingCoordinator->setNodeLayers(newNodeID, { backing.graphicsLayer() });
+    }
+
+    if (changes & ScrollingNodeChangeFlags::LayerGeometry && treeState.parentNodeID) {
+        Vector<ScrollingNodeID> relatedNodeIDs; // FIXME: This will do a tree walk to figure out which composited overflows affect this positioned node.
+        scrollingCoordinator->setRelatedOverflowScrollingNodes(newNodeID, WTFMove(relatedNodeIDs));
+
+        auto* graphicsLayer = layer.backing()->graphicsLayer();
+        LayoutConstraints constraints;
+        constraints.setAlignmentOffset(graphicsLayer->pixelAlignmentOffset());
+        constraints.setLayerPositionAtLastLayout(graphicsLayer->position());
+        // Would be nice to avoid calling computeCoordinatedPositioningForLayer() again.
+        constraints.setScrollPositioningBehavior(computeCoordinatedPositioningForLayer(layer));
+        scrollingCoordinator->setPositionedNodeGeometry(newNodeID, constraints);
+    }
+
+    return newNodeID;
+}
+
 ScrollableArea* RenderLayerCompositor::scrollableAreaForScrollLayerID(ScrollingNodeID nodeID) const
 {
     if (!nodeID)

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (242912 => 242913)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -87,6 +87,7 @@
     ViewportConstrained = 1 << 0,
     Scrolling           = 1 << 1,
     FrameHosting        = 1 << 2,
+    Positioning         = 1 << 3,
 };
 
 #if PLATFORM(IOS_FAMILY)
@@ -325,6 +326,7 @@
     // FIXME: make the coordinated/async terminology consistent.
     bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer&) const;
     bool useCoordinatedScrollingForLayer(const RenderLayer&) const;
+    ScrollPositioningBehavior computeCoordinatedPositioningForLayer(const RenderLayer&) const;
     bool isLayerForIFrameWithScrollCoordinatedContents(const RenderLayer&) const;
 
     ScrollableArea* scrollableAreaForScrollLayerID(ScrollingNodeID) const;
@@ -491,6 +493,7 @@
     ScrollingNodeID updateScrollingNodeForViewportConstrainedRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
     ScrollingNodeID updateScrollingNodeForScrollingRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
     ScrollingNodeID updateScrollingNodeForFrameHostingRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
+    ScrollingNodeID updateScrollingNodeForPositioningRole(RenderLayer&, struct ScrollingTreeState&, OptionSet<ScrollingNodeChangeFlags>);
 
     void updateScrollingNodeLayers(ScrollingNodeID, RenderLayer&, ScrollingCoordinator&);
 

Modified: trunk/Source/WebKit/ChangeLog (242912 => 242913)


--- trunk/Source/WebKit/ChangeLog	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebKit/ChangeLog	2019-03-13 22:06:18 UTC (rev 242913)
@@ -1,3 +1,52 @@
+2019-03-13  Simon Fraser  <[email protected]>
+
+        Scrolling tree should reposition non-stacking order descendents of overflow:scroll.
+        https://bugs.webkit.org/show_bug.cgi?id=195608
+
+        Reviewed by Zalan Bujtas.
+
+        Step 1: add scrolling tree positioning nodes classes (but don't create them yet).
+
+        Add Scrolling{State,Tree}PositionedNode to track composited layers that have to be repositioned when
+        an async overflow:scroll scrolls. There are two instances in which this is necessary, reflected by
+        the values of ScrollPositioningBehavior:
+
+        ScrollPositioningBehavior::Moves - a composited layer whose containing block chain includes an
+            async overflow scroller, but whose composited (i.e. z-order) parent is outside of the overflow.
+            When the overflow scrolls, this layer has to move along with the overflow.
+
+        ScrollPositioningBehavior::Stationary - a composited layer whose containing block chain skips the
+            overflow scroller, but whose compositing (z-order) parent is the scroller, or inside the scroller.
+            This only applies to position:absolute, on, for example, an overflow:scroll ith opacity.
+
+        PositionedNodes are modeled after Fixed/Sticky nodes, with a new type of layout constraint just called LayoutConstraints.
+        
+        This patch adds support for PositionedNodes in the scrolling trees, but RenderLayerCompositor::computeCoordinatedPositioningForLayer()
+        is just a stub so the new node types aren't created yet.
+        
+        RenderLayerBacking stores a ScrollingNodeID for the positioning role (just like the other roles). Since the Positioning
+        role is about position relative to ancestors, a node with both Positioning and FrameHosting or Scrolling roles treats
+        the Positioning node as the parent of the other types. A node should never have both Positioning and ViewportConstrained roles.
+
+        * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
+        (ArgumentCoder<ScrollingStateFrameScrollingNode>::encode):
+        (ArgumentCoder<ScrollingStatePositionedNode>::encode):
+        (ArgumentCoder<ScrollingStatePositionedNode>::decode):
+        (WebKit::encodeNodeAndDescendants):
+        (WebKit::RemoteScrollingCoordinatorTransaction::decode):
+        (WebKit::dump):
+        * Shared/WebCoreArgumentCoders.cpp:
+        (IPC::ArgumentCoder<LayoutConstraints>::encode):
+        (IPC::ArgumentCoder<LayoutConstraints>::decode):
+        (IPC::ArgumentCoder<StickyPositionViewportConstraints>::decode):
+        * Shared/WebCoreArgumentCoders.h:
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
+        (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
+        (WebKit::RemoteScrollingTree::createScrollingTreeNode):
+        * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
+        (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
+
 2019-03-13  Youenn Fablet  <[email protected]>
 
         Check IDB quota usage through QuotaManager

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp (242912 => 242913)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -33,6 +33,7 @@
 #include <WebCore/ScrollingStateFrameHostingNode.h>
 #include <WebCore/ScrollingStateFrameScrollingNode.h>
 #include <WebCore/ScrollingStateOverflowScrollingNode.h>
+#include <WebCore/ScrollingStatePositionedNode.h>
 #include <WebCore/ScrollingStateStickyNode.h>
 #include <WebCore/ScrollingStateTree.h>
 #include <wtf/HashMap.h>
@@ -79,6 +80,11 @@
     static bool decode(Decoder&, ScrollingStateStickyNode&);
 };
 
+template<> struct ArgumentCoder<ScrollingStatePositionedNode> {
+    static void encode(Encoder&, const ScrollingStatePositionedNode&);
+    static bool decode(Decoder&, ScrollingStatePositionedNode&);
+};
+
 } // namespace IPC
 
 using namespace IPC;
@@ -157,7 +163,7 @@
 void ArgumentCoder<ScrollingStateFrameScrollingNode>::encode(Encoder& encoder, const ScrollingStateFrameScrollingNode& node)
 {
     encoder << static_cast<const ScrollingStateScrollingNode&>(node);
-    
+
     SCROLLING_NODE_ENCODE(ScrollingStateFrameScrollingNode::FrameScaleFactor, frameScaleFactor)
     SCROLLING_NODE_ENCODE(ScrollingStateFrameScrollingNode::EventTrackingRegion, eventTrackingRegions)
     SCROLLING_NODE_ENCODE(ScrollingStateFrameScrollingNode::ReasonsForSynchronousScrolling, synchronousScrollingReasons)
@@ -385,6 +391,39 @@
     return true;
 }
 
+void ArgumentCoder<ScrollingStatePositionedNode>::encode(Encoder& encoder, const ScrollingStatePositionedNode& node)
+{
+    encoder << static_cast<const ScrollingStateNode&>(node);
+
+    if (node.hasChangedProperty(ScrollingStatePositionedNode::RelatedOverflowScrollingNodes))
+        encoder << node.relatedOverflowScrollingNodes();
+
+    if (node.hasChangedProperty(ScrollingStatePositionedNode::LayoutConstraintData))
+        encoder << node.layoutConstraints();
+}
+
+bool ArgumentCoder<ScrollingStatePositionedNode>::decode(Decoder& decoder, ScrollingStatePositionedNode& node)
+{
+    if (!decoder.decode(static_cast<ScrollingStateNode&>(node)))
+        return false;
+
+    if (node.hasChangedProperty(ScrollingStatePositionedNode::RelatedOverflowScrollingNodes)) {
+        Vector<ScrollingNodeID> decodedValue;
+        if (!decoder.decode(decodedValue))
+            return false;
+        node.setRelatedOverflowScrollingNodes(WTFMove(decodedValue));
+    }
+
+    if (node.hasChangedProperty(ScrollingStatePositionedNode::LayoutConstraintData)) {
+        LayoutConstraints decodedValue;
+        if (!decoder.decode(decodedValue))
+            return false;
+        node.updateConstraints(decodedValue);
+    }
+
+    return true;
+}
+
 namespace WebKit {
 
 static void encodeNodeAndDescendants(IPC::Encoder& encoder, const ScrollingStateNode& stateNode, int& encodedNodeCount)
@@ -408,6 +447,9 @@
     case ScrollingNodeType::Sticky:
         encoder << downcast<ScrollingStateStickyNode>(stateNode);
         break;
+    case ScrollingNodeType::Positioned:
+        encoder << downcast<ScrollingStatePositionedNode>(stateNode);
+        break;
     }
 
     if (!stateNode.children())
@@ -500,6 +542,10 @@
             if (!decoder.decode(downcast<ScrollingStateStickyNode>(*newNode)))
                 return false;
             break;
+        case ScrollingNodeType::Positioned:
+            if (!decoder.decode(downcast<ScrollingStatePositionedNode>(*newNode)))
+                return false;
+            break;
         }
     }
 
@@ -618,6 +664,15 @@
         ts << node.viewportConstraints();
 }
 
+static void dump(TextStream& ts, const ScrollingStatePositionedNode& node, bool changedPropertiesOnly)
+{
+    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStatePositionedNode::RelatedOverflowScrollingNodes))
+        ts << node.relatedOverflowScrollingNodes();
+
+    if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStatePositionedNode::LayoutConstraintData))
+        ts << node.layoutConstraints();
+}
+
 static void dump(TextStream& ts, const ScrollingStateNode& node, bool changedPropertiesOnly)
 {
     ts.dumpProperty("type", node.nodeType());
@@ -642,6 +697,9 @@
     case ScrollingNodeType::Sticky:
         dump(ts, downcast<ScrollingStateStickyNode>(node), changedPropertiesOnly);
         break;
+    case ScrollingNodeType::Positioned:
+        dump(ts, downcast<ScrollingStatePositionedNode>(node), changedPropertiesOnly);
+        break;
     }
 }
 

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (242912 => 242913)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -2222,6 +2222,34 @@
     return true;
 }
 
+void ArgumentCoder<LayoutConstraints>::encode(Encoder& encoder, const LayoutConstraints& layoutConstraints)
+{
+    encoder << layoutConstraints.alignmentOffset();
+    encoder << layoutConstraints.layerPositionAtLastLayout();
+    encoder.encodeEnum(layoutConstraints.scrollPositioningBehavior());
+}
+
+bool ArgumentCoder<LayoutConstraints>::decode(Decoder& decoder, LayoutConstraints& layoutConstraints)
+{
+    FloatSize alignmentOffset;
+    if (!decoder.decode(alignmentOffset))
+        return false;
+
+    FloatPoint layerPosition;
+    if (!decoder.decode(layerPosition))
+        return false;
+
+    ScrollPositioningBehavior positioningBehavior;
+    if (!decoder.decodeEnum(positioningBehavior))
+        return false;
+
+    layoutConstraints = { };
+    layoutConstraints.setAlignmentOffset(alignmentOffset);
+    layoutConstraints.setLayerPositionAtLastLayout(layerPosition);
+    layoutConstraints.setScrollPositioningBehavior(positioningBehavior);
+    return true;
+}
+
 void ArgumentCoder<StickyPositionViewportConstraints>::encode(Encoder& encoder, const StickyPositionViewportConstraints& viewportConstraints)
 {
     encoder << viewportConstraints.alignmentOffset();
@@ -2285,7 +2313,7 @@
     FloatPoint layerPositionAtLastLayout;
     if (!decoder.decode(layerPositionAtLastLayout))
         return false;
-    
+
     viewportConstraints = StickyPositionViewportConstraints();
     viewportConstraints.setAlignmentOffset(alignmentOffset);
     viewportConstraints.setAnchorEdges(anchorEdges);

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (242912 => 242913)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2019-03-13 22:06:18 UTC (rev 242913)
@@ -82,6 +82,7 @@
 class KeyframeValueList;
 class LayoutSize;
 class LayoutPoint;
+class LayoutConstraints;
 class LinearTimingFunction;
 class Notification;
 class Path;
@@ -543,6 +544,11 @@
     static bool decode(Decoder&, WebCore::StickyPositionViewportConstraints&);
 };
 
+template<> struct ArgumentCoder<WebCore::LayoutConstraints> {
+    static void encode(Encoder&, const WebCore::LayoutConstraints&);
+    static bool decode(Decoder&, WebCore::LayoutConstraints&);
+};
+
 #if !USE(COORDINATED_GRAPHICS)
 template<> struct ArgumentCoder<WebCore::FilterOperations> {
     static void encode(Encoder&, const WebCore::FilterOperations&);

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp (242912 => 242913)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -37,6 +37,7 @@
 #include "WebProcessProxy.h"
 #include <WebCore/ScrollingStateFrameScrollingNode.h>
 #include <WebCore/ScrollingStateOverflowScrollingNode.h>
+#include <WebCore/ScrollingStatePositionedNode.h>
 #include <WebCore/ScrollingStateTree.h>
 #include <WebCore/ScrollingTreeScrollingNode.h>
 
@@ -157,6 +158,7 @@
         case ScrollingNodeType::FrameHosting:
         case ScrollingNodeType::Fixed:
         case ScrollingNodeType::Sticky:
+        case ScrollingNodeType::Positioned:
             break;
         }
     }

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp (242912 => 242913)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2019-03-13 22:06:18 UTC (rev 242913)
@@ -32,6 +32,7 @@
 #include "RemoteScrollingCoordinatorProxy.h"
 #include <WebCore/ScrollingTreeFixedNode.h>
 #include <WebCore/ScrollingTreeFrameHostingNode.h>
+#include <WebCore/ScrollingTreePositionedNode.h>
 #include <WebCore/ScrollingTreeStickyNode.h>
 
 #if PLATFORM(IOS_FAMILY)
@@ -132,6 +133,8 @@
         return ScrollingTreeFixedNode::create(*this, nodeID);
     case ScrollingNodeType::Sticky:
         return ScrollingTreeStickyNode::create(*this, nodeID);
+    case ScrollingNodeType::Positioned:
+        return ScrollingTreePositionedNode::create(*this, nodeID);
     }
     ASSERT_NOT_REACHED();
     return ScrollingTreeFixedNode::create(*this, nodeID);

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm (242912 => 242913)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm	2019-03-13 22:05:19 UTC (rev 242912)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm	2019-03-13 22:06:18 UTC (rev 242913)
@@ -35,6 +35,7 @@
 #import <UIKit/UIView.h>
 #import <WebCore/ScrollingStateFrameScrollingNode.h>
 #import <WebCore/ScrollingStateOverflowScrollingNode.h>
+#import <WebCore/ScrollingStatePositionedNode.h>
 #import <WebCore/ScrollingStateTree.h>
 
 #if ENABLE(CSS_SCROLL_SNAP)
@@ -85,9 +86,10 @@
                 scrollingStateNode.setFooterLayer(layerTreeHost.layerForID(scrollingStateNode.footerLayer()));
             break;
         }
+        case ScrollingNodeType::FrameHosting:
         case ScrollingNodeType::Fixed:
         case ScrollingNodeType::Sticky:
-        case ScrollingNodeType::FrameHosting:
+        case ScrollingNodeType::Positioned:
             break;
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to