Title: [242031] trunk/Source
Revision
242031
Author
[email protected]
Date
2019-02-24 22:03:22 -0800 (Sun, 24 Feb 2019)

Log Message

Migrate from "fixedPositionRect" to "layoutViewport" in the scrolling tree
https://bugs.webkit.org/show_bug.cgi?id=194984

Reviewed by Sam Weinig.

Rename "fixedPositionRect" to "layoutViewport" in scrolling tree code.

Remove ScrollingTree::fixedPositionRect() which was only used on iOS, to fetch the
current layout viewport rect. Instead, set the layout viewport on the root
node in ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling().
Source/WebCore:

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
(WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Deleted.
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeFrameHostingNode.cpp:
(WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange):
* page/scrolling/ScrollingTreeFrameHostingNode.h:
* page/scrolling/ScrollingTreeFrameScrollingNode.h:
* page/scrolling/ScrollingTreeNode.h:
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange):
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/cocoa/ScrollingTreeFixedNode.h:
* page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
(WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
* page/scrolling/cocoa/ScrollingTreeStickyNode.h:
* page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
(WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange):
(WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):

Source/WebKit:

Add a WK2 Scrolling log channel.

* Platform/Logging.h:
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::fixedPositionRect): Deleted.
* UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::currentLayoutViewport const):
(WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect const): Deleted.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateChildNodesAfterScroll):
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange):
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll):
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (242030 => 242031)


--- trunk/Source/WebCore/ChangeLog	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/ChangeLog	2019-02-25 06:03:22 UTC (rev 242031)
@@ -1,3 +1,40 @@
+2019-02-24  Simon Fraser  <[email protected]>
+
+        Migrate from "fixedPositionRect" to "layoutViewport" in the scrolling tree
+        https://bugs.webkit.org/show_bug.cgi?id=194984
+
+        Reviewed by Sam Weinig.
+
+        Rename "fixedPositionRect" to "layoutViewport" in scrolling tree code.
+
+        Remove ScrollingTree::fixedPositionRect() which was only used on iOS, to fetch the
+        current layout viewport rect. Instead, set the layout viewport on the root
+        node in ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling().
+
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling):
+        (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Deleted.
+        * page/scrolling/ScrollingTree.h:
+        * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
+        (WebCore::ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange):
+        * page/scrolling/ScrollingTreeFrameHostingNode.h:
+        * page/scrolling/ScrollingTreeFrameScrollingNode.h:
+        * page/scrolling/ScrollingTreeNode.h:
+        * page/scrolling/ScrollingTreeScrollingNode.cpp:
+        (WebCore::ScrollingTreeScrollingNode::updateLayersAfterAncestorChange):
+        * page/scrolling/ScrollingTreeScrollingNode.h:
+        * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
+        * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
+        (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
+        * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
+        * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
+        (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange):
+        (WebCore::ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition):
+
 2019-02-24  Devin Rousso  <[email protected]>
 
         Web Inspector: Change the InspectorOverlay to use native rather than canvas

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2019-02-25 06:03:22 UTC (rev 242031)
@@ -122,13 +122,15 @@
     return ScrollingEventResult::DidNotHandleEvent;
 }
 
-void ScrollingTree::viewportChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const FloatRect& fixedPositionRect, double scale)
+void ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling(const FloatRect& layoutViewport, double scale)
 {
-    auto* node = nodeForID(nodeID);
-    if (!is<ScrollingTreeScrollingNode>(node))
-        return;
-
-    downcast<ScrollingTreeScrollingNode>(*node).updateLayersAfterViewportChange(fixedPositionRect, scale);
+    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTree::viewportChangedViaDelegatedScrolling - layoutViewport " << layoutViewport);
+    
+    if (m_rootNode) {
+        auto& frameScrollingNode = downcast<ScrollingTreeFrameScrollingNode>(*m_rootNode);
+        frameScrollingNode.setLayoutViewport(layoutViewport);
+        frameScrollingNode.updateLayersAfterViewportChange(layoutViewport, scale);
+    }
 }
 
 void ScrollingTree::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const WebCore::FloatPoint& scrollPosition, bool inUserInteraction)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -82,7 +82,7 @@
 
     // Delegated scrolling/zooming has caused the viewport to change, so update viewport-constrained layers
     // (but don't cause scroll events to be fired).
-    WEBCORE_EXPORT virtual void viewportChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatRect& fixedPositionRect, double scale);
+    WEBCORE_EXPORT virtual void mainFrameViewportChangedViaDelegatedScrolling(const WebCore::FloatRect& layoutViewport, double scale);
 
     // Delegated scrolling has scrolled a node. Update layer positions on descendant tree nodes,
     // and call scrollingTreeNodeDidScroll().
@@ -94,7 +94,6 @@
     FloatPoint mainFrameScrollPosition();
     
 #if PLATFORM(IOS_FAMILY)
-    virtual FloatRect fixedPositionRect() = 0;
     virtual void scrollingTreeNodeWillStartPanGesture() { }
     virtual void scrollingTreeNodeWillStartScroll() { }
     virtual void scrollingTreeNodeDidEndScroll() { }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameHostingNode.cpp (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameHostingNode.cpp	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameHostingNode.cpp	2019-02-25 06:03:22 UTC (rev 242031)
@@ -57,13 +57,13 @@
         m_parentRelativeScrollableRect = frameHostingStateNode.parentRelativeScrollableRect();
 }
 
-void ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta)
+void ScrollingTreeFrameHostingNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
 {
     if (!m_children)
         return;
 
     for (auto& child : *m_children)
-        child->updateLayersAfterAncestorChange(changedNode, fixedPositionRect, cumulativeDelta);
+        child->updateLayersAfterAncestorChange(changedNode, layoutViewport, cumulativeDelta);
 }
 
 LayoutPoint ScrollingTreeFrameHostingNode::parentToLocalPoint(LayoutPoint point) const

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameHostingNode.h (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameHostingNode.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameHostingNode.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -42,7 +42,7 @@
     ScrollingTreeFrameHostingNode(ScrollingTree&, ScrollingNodeID);
 
     void commitStateBeforeChildren(const ScrollingStateNode&) final;
-    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) final;
+    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) final;
 
     const LayoutRect& parentRelativeScrollableRect() const { return m_parentRelativeScrollableRect; }
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -42,9 +42,9 @@
     void commitStateBeforeChildren(const ScrollingStateNode&) override;
     
     // FIXME: We should implement this when we support ScrollingTreeScrollingNodes as children.
-    void updateLayersAfterAncestorChange(const ScrollingTreeNode& /*changedNode*/, const FloatRect& /*fixedPositionRect*/, const FloatSize& /*cumulativeDelta*/) override { }
+    void updateLayersAfterAncestorChange(const ScrollingTreeNode& /*changedNode*/, const FloatRect& /*layoutViewport*/, const FloatSize& /*cumulativeDelta*/) override { }
 
-    void updateLayersAfterViewportChange(const FloatRect& fixedPositionRect, double scale) override = 0;
+    void updateLayersAfterViewportChange(const FloatRect& layoutViewport, double scale) override = 0;
     void updateLayersAfterDelegatedScroll(const FloatPoint&) override { }
 
     SynchronousScrollingReasons synchronousScrollingReasons() const { return m_synchronousScrollingReasons; }
@@ -54,7 +54,8 @@
     FloatSize viewToContentsOffset(const FloatPoint& scrollPosition) const;
     FloatRect layoutViewportForScrollPosition(const FloatPoint& visibleContentOrigin, float scale) const;
 
-    FloatRect fixedPositionRect() { return FloatRect(lastCommittedScrollPosition(), scrollableAreaSize()); };
+    FloatRect layoutViewport() const { return m_layoutViewport; };
+    void setLayoutViewport(const FloatRect& r) { m_layoutViewport = r; };
 
     float frameScaleFactor() const { return m_frameScaleFactor; }
 
@@ -65,9 +66,6 @@
     int footerHeight() const { return m_footerHeight; }
     float topContentInset() const { return m_topContentInset; }
 
-    FloatRect layoutViewport() const { return m_layoutViewport; };
-    void setLayoutViewport(const FloatRect& r) { m_layoutViewport = r; };
-
     FloatPoint minLayoutViewportOrigin() const { return m_minLayoutViewportOrigin; }
     FloatPoint maxLayoutViewportOrigin() const { return m_maxLayoutViewportOrigin; }
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -58,7 +58,7 @@
     virtual void commitStateBeforeChildren(const ScrollingStateNode&) = 0;
     virtual void commitStateAfterChildren(const ScrollingStateNode&) { }
 
-    virtual void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) = 0;
+    virtual void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) = 0;
 
     ScrollingTreeNode* parent() const { return m_parent; }
     void setParent(ScrollingTreeNode* parent) { m_parent = parent; }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2019-02-25 06:03:22 UTC (rev 242031)
@@ -113,13 +113,13 @@
         scrollingTree().scrollingTreeNodeRequestsScroll(scrollingNodeID(), scrollingStateNode.requestedScrollPosition(), scrollingStateNode.requestedScrollPositionRepresentsProgrammaticScroll());
 }
 
-void ScrollingTreeScrollingNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta)
+void ScrollingTreeScrollingNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
 {
     if (!m_children)
         return;
 
     for (auto& child : *m_children)
-        child->updateLayersAfterAncestorChange(changedNode, fixedPositionRect, cumulativeDelta);
+        child->updateLayersAfterAncestorChange(changedNode, layoutViewport, cumulativeDelta);
 }
 
 ScrollingEventResult ScrollingTreeScrollingNode::handleWheelEvent(const PlatformWheelEvent&)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -50,7 +50,7 @@
     void commitStateBeforeChildren(const ScrollingStateNode&) override;
     void commitStateAfterChildren(const ScrollingStateNode&) override;
 
-    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) override;
+    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) override;
 
     virtual ScrollingEventResult handleWheelEvent(const PlatformWheelEvent&);
     virtual void setScrollPosition(const FloatPoint&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges);
@@ -57,7 +57,7 @@
 
     void scrollBy(const FloatSize&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges);
 
-    virtual void updateLayersAfterViewportChange(const FloatRect& fixedPositionRect, double scale) = 0;
+    virtual void updateLayersAfterViewportChange(const FloatRect& layoutViewport, double scale) = 0;
     virtual void updateLayersAfterDelegatedScroll(const FloatPoint&) { }
 
     virtual FloatPoint scrollPosition() const = 0;

Modified: trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.h (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -47,7 +47,7 @@
     ScrollingTreeFixedNode(ScrollingTree&, ScrollingNodeID);
 
     void commitStateBeforeChildren(const ScrollingStateNode&) override;
-    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) override;
+    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) override;
 
     void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override;
 

Modified: trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm	2019-02-25 06:03:22 UTC (rev 242031)
@@ -70,12 +70,12 @@
 }
 }
 
-void ScrollingTreeFixedNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta)
+void ScrollingTreeFixedNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
 {
     using namespace ScrollingTreeFixedNodeInternal;
-    FloatPoint layerPosition = m_constraints.layerPositionForViewportRect(fixedPositionRect);
+    FloatPoint layerPosition = m_constraints.layerPositionForViewportRect(layoutViewport);
 
-    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeFixedNode " << scrollingNodeID() << " updateLayersAfterAncestorChange: new viewport " << fixedPositionRect << " viewportRectAtLastLayout " << m_constraints.viewportRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout() << " new offset from top " << (fixedPositionRect.y() - layerPosition.y()));
+    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeFixedNode " << scrollingNodeID() << " updateLayersAfterAncestorChange: new viewport " << layoutViewport << " viewportRectAtLastLayout " << m_constraints.viewportRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout() << " new offset from top " << (layoutViewport.y() - layerPosition.y()));
 
     layerPosition -= cumulativeDelta;
 
@@ -99,7 +99,7 @@
     FloatSize newDelta = layerPosition - m_constraints.layerPositionAtLastLayout() + cumulativeDelta;
 
     for (auto& child : *m_children)
-        child->updateLayersAfterAncestorChange(changedNode, fixedPositionRect, newDelta);
+        child->updateLayersAfterAncestorChange(changedNode, layoutViewport, newDelta);
 }
 
 void ScrollingTreeFixedNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const

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


--- trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -47,7 +47,7 @@
     ScrollingTreeStickyNode(ScrollingTree&, ScrollingNodeID);
 
     void commitStateBeforeChildren(const ScrollingStateNode&) override;
-    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) override;
+    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) override;
 
     void dumpProperties(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const override;
 

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


--- trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm	2019-02-25 06:03:22 UTC (rev 242031)
@@ -72,7 +72,7 @@
 }
 }
 
-void ScrollingTreeStickyNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta)
+void ScrollingTreeStickyNode::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
 {
     using namespace ScrollingTreeStickyNodeInternal;
     bool adjustStickyLayer = false;
@@ -82,11 +82,11 @@
         constrainingRect = FloatRect(downcast<ScrollingTreeOverflowScrollingNode>(*parent()).scrollPosition(), m_constraints.constrainingRectAtLastLayout().size());
         adjustStickyLayer = true;
     } else if (is<ScrollingTreeFrameScrollingNode>(*parent())) {
-        constrainingRect = fixedPositionRect;
+        constrainingRect = layoutViewport;
         adjustStickyLayer = true;
     }
 
-    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeStickyNode " << scrollingNodeID() << " updateLayersAfterAncestorChange: new viewport " << fixedPositionRect << " constrainingRectAtLastLayout " << m_constraints.constrainingRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout() << " adjustStickyLayer " << adjustStickyLayer);
+    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeStickyNode " << scrollingNodeID() << " updateLayersAfterAncestorChange: new viewport " << layoutViewport << " constrainingRectAtLastLayout " << m_constraints.constrainingRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout() << " adjustStickyLayer " << adjustStickyLayer);
 
     FloatSize deltaForDescendants = cumulativeDelta;
 
@@ -105,7 +105,7 @@
         return;
 
     for (auto& child : *m_children)
-        child->updateLayersAfterAncestorChange(changedNode, fixedPositionRect, deltaForDescendants);
+        child->updateLayersAfterAncestorChange(changedNode, layoutViewport, deltaForDescendants);
 }
 
 void ScrollingTreeStickyNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -56,7 +56,7 @@
     FloatPoint scrollPosition() const override;
     void setScrollPosition(const FloatPoint&, ScrollPositionClamp = ScrollPositionClamp::ToContentEdges) override;
 
-    void updateLayersAfterViewportChange(const FloatRect& fixedPositionRect, double scale) override;
+    void updateLayersAfterViewportChange(const FloatRect& layoutViewport, double scale) override;
 
     void setScrollLayerPosition(const FloatPoint&, const FloatRect& layoutViewport) override;
 

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -53,7 +53,7 @@
     void updateLayersAfterViewportChange(const FloatRect&, double) override { }
     void updateLayersAfterDelegatedScroll(const FloatPoint& scrollPosition) override;
 
-    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) override;
+    void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta) override;
 
     ScrollingEventResult handleWheelEvent(const PlatformWheelEvent&) override;
 

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm (242030 => 242031)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm	2019-02-25 06:03:22 UTC (rev 242031)
@@ -93,10 +93,10 @@
 
 
 
-void ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta)
+void ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
 {
     UNUSED_PARAM(changedNode);
-    UNUSED_PARAM(fixedPositionRect);
+    UNUSED_PARAM(layoutViewport);
     UNUSED_PARAM(cumulativeDelta);
 }
 
@@ -116,7 +116,7 @@
     ScrollingTreeOverflowScrollingNode::setScrollPosition(roundedPosition, clamp);
 }
 
-void ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition(const FloatPoint& scrollPosition, const FloatRect& fixedPositionRect)
+void ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition(const FloatPoint& scrollPosition, const FloatRect& layoutViewport)
 {
     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeOverflowScrollingNodeMac::setScrollLayerPosition " << scrollPosition);
 
@@ -125,7 +125,7 @@
         return;
 
     for (auto& child : *m_children)
-        child->updateLayersAfterAncestorChange(*this, fixedPositionRect, { });
+        child->updateLayersAfterAncestorChange(*this, layoutViewport, { });
 }
 
 void ScrollingTreeOverflowScrollingNodeMac::updateLayersAfterDelegatedScroll(const FloatPoint& scrollPosition)

Modified: trunk/Source/WebKit/ChangeLog (242030 => 242031)


--- trunk/Source/WebKit/ChangeLog	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/ChangeLog	2019-02-25 06:03:22 UTC (rev 242031)
@@ -1,3 +1,45 @@
+2019-02-24  Simon Fraser  <[email protected]>
+
+        Migrate from "fixedPositionRect" to "layoutViewport" in the scrolling tree
+        https://bugs.webkit.org/show_bug.cgi?id=194984
+
+        Reviewed by Sam Weinig.
+
+        Rename "fixedPositionRect" to "layoutViewport" in scrolling tree code.
+
+        Remove ScrollingTree::fixedPositionRect() which was only used on iOS, to fetch the
+        current layout viewport rect. Instead, set the layout viewport on the root
+        node in ScrollingTree::mainFrameViewportChangedViaDelegatedScrolling().
+        
+        Add a WK2 Scrolling log channel.
+
+        * Platform/Logging.h:
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
+        (WebKit::RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling):
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
+        (WebKit::RemoteScrollingTree::fixedPositionRect): Deleted.
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
+        * UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
+        (WebKit::RemoteScrollingCoordinatorProxy::currentLayoutViewport const):
+        (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect const): Deleted.
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h:
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
+        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateChildNodesAfterScroll):
+        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange):
+        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange):
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange):
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h:
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm:
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange):
+        (WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll):
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
+
 2019-02-20  Darin Adler  <[email protected]>
 
         Finish removing String::format

Modified: trunk/Source/WebKit/Platform/Logging.h (242030 => 242031)


--- trunk/Source/WebKit/Platform/Logging.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/Platform/Logging.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -75,6 +75,7 @@
     M(Resize) \
     M(ResourceLoadStatistics) \
     M(ResourceLoadStatisticsDebug) \
+    M(Scrolling) \
     M(Selection) \
     M(ServiceWorker) \
     M(SessionState) \

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm	2019-02-25 06:03:22 UTC (rev 242031)
@@ -220,8 +220,8 @@
 #if PLATFORM(IOS_FAMILY)
     if (m_webPageProxy.scrollingCoordinatorProxy()->hasFixedOrSticky()) {
         // If we got a new layer for a fixed or sticky node, its position from the WebProcess is probably stale. We need to re-run the "viewport" changed logic to udpate it with our UI-side state.
-        FloatRect customFixedPositionRect = m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy.unobscuredContentRectRespectingInputViewBounds(), m_webPageProxy.customFixedPositionRect(), m_webPageProxy.displayedContentScale(), FrameView::LayoutViewportConstraint::Unconstrained);
-        m_webPageProxy.scrollingCoordinatorProxy()->viewportChangedViaDelegatedScrolling(m_webPageProxy.scrollingCoordinatorProxy()->rootScrollingNodeID(), customFixedPositionRect, m_webPageProxy.displayedContentScale());
+        FloatRect layoutViewport = m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy.unobscuredContentRectRespectingInputViewBounds(), m_webPageProxy.customFixedPositionRect(), m_webPageProxy.displayedContentScale(), FrameView::LayoutViewportConstraint::Unconstrained);
+        m_webPageProxy.scrollingCoordinatorProxy()->viewportChangedViaDelegatedScrolling(layoutViewport, m_webPageProxy.displayedContentScale());
     }
 #endif
 

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp	2019-02-25 06:03:22 UTC (rev 242031)
@@ -173,9 +173,9 @@
     return m_scrollingTree->eventTrackingTypeForPoint(eventName, p);
 }
 
-void RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const FloatRect& fixedPositionRect, double scale)
+void RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling(const FloatRect& layoutViewport, double scale)
 {
-    m_scrollingTree->viewportChangedViaDelegatedScrolling(nodeID, fixedPositionRect, scale);
+    m_scrollingTree->mainFrameViewportChangedViaDelegatedScrolling(layoutViewport, scale);
 }
 
 void RemoteScrollingCoordinatorProxy::currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID nodeID, unsigned horizontal, unsigned vertical)

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -58,7 +58,7 @@
     WebCore::TrackingType eventTrackingTypeForPoint(const AtomicString& eventName, WebCore::IntPoint) const;
 
     // Called externally when native views move around.
-    void viewportChangedViaDelegatedScrolling(WebCore::ScrollingNodeID, const WebCore::FloatRect& fixedPositionRect, double scale);
+    void viewportChangedViaDelegatedScrolling(const WebCore::FloatRect& layoutViewport, double scale);
 
     void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, unsigned horizontal, unsigned vertical);
 
@@ -83,7 +83,7 @@
     bool hasFixedOrSticky() const { return m_scrollingTree->hasFixedOrSticky(); }
 
 #if PLATFORM(IOS_FAMILY)
-    WebCore::FloatRect customFixedPositionRect() const;
+    WebCore::FloatRect currentLayoutViewport() const;
     void scrollingTreeNodeWillStartPanGesture();
     void scrollingTreeNodeWillStartScroll();
     void scrollingTreeNodeDidEndScroll();

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2019-02-25 06:03:22 UTC (rev 242031)
@@ -78,11 +78,6 @@
 #endif
 
 #if PLATFORM(IOS_FAMILY)
-WebCore::FloatRect RemoteScrollingTree::fixedPositionRect()
-{
-    return m_scrollingCoordinatorProxy.customFixedPositionRect();
-}
-
 void RemoteScrollingTree::scrollingTreeNodeWillStartPanGesture()
 {
     m_scrollingCoordinatorProxy.scrollingTreeNodeWillStartPanGesture();

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -64,7 +64,6 @@
 #endif
 
 #if PLATFORM(IOS_FAMILY)
-    WebCore::FloatRect fixedPositionRect() override;
     void scrollingTreeNodeWillStartPanGesture() override;
     void scrollingTreeNodeWillStartScroll() override;
     void scrollingTreeNodeDidEndScroll() override;

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


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm	2019-02-25 06:03:22 UTC (rev 242031)
@@ -93,7 +93,7 @@
     }
 }
 
-FloatRect RemoteScrollingCoordinatorProxy::customFixedPositionRect() const
+FloatRect RemoteScrollingCoordinatorProxy::currentLayoutViewport() const
 {
     return m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy.unobscuredContentRectRespectingInputViewBounds(), m_webPageProxy.customFixedPositionRect(),
         m_webPageProxy.displayedContentScale(), FrameView::LayoutViewportConstraint::Unconstrained);

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -54,8 +54,8 @@
     void updateChildNodesAfterScroll(const FloatPoint&);
 
     void updateLayersAfterDelegatedScroll(const WebCore::FloatPoint& scrollPosition) override;
-    void updateLayersAfterViewportChange(const WebCore::FloatRect& fixedPositionRect, double scale) override;
-    void updateLayersAfterAncestorChange(const WebCore::ScrollingTreeNode& changedNode, const WebCore::FloatRect& fixedPositionRect, const WebCore::FloatSize& cumulativeDelta) override;
+    void updateLayersAfterViewportChange(const WebCore::FloatRect& layoutViewport, double scale) override;
+    void updateLayersAfterAncestorChange(const WebCore::ScrollingTreeNode& changedNode, const WebCore::FloatRect& layoutViewport, const WebCore::FloatSize& cumulativeDelta) override;
 
     std::unique_ptr<ScrollingTreeScrollingNodeDelegateIOS> m_scrollingNodeDelegate;
 

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm	2019-02-25 06:03:22 UTC (rev 242031)
@@ -169,14 +169,14 @@
         return;
 
 
-    FloatRect fixedPositionRect;
-    if (!parent())
-        fixedPositionRect = scrollingTree().fixedPositionRect();
+    FloatRect layoutViewport;
+    if (isRootNode())
+        layoutViewport = this->layoutViewport();
     else
-        fixedPositionRect = FloatRect(scrollPosition, scrollableAreaSize());
+        layoutViewport = FloatRect(scrollPosition, scrollableAreaSize()); // FIXME: We'll just use layoutViewport() once we correctly update it after a scroll.
 
     for (auto& child : *m_children)
-        child->updateLayersAfterAncestorChange(*this, fixedPositionRect, FloatSize());
+        child->updateLayersAfterAncestorChange(*this, layoutViewport, FloatSize());
 }
 
 void ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterDelegatedScroll(const FloatPoint& scrollPosition)
@@ -189,22 +189,22 @@
     updateChildNodesAfterScroll(scrollPosition);
 }
 
-void ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange(const FloatRect& fixedPositionRect, double /*scale*/)
+void ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterViewportChange(const FloatRect& layoutViewport, double /*scale*/)
 {
     // Note: we never currently have a m_counterScrollingLayer (which is used for background-attachment:fixed) on iOS.
-    [m_counterScrollingLayer setPosition:fixedPositionRect.location()];
+    [m_counterScrollingLayer setPosition:layoutViewport.location()];
 
     if (!m_children)
         return;
 
     for (auto& child : *m_children)
-        child->updateLayersAfterAncestorChange(*this, fixedPositionRect, FloatSize());
+        child->updateLayersAfterAncestorChange(*this, layoutViewport, FloatSize());
 }
 
-void ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta)
+void ScrollingTreeFrameScrollingNodeRemoteIOS::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
 {
     if (m_scrollingNodeDelegate) {
-        m_scrollingNodeDelegate->updateLayersAfterAncestorChange(changedNode, fixedPositionRect, cumulativeDelta);
+        m_scrollingNodeDelegate->updateLayersAfterAncestorChange(changedNode, layoutViewport, cumulativeDelta);
         return;
     }
 
@@ -211,9 +211,9 @@
     if (!m_children)
         return;
 
-    FloatRect currFrameFixedPositionRect(scrollPosition(), scrollableAreaSize()); // FIXME: use up-to-date layout viewport.
+    FloatRect currFrameLayoutViewport(scrollPosition(), scrollableAreaSize()); // FIXME: use layoutViewport() once it's correctly updated.
     for (auto& child : *m_children)
-        child->updateLayersAfterAncestorChange(changedNode, currFrameFixedPositionRect, { });
+        child->updateLayersAfterAncestorChange(changedNode, currFrameLayoutViewport, { });
 }
 
 }

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -51,7 +51,7 @@
     void updateLayersAfterViewportChange(const WebCore::FloatRect& fixedPositionRect, double scale) override { }
     void updateLayersAfterDelegatedScroll(const WebCore::FloatPoint& scrollPosition) override;
 
-    void updateLayersAfterAncestorChange(const WebCore::ScrollingTreeNode& changedNode, const WebCore::FloatRect& fixedPositionRect, const WebCore::FloatSize& cumulativeDelta) override;
+    void updateLayersAfterAncestorChange(const WebCore::ScrollingTreeNode& changedNode, const WebCore::FloatRect& layoutViewport, const WebCore::FloatSize& cumulativeDelta) override;
 
     std::unique_ptr<ScrollingTreeScrollingNodeDelegateIOS> m_scrollingNodeDelegate;
 };

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm	2019-02-25 06:03:22 UTC (rev 242031)
@@ -66,9 +66,9 @@
     m_scrollingNodeDelegate->commitStateAfterChildren(downcast<ScrollingStateScrollingNode>(stateNode));
 }
 
-void ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta)
+void ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
 {
-    m_scrollingNodeDelegate->updateLayersAfterAncestorChange(changedNode, fixedPositionRect, cumulativeDelta);
+    m_scrollingNodeDelegate->updateLayersAfterAncestorChange(changedNode, layoutViewport, cumulativeDelta);
 }
 
 FloatPoint ScrollingTreeOverflowScrollingNodeIOS::scrollPosition() const

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h	2019-02-25 06:03:22 UTC (rev 242031)
@@ -61,7 +61,7 @@
     void resetScrollViewDelegate();
     void commitStateBeforeChildren(const WebCore::ScrollingStateScrollingNode&);
     void commitStateAfterChildren(const WebCore::ScrollingStateScrollingNode&);
-    void updateLayersAfterAncestorChange(const WebCore::ScrollingTreeNode& changedNode, const WebCore::FloatRect& fixedPositionRect, const WebCore::FloatSize& cumulativeDelta);
+    void updateLayersAfterAncestorChange(const WebCore::ScrollingTreeNode& changedNode, const WebCore::FloatRect& layoutViewport, const WebCore::FloatSize& cumulativeDelta);
     WebCore::FloatPoint scrollPosition() const;
     void setScrollLayerPosition(const WebCore::FloatPoint&);
     void updateChildNodesAfterScroll(const WebCore::FloatPoint& scrollPosition);

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm	2019-02-25 06:03:22 UTC (rev 242031)
@@ -269,7 +269,7 @@
     }
 }
 
-void ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta)
+void ScrollingTreeScrollingNodeDelegateIOS::updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& layoutViewport, const FloatSize& cumulativeDelta)
 {
     if (!scrollingNode().children())
         return;
@@ -277,7 +277,7 @@
     FloatSize scrollDelta = lastCommittedScrollPosition() - scrollingNode().scrollPosition();
 
     for (auto& child : *scrollingNode().children())
-        child->updateLayersAfterAncestorChange(changedNode, fixedPositionRect, cumulativeDelta + scrollDelta);
+        child->updateLayersAfterAncestorChange(changedNode, layoutViewport, cumulativeDelta + scrollDelta);
 }
 
 FloatPoint ScrollingTreeScrollingNodeDelegateIOS::scrollPosition() const
@@ -305,16 +305,15 @@
     if (!scrollingNode().children())
         return;
 
-    FloatRect fixedPositionRect;
+    FloatRect layoutViewport;
     auto* frameNode = scrollingNode().enclosingFrameNodeIncludingSelf();
-    if (frameNode && frameNode->nodeType() == ScrollingNodeType::Subframe)
-        fixedPositionRect = frameNode->fixedPositionRect();
-    else
-        fixedPositionRect = scrollingTree().fixedPositionRect();
-    FloatSize scrollDelta = lastCommittedScrollPosition() - scrollPosition;
+    if (frameNode)
+        layoutViewport = frameNode->layoutViewport();
 
+    auto scrollDelta = lastCommittedScrollPosition() - scrollPosition;
+
     for (auto& child : *scrollingNode().children())
-        child->updateLayersAfterAncestorChange(scrollingNode(), fixedPositionRect, scrollDelta);
+        child->updateLayersAfterAncestorChange(scrollingNode(), layoutViewport, scrollDelta);
 }
 
 void ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart() const

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentView.mm (242030 => 242031)


--- trunk/Source/WebKit/UIProcess/ios/WKContentView.mm	2019-02-25 04:47:34 UTC (rev 242030)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentView.mm	2019-02-25 06:03:22 UTC (rev 242031)
@@ -435,12 +435,12 @@
 
     _sizeChangedSinceLastVisibleContentRectUpdate = NO;
 
-    WebCore::FloatRect fixedPositionRect = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), _page->unobscuredContentRectRespectingInputViewBounds(), _page->customFixedPositionRect(), zoomScale, WebCore::FrameView::LayoutViewportConstraint::Unconstrained);
-    scrollingCoordinator->viewportChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), fixedPositionRect, zoomScale);
+    WebCore::FloatRect layoutViewport = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), _page->unobscuredContentRectRespectingInputViewBounds(), _page->customFixedPositionRect(), zoomScale, WebCore::FrameView::LayoutViewportConstraint::Unconstrained);
+    scrollingCoordinator->viewportChangedViaDelegatedScrolling(layoutViewport, zoomScale);
 
     drawingArea->updateDebugIndicator();
     
-    [self updateFixedClippingView:fixedPositionRect];
+    [self updateFixedClippingView:layoutViewport];
 
     if (wasStableState && !isStableState)
         [self _didExitStableState];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to