<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[243539] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/243539">243539</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2019-03-27 08:22:03 -0700 (Wed, 27 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS WK2] Fixed elements in frames can be misplaced sometimes
https://bugs.webkit.org/show_bug.cgi?id=196290

Reviewed by Frédéric Wang.

Source/WebCore:

In a page containing position:fixed inside an async-scrolling iframe, if the
main page is scrolled down, and you reload, then the fixed element in the iframe can
get misplaced or disappear.

The bug was that the reconcileViewportConstrainedLayerPositions() recursive state node
walk would cross frame boundaries, hitting subframe ScrollingStateFixedNodes with a viewport rect
for the main page.

Fix by giving ScrollingStateTree the responsibility for the recursive tree walk, and
have it bail at at frame boundaries.

Test: scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position.html

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions):
* page/scrolling/ScrollingStateFixedNode.cpp:
(WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect):
* page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect): Deleted.
* page/scrolling/ScrollingStateNode.h:
(WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect):
* page/scrolling/ScrollingStateStickyNode.cpp:
(WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect):
* page/scrolling/ScrollingStateTree.cpp:
(WebCore::ScrollingStateTree::reconcileLayerPositionsRecursive):
(WebCore::ScrollingStateTree::reconcileViewportConstrainedLayerPositions):
* page/scrolling/ScrollingStateTree.h:

LayoutTests:

* scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position-expected.txt: Added.
* scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateFixedNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateNodeh">trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateStickyNodecpp">trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateTreecpp">trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateTreeh">trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsscrollingcoordinatoriosfixedinframelayerreconcilelayerpositionexpectedtxt">trunk/LayoutTests/scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position-expected.txt</a></li>
<li><a href="#trunkLayoutTestsscrollingcoordinatoriosfixedinframelayerreconcilelayerpositionhtml">trunk/LayoutTests/scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (243538 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-03-27 12:14:07 UTC (rev 243538)
+++ trunk/LayoutTests/ChangeLog 2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2019-03-26  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS WK2] Fixed elements in frames can be misplaced sometimes
+        https://bugs.webkit.org/show_bug.cgi?id=196290
+
+        Reviewed by Frédéric Wang.
+
+        * scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position-expected.txt: Added.
+        * scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position.html: Added.
+
</ins><span class="cx"> 2019-03-26  Chris Dumez  <cdumez@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add basic layout test coverage for File Picker on iOS
</span></span></pre></div>
<a id="trunkLayoutTestsscrollingcoordinatoriosfixedinframelayerreconcilelayerpositionexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position-expected.txt (0 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position-expected.txt                            (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position-expected.txt       2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 320.00 2021.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 320.00 2021.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 313.00)
+          (bounds 304.00 154.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (children 1
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 300.00 150.00)
+                  (children 1
+                    (GraphicsLayer
+                      (anchor 0.00 0.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 300.00 1016.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 300.00 1016.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 8.00 10.00)
+                                  (bounds 200.00 140.00)
+                                  (contentsOpaque 1)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsscrollingcoordinatoriosfixedinframelayerreconcilelayerpositionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position.html (0 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position.html                            (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position.html       2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <style>
+        body {
+            height: 2000px;
+        }
+        iframe {
+            margin-top: 300px;
+        }
+    </style>
+    <script src="../../resources/ui-helper.js"></script>
+    <script>
+        if (window.testRunner) {
+            testRunner.waitUntilDone();
+            testRunner.dumpAsText();
+        }
+
+        async function doTest()
+        {
+            await UIHelper.immediateUnstableScrollTo(0, 100);
+            await UIHelper.ensurePresentationUpdate();
+            
+            document.getElementById('layer-tree').textContent = internals.layerTreeAsText(document);
+            testRunner.notifyDone();
+        }
+        
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+<pre id="layer-tree"></pre>
+    <iframe srcdoc="
+        <style>
+            body {
+                height: 1000px;
+            }
+            .fixed {
+                position: fixed;
+                top: 10px;
+            }
+            .box {
+                width: 200px;
+                height: 200px;
+                background-color: blue;
+            }
+        </style>
+        <div id='box' class='fixed box'></div>"
+    ></iframe>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (243538 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-03-27 12:14:07 UTC (rev 243538)
+++ trunk/Source/WebCore/ChangeLog      2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2019-03-26  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS WK2] Fixed elements in frames can be misplaced sometimes
+        https://bugs.webkit.org/show_bug.cgi?id=196290
+
+        Reviewed by Frédéric Wang.
+
+        In a page containing position:fixed inside an async-scrolling iframe, if the 
+        main page is scrolled down, and you reload, then the fixed element in the iframe can
+        get misplaced or disappear.
+
+        The bug was that the reconcileViewportConstrainedLayerPositions() recursive state node
+        walk would cross frame boundaries, hitting subframe ScrollingStateFixedNodes with a viewport rect
+        for the main page.
+
+        Fix by giving ScrollingStateTree the responsibility for the recursive tree walk, and
+        have it bail at at frame boundaries.
+
+        Test: scrollingcoordinator/ios/fixed-in-frame-layer-reconcile-layer-position.html
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions):
+        * page/scrolling/ScrollingStateFixedNode.cpp:
+        (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect):
+        * page/scrolling/ScrollingStateNode.cpp:
+        (WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect): Deleted.
+        * page/scrolling/ScrollingStateNode.h:
+        (WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect):
+        * page/scrolling/ScrollingStateStickyNode.cpp:
+        (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect):
+        * page/scrolling/ScrollingStateTree.cpp:
+        (WebCore::ScrollingStateTree::reconcileLayerPositionsRecursive):
+        (WebCore::ScrollingStateTree::reconcileViewportConstrainedLayerPositions):
+        * page/scrolling/ScrollingStateTree.h:
+
</ins><span class="cx"> 2019-03-27  Philippe Normand  <pnormand@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         Build failure with gstreamer 1.12.5 if USE_GSTREAMER_GL is enabled
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (243538 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2019-03-27 12:14:07 UTC (rev 243538)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp   2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -539,13 +539,9 @@
</span><span class="cx"> 
</span><span class="cx"> void AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions(ScrollingNodeID scrollingNodeID, const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
</span><span class="cx"> {
</span><del>-    auto* scrollingNode = m_scrollingStateTree->stateNodeForID(scrollingNodeID);
-    if (!scrollingNode)
-        return;
-
</del><span class="cx">     LOG_WITH_STREAM(Scrolling, stream << getCurrentProcessID() << " AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions for viewport rect " << viewportRect << " and node " << scrollingNodeID);
</span><span class="cx"> 
</span><del>-    scrollingNode->reconcileLayerPositionForViewportRect(viewportRect, action);
</del><ins>+    m_scrollingStateTree->reconcileViewportConstrainedLayerPositions(scrollingNodeID, viewportRect, action);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AsyncScrollingCoordinator::ensureRootStateNodeForFrameView(FrameView& frameView)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateFixedNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp (243538 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp  2019-03-27 12:14:07 UTC (rev 243538)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp     2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -77,8 +77,6 @@
</span><span class="cx"> 
</span><span class="cx"> void ScrollingStateFixedNode::reconcileLayerPositionForViewportRect(const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
</span><span class="cx"> {
</span><del>-    ScrollingStateNode::reconcileLayerPositionForViewportRect(viewportRect, action);
-
</del><span class="cx">     FloatPoint position = m_constraints.layerPositionForViewportRect(viewportRect);
</span><span class="cx">     if (layer().representsGraphicsLayer()) {
</span><span class="cx">         auto* graphicsLayer = static_cast<GraphicsLayer*>(layer());
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp (243538 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp       2019-03-27 12:14:07 UTC (rev 243538)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp  2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -151,15 +151,6 @@
</span><span class="cx">     return m_children->find(&childNode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScrollingStateNode::reconcileLayerPositionForViewportRect(const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
-{
-    if (!m_children)
-        return;
-
-    for (auto& child : *m_children)
-        child->reconcileLayerPositionForViewportRect(viewportRect, action);
-}
-
</del><span class="cx"> void ScrollingStateNode::setLayer(const LayerRepresentation& layerRepresentation)
</span><span class="cx"> {
</span><span class="cx">     if (layerRepresentation == m_layer)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h (243538 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h 2019-03-27 12:14:07 UTC (rev 243538)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h    2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -217,7 +217,7 @@
</span><span class="cx">     ChangedProperties changedProperties() const { return m_changedProperties; }
</span><span class="cx">     void setChangedProperties(ChangedProperties changedProperties) { m_changedProperties = changedProperties; }
</span><span class="cx">     
</span><del>-    virtual void reconcileLayerPositionForViewportRect(const LayoutRect& /*viewportRect*/, ScrollingLayerPositionAction);
</del><ins>+    virtual void reconcileLayerPositionForViewportRect(const LayoutRect& /*viewportRect*/, ScrollingLayerPositionAction) { }
</ins><span class="cx"> 
</span><span class="cx">     const LayerRepresentation& layer() const { return m_layer; }
</span><span class="cx">     WEBCORE_EXPORT void setLayer(const LayerRepresentation&);
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateStickyNodecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp (243538 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp 2019-03-27 12:14:07 UTC (rev 243538)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp    2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -77,8 +77,6 @@
</span><span class="cx"> 
</span><span class="cx"> void ScrollingStateStickyNode::reconcileLayerPositionForViewportRect(const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
</span><span class="cx"> {
</span><del>-    ScrollingStateNode::reconcileLayerPositionForViewportRect(viewportRect, action);
-
</del><span class="cx">     FloatPoint position = m_constraints.layerPositionForConstrainingRect(viewportRect);
</span><span class="cx">     if (layer().representsGraphicsLayer()) {
</span><span class="cx">         auto* graphicsLayer = static_cast<GraphicsLayer*>(layer());
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp (243538 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp       2019-03-27 12:14:07 UTC (rev 243538)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp  2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -364,6 +364,31 @@
</span><span class="cx">     return it->value;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScrollingStateTree::reconcileLayerPositionsRecursive(ScrollingStateNode& currNode, const LayoutRect& layoutViewport, ScrollingLayerPositionAction action)
+{
+    currNode.reconcileLayerPositionForViewportRect(layoutViewport, action);
+
+    if (!currNode.children())
+        return;
+    
+    for (auto& child : *currNode.children()) {
+        // Never need to cross frame boundaries, since viewport rect reconciliation is per frame.
+        if (is<ScrollingStateFrameScrollingNode>(child))
+            continue;
+
+        reconcileLayerPositionsRecursive(*child, layoutViewport, action);
+    }
+}
+
+void ScrollingStateTree::reconcileViewportConstrainedLayerPositions(ScrollingNodeID scrollingNodeID, const LayoutRect& layoutViewport, ScrollingLayerPositionAction action)
+{
+    auto* scrollingNode = stateNodeForID(scrollingNodeID);
+    if (!scrollingNode)
+        return;
+    
+    reconcileLayerPositionsRecursive(*scrollingNode, layoutViewport, action);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h (243538 => 243539)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h 2019-03-27 12:14:07 UTC (rev 243538)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h    2019-03-27 15:22:03 UTC (rev 243539)
</span><span class="lines">@@ -75,6 +75,8 @@
</span><span class="cx">     LayerRepresentation::Type preferredLayerRepresentation() const { return m_preferredLayerRepresentation; }
</span><span class="cx">     void setPreferredLayerRepresentation(LayerRepresentation::Type representation) { m_preferredLayerRepresentation = representation; }
</span><span class="cx"> 
</span><ins>+    void reconcileViewportConstrainedLayerPositions(ScrollingNodeID, const LayoutRect& viewportRect, ScrollingLayerPositionAction);
+
</ins><span class="cx"> private:
</span><span class="cx">     void setRootStateNode(Ref<ScrollingStateFrameScrollingNode>&&);
</span><span class="cx">     void addNode(ScrollingStateNode&);
</span><span class="lines">@@ -87,9 +89,11 @@
</span><span class="cx"> 
</span><span class="cx">     void removeNodeAndAllDescendants(ScrollingStateNode*);
</span><span class="cx"> 
</span><del>-    void recursiveNodeWillBeRemoved(ScrollingStateNode* currNode);
</del><ins>+    void recursiveNodeWillBeRemoved(ScrollingStateNode*);
</ins><span class="cx">     void willRemoveNode(ScrollingStateNode*);
</span><span class="cx"> 
</span><ins>+    void reconcileLayerPositionsRecursive(ScrollingStateNode&, const LayoutRect& viewportRect, ScrollingLayerPositionAction);
+
</ins><span class="cx">     AsyncScrollingCoordinator* m_scrollingCoordinator;
</span><span class="cx">     // Contains all the nodes we know about (those in the m_rootStateNode tree, and in m_unparentedNodes subtrees).
</span><span class="cx">     StateNodeMap m_stateNodeMap;
</span></span></pre>
</div>
</div>

</body>
</html>