Title: [283849] trunk/Source
Revision
283849
Author
[email protected]
Date
2021-10-08 16:10:17 -0700 (Fri, 08 Oct 2021)

Log Message

Ensure that animated scrolls will run on the scrolling thread
https://bugs.webkit.org/show_bug.cgi?id=231441

Reviewed by Tim Horton.

On macOS, scrolling tree commits run on the main thread (holding a lock), so we can't start
scroll animations directly inside the commit because then they will run on the main thread.

Fix by adding ScrollingTree::didCommitTree(), and having ThreadedScrollingTree override it
to bounce to the scrolling tree to start animations. We also have to intercept requested scroll
position updates via ScrollingTree::scrollingTreeNodeRequestsScroll(); ThreadedScrollingTree
uses this to put pending animations into m_nodesWithPendingScrollAnimations.

Now that ScrollingTreeScrollingNode::commitStateAfterChildren() responds to
RequestedScrollPosition changes by calling handleScrollPositionRequest(), we can remove code
in derived classes that did the same thing.

Not yet tested because animated scrolls don't yet get to the scrolling tree.

Source/WebCore:

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::commitTreeState):
* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::scrollingTreeNodeRequestsScroll):
(WebCore::ScrollingTree::didCommitTree):
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
(WebCore::ScrollingTreeScrollingNode::handleScrollPositionRequest):
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::didCommitTree):
(WebCore::ThreadedScrollingTree::didCommitTreeOnScrollingThread):
(WebCore::ThreadedScrollingTree::scrollingTreeNodeRequestsScroll):
* page/scrolling/ThreadedScrollingTree.h:
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
(WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren): Deleted.

Source/WebKit:

* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
* UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
* UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
(WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (283848 => 283849)


--- trunk/Source/WebCore/ChangeLog	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebCore/ChangeLog	2021-10-08 23:10:17 UTC (rev 283849)
@@ -1,3 +1,44 @@
+2021-10-08  Simon Fraser  <[email protected]>
+
+        Ensure that animated scrolls will run on the scrolling thread
+        https://bugs.webkit.org/show_bug.cgi?id=231441
+
+        Reviewed by Tim Horton.
+
+        On macOS, scrolling tree commits run on the main thread (holding a lock), so we can't start
+        scroll animations directly inside the commit because then they will run on the main thread.
+
+        Fix by adding ScrollingTree::didCommitTree(), and having ThreadedScrollingTree override it
+        to bounce to the scrolling tree to start animations. We also have to intercept requested scroll
+        position updates via ScrollingTree::scrollingTreeNodeRequestsScroll(); ThreadedScrollingTree
+        uses this to put pending animations into m_nodesWithPendingScrollAnimations.
+
+        Now that ScrollingTreeScrollingNode::commitStateAfterChildren() responds to
+        RequestedScrollPosition changes by calling handleScrollPositionRequest(), we can remove code
+        in derived classes that did the same thing.
+
+        Not yet tested because animated scrolls don't yet get to the scrolling tree.
+
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::commitTreeState):
+        * page/scrolling/ScrollingTree.h:
+        (WebCore::ScrollingTree::scrollingTreeNodeRequestsScroll):
+        (WebCore::ScrollingTree::didCommitTree):
+        * page/scrolling/ScrollingTreeScrollingNode.cpp:
+        (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
+        (WebCore::ScrollingTreeScrollingNode::handleScrollPositionRequest):
+        * page/scrolling/ScrollingTreeScrollingNode.h:
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::didCommitTree):
+        (WebCore::ThreadedScrollingTree::didCommitTreeOnScrollingThread):
+        (WebCore::ThreadedScrollingTree::scrollingTreeNodeRequestsScroll):
+        * page/scrolling/ThreadedScrollingTree.h:
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
+        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren): Deleted.
+
 2021-10-08  Wenson Hsieh  <[email protected]>
 
         Split DisplayList::Recorder into an abstract base class and a concrete implementation

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (283848 => 283849)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2021-10-08 23:10:17 UTC (rev 283849)
@@ -320,6 +320,8 @@
         if (auto node = m_nodeMap.take(nodeID))
             node->willBeDestroyed();
     }
+    
+    didCommitTree();
 
     LOG_WITH_STREAM(ScrollingTree, stream << "committed ScrollingTree" << scrollingTreeAsText(ScrollingStateTreeAsTextBehaviorDebug));
 }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (283848 => 283849)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2021-10-08 23:10:17 UTC (rev 283849)
@@ -114,7 +114,7 @@
     void setNodeScrollSnapInProgress(ScrollingNodeID, bool);
 
     virtual void invalidate() { }
-    WEBCORE_EXPORT virtual void commitTreeState(std::unique_ptr<ScrollingStateTree>&&);
+    WEBCORE_EXPORT void commitTreeState(std::unique_ptr<ScrollingStateTree>&&);
     
     WEBCORE_EXPORT virtual void applyLayerPositions();
     WEBCORE_EXPORT void applyLayerPositionsAfterCommit();
@@ -131,8 +131,8 @@
     virtual void scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode&, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) = 0;
     virtual void scrollingTreeNodeDidStopAnimatedScroll(ScrollingTreeScrollingNode&) { }
 
-    // Called for requested scroll position updates.
-    virtual void scrollingTreeNodeRequestsScroll(ScrollingNodeID, const FloatPoint& /*scrollPosition*/, ScrollType, ScrollClamping) { }
+    // Called for requested scroll position updates. Returns true if handled.
+    virtual bool scrollingTreeNodeRequestsScroll(ScrollingNodeID, const RequestedScrollData&) { return false; }
 
     // Delegated scrolling/zooming has caused the viewport to change, so update viewport-constrained layers
     WEBCORE_EXPORT void mainFrameViewportChangedViaDelegatedScrolling(const FloatPoint& scrollPosition, const WebCore::FloatRect& layoutViewport, double scale);
@@ -251,6 +251,8 @@
     void applyLayerPositionsRecursive(ScrollingTreeNode&) WTF_REQUIRES_LOCK(m_treeLock);
     void notifyRelatedNodesRecursive(ScrollingTreeNode&);
     void traverseScrollingTreeRecursive(ScrollingTreeNode&, const VisitorFunction&) WTF_REQUIRES_LOCK(m_treeLock);
+    
+    virtual void didCommitTree() { }
 
     WEBCORE_EXPORT virtual RefPtr<ScrollingTreeNode> scrollingNodeForPoint(FloatPoint);
 #if ENABLE(WHEEL_EVENT_REGIONS)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (283848 => 283849)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2021-10-08 23:10:17 UTC (rev 283849)
@@ -101,10 +101,8 @@
 void ScrollingTreeScrollingNode::commitStateAfterChildren(const ScrollingStateNode& stateNode)
 {
     const ScrollingStateScrollingNode& scrollingStateNode = downcast<ScrollingStateScrollingNode>(stateNode);
-    if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition)) {
-        const auto& requestedScrollData = scrollingStateNode.requestedScrollData();
-        scrollingTree().scrollingTreeNodeRequestsScroll(scrollingNodeID(), requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
-    }
+    if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition))
+        handleScrollPositionRequest(scrollingStateNode.requestedScrollData());
 
     // This synthetic bit is added back in ScrollingTree::propagateSynchronousScrollingReasons().
 #if ENABLE(SCROLLING_THREAD)
@@ -238,12 +236,10 @@
     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeScrollingNode " << scrollingNodeID() << " handleScrollPositionRequest() - position " << requestedScrollData.scrollPosition << " animated " << (requestedScrollData.animated == ScrollIsAnimated::Yes));
 
     stopAnimatedScroll();
-    
-    if (requestedScrollData.animated == ScrollIsAnimated::Yes) {
-        if (startAnimatedScrollToPosition(requestedScrollData.scrollPosition))
-            return;
-    }
 
+    if (scrollingTree().scrollingTreeNodeRequestsScroll(scrollingNodeID(), requestedScrollData))
+        return;
+
     scrollTo(requestedScrollData.scrollPosition, requestedScrollData.scrollType, requestedScrollData.clamping);
 }
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (283848 => 283849)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2021-10-08 23:10:17 UTC (rev 283849)
@@ -48,6 +48,7 @@
     friend class ScrollingTreeScrollingNodeDelegateNicosia;
 #endif
     friend class ScrollingTree;
+    friend class ThreadedScrollingTree;
 
 public:
     virtual ~ScrollingTreeScrollingNode();

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (283848 => 283849)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2021-10-08 23:10:17 UTC (rev 283849)
@@ -152,6 +152,39 @@
     });
 }
 
+void ThreadedScrollingTree::didCommitTree()
+{
+    ScrollingThread::dispatch([protectedThis = Ref { *this }]() {
+        Locker treeLocker { protectedThis->m_treeLock };
+        protectedThis->didCommitTreeOnScrollingThread();
+    });
+}
+
+void ThreadedScrollingTree::didCommitTreeOnScrollingThread()
+{
+    ASSERT(ScrollingThread::isCurrentThread());
+
+    auto nodesWithPendingScrollAnimations = std::exchange(m_nodesWithPendingScrollAnimations, { });
+    for (const auto& it : nodesWithPendingScrollAnimations) {
+        RefPtr targetNode = nodeForID(it.key);
+        if (!is<ScrollingTreeScrollingNode>(targetNode))
+            continue;
+
+        downcast<ScrollingTreeScrollingNode>(*targetNode).startAnimatedScrollToPosition(it.value.scrollPosition);
+    }
+
+    m_nodesWithPendingScrollAnimations.clear();
+}
+
+bool ThreadedScrollingTree::scrollingTreeNodeRequestsScroll(ScrollingNodeID nodeID, const RequestedScrollData& request)
+{
+    if (request.animated == ScrollIsAnimated::Yes) {
+        m_nodesWithPendingScrollAnimations.add(nodeID, request);
+        return true;
+    }
+    return false;
+}
+
 void ThreadedScrollingTree::propagateSynchronousScrollingReasons(const HashSet<ScrollingNodeID>& synchronousScrollingNodes)
 {
     auto propagateStateToAncestors = [&](ScrollingTreeNode& node) {

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h (283848 => 283849)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2021-10-08 23:10:17 UTC (rev 283849)
@@ -27,6 +27,7 @@
 
 #if ENABLE(ASYNC_SCROLLING) && ENABLE(SCROLLING_THREAD)
 
+#include "ScrollingStateScrollingNode.h"
 #include "ScrollingStateTree.h"
 #include "ScrollingTree.h"
 #include <wtf/Condition.h>
@@ -69,6 +70,7 @@
 
     void scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode&, ScrollingLayerPositionAction = ScrollingLayerPositionAction::Sync) override;
     void scrollingTreeNodeDidStopAnimatedScroll(ScrollingTreeScrollingNode&) override;
+    bool scrollingTreeNodeRequestsScroll(ScrollingNodeID, const RequestedScrollData&) override WTF_REQUIRES_LOCK(m_treeLock);
 
 #if PLATFORM(MAC)
     void handleWheelEventPhase(ScrollingNodeID, PlatformWheelEventPhase) override;
@@ -88,6 +90,9 @@
     bool isThreadedScrollingTree() const override { return true; }
     void propagateSynchronousScrollingReasons(const HashSet<ScrollingNodeID>&) WTF_REQUIRES_LOCK(m_treeLock) override;
 
+    void didCommitTree() final;
+    void didCommitTreeOnScrollingThread() WTF_REQUIRES_LOCK(m_treeLock);
+
     void displayDidRefreshOnScrollingThread();
     void waitForRenderingUpdateCompletionOrTimeout() WTF_REQUIRES_LOCK(m_treeLock);
 
@@ -114,6 +119,7 @@
     // Dynamically allocated because it has to use the ScrollingThread's runloop.
     std::unique_ptr<RunLoop::Timer<ThreadedScrollingTree>> m_delayedRenderingUpdateDetectionTimer WTF_GUARDED_BY_LOCK(m_treeLock);
 
+    HashMap<ScrollingNodeID, RequestedScrollData> m_nodesWithPendingScrollAnimations WTF_GUARDED_BY_LOCK(m_treeLock);
     const bool m_scrollAnimatorEnabled { false };
     bool m_hasNodesWithSynchronousScrollingReasons WTF_GUARDED_BY_LOCK(m_treeLock) { false };
 };

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm (283848 => 283849)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2021-10-08 23:10:17 UTC (rev 283849)
@@ -103,11 +103,6 @@
     ScrollingTreeFrameScrollingNode::commitStateAfterChildren(stateNode);
 
     const auto& scrollingStateNode = downcast<ScrollingStateScrollingNode>(stateNode);
-
-    // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
-    if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition))
-        handleScrollPositionRequest(scrollingStateNode.requestedScrollData());
-
     if (isRootNode()
         && (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::ScrolledContentsLayer)
         || scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::TotalContentsSize)

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h	2021-10-08 23:10:17 UTC (rev 283849)
@@ -43,7 +43,6 @@
     ScrollingTreeOverflowScrollingNodeMac(ScrollingTree&, ScrollingNodeID);
 
     void commitStateBeforeChildren(const ScrollingStateNode&) override;
-    void commitStateAfterChildren(const ScrollingStateNode&) override;
     
     FloatPoint adjustedScrollPosition(const FloatPoint&, ScrollClamping) const override;
 

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm	2021-10-08 23:10:17 UTC (rev 283849)
@@ -61,16 +61,6 @@
     m_delegate.updateFromStateNode(downcast<ScrollingStateOverflowScrollingNode>(stateNode));
 }
 
-void ScrollingTreeOverflowScrollingNodeMac::commitStateAfterChildren(const ScrollingStateNode& stateNode)
-{
-    ScrollingTreeOverflowScrollingNode::commitStateAfterChildren(stateNode);
-
-    const auto& overflowStateNode = downcast<ScrollingStateOverflowScrollingNode>(stateNode);
-
-    if (overflowStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition))
-        handleScrollPositionRequest(overflowStateNode.requestedScrollData());
-}
-
 WheelEventHandlingResult ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting)
 {
 #if ENABLE(SCROLLING_THREAD)

Modified: trunk/Source/WebKit/ChangeLog (283848 => 283849)


--- trunk/Source/WebKit/ChangeLog	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebKit/ChangeLog	2021-10-08 23:10:17 UTC (rev 283849)
@@ -1,3 +1,33 @@
+2021-10-08  Simon Fraser  <[email protected]>
+
+        Ensure that animated scrolls will run on the scrolling thread
+        https://bugs.webkit.org/show_bug.cgi?id=231441
+
+        Reviewed by Tim Horton.
+
+        On macOS, scrolling tree commits run on the main thread (holding a lock), so we can't start
+        scroll animations directly inside the commit because then they will run on the main thread.
+
+        Fix by adding ScrollingTree::didCommitTree(), and having ThreadedScrollingTree override it
+        to bounce to the scrolling tree to start animations. We also have to intercept requested scroll
+        position updates via ScrollingTree::scrollingTreeNodeRequestsScroll(); ThreadedScrollingTree
+        uses this to put pending animations into m_nodesWithPendingScrollAnimations.
+
+        Now that ScrollingTreeScrollingNode::commitStateAfterChildren() responds to
+        RequestedScrollPosition changes by calling handleScrollPositionRequest(), we can remove code
+        in derived classes that did the same thing.
+
+        Not yet tested because animated scrolls don't yet get to the scrolling tree.
+
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
+        (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll):
+        * UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
+        (WebKit::RemoteScrollingTree::scrollingTreeNodeRequestsScroll):
+        * UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
+        * UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm:
+        (WebKit::ScrollingTreeFrameScrollingNodeRemoteIOS::commitStateAfterChildren):
+
 2021-10-08  Wenson Hsieh  <[email protected]>
 
         Split DisplayList::Recorder into an abstract base class and a concrete implementation

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp (283848 => 283849)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp	2021-10-08 23:10:17 UTC (rev 283849)
@@ -241,13 +241,17 @@
     m_webPageProxy.send(Messages::RemoteScrollingCoordinator::AnimatedScrollDidEndForNode(scrolledNodeID));
 }
 
-void RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& scrollPosition, ScrollType scrollType, ScrollClamping)
+bool RemoteScrollingCoordinatorProxy::scrollingTreeNodeRequestsScroll(ScrollingNodeID scrolledNodeID, const FloatPoint& scrollPosition, ScrollType scrollType, ScrollClamping)
 {
     if (scrolledNodeID == rootScrollingNodeID() && m_requestedScrollInfo) {
+        // FIXME: Handle animated scrolls.
         m_requestedScrollInfo->requestsScrollPositionUpdate = true;
         m_requestedScrollInfo->requestIsProgrammaticScroll = scrollType == ScrollType::Programmatic;
         m_requestedScrollInfo->requestedScrollPosition = scrollPosition;
+        return true;
     }
+    
+    return false;
 }
 
 String RemoteScrollingCoordinatorProxy::scrollingTreeAsText() const

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h (283848 => 283849)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h	2021-10-08 23:10:17 UTC (rev 283849)
@@ -59,7 +59,7 @@
 
     // Inform the web process that the scroll position changed (called from the scrolling tree)
     void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition, const std::optional<WebCore::FloatPoint>& layoutViewportOrigin, WebCore::ScrollingLayerPositionAction);
-    void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::ScrollType, WebCore::ScrollClamping);
+    bool scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::ScrollType, WebCore::ScrollClamping);
     void scrollingTreeNodeDidStopAnimatedScroll(WebCore::ScrollingNodeID);
 
     WebCore::TrackingType eventTrackingTypeForPoint(const AtomString& eventName, WebCore::IntPoint) const;

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp (283848 => 283849)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp	2021-10-08 23:10:17 UTC (rev 283849)
@@ -99,9 +99,9 @@
     m_scrollingCoordinatorProxy.scrollingTreeNodeDidStopAnimatedScroll(node.scrollingNodeID());
 }
 
-void RemoteScrollingTree::scrollingTreeNodeRequestsScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, ScrollType scrollType, ScrollClamping clamping)
+bool RemoteScrollingTree::scrollingTreeNodeRequestsScroll(ScrollingNodeID nodeID, const RequestedScrollData& request)
 {
-    m_scrollingCoordinatorProxy.scrollingTreeNodeRequestsScroll(nodeID, scrollPosition, scrollType, clamping);
+    return m_scrollingCoordinatorProxy.scrollingTreeNodeRequestsScroll(nodeID, request.scrollPosition, request.scrollType, request.clamping);
 }
 
 Ref<ScrollingTreeNode> RemoteScrollingTree::createScrollingTreeNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h (283848 => 283849)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h	2021-10-08 23:10:17 UTC (rev 283849)
@@ -52,7 +52,7 @@
 
     void scrollingTreeNodeDidScroll(WebCore::ScrollingTreeScrollingNode&, WebCore::ScrollingLayerPositionAction = WebCore::ScrollingLayerPositionAction::Sync) final;
     void scrollingTreeNodeDidStopAnimatedScroll(WebCore::ScrollingTreeScrollingNode&) final;
-    void scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::ScrollType, WebCore::ScrollClamping) final;
+    bool scrollingTreeNodeRequestsScroll(WebCore::ScrollingNodeID, const WebCore::RequestedScrollData&) final;
 
     void currentSnapPointIndicesDidChange(WebCore::ScrollingNodeID, std::optional<unsigned> horizontal, std::optional<unsigned> vertical) final;
 

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


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm	2021-10-08 23:09:40 UTC (rev 283848)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeFrameScrollingNodeRemoteIOS.mm	2021-10-08 23:10:17 UTC (rev 283849)
@@ -87,15 +87,8 @@
     ScrollingTreeFrameScrollingNode::commitStateAfterChildren(stateNode);
 
     const auto& scrollingStateNode = downcast<ScrollingStateFrameScrollingNode>(stateNode);
-
-    if (m_scrollingNodeDelegate) {
+    if (m_scrollingNodeDelegate)
         m_scrollingNodeDelegate->commitStateAfterChildren(scrollingStateNode);
-        return;
-    }
-
-    // Update the scroll position after child nodes have been updated, because they need to have updated their constraints before any scrolling happens.
-    if (scrollingStateNode.hasChangedProperty(ScrollingStateNode::Property::RequestedScrollPosition))
-        handleScrollPositionRequest(scrollingStateNode.requestedScrollData());
 }
 
 FloatPoint ScrollingTreeFrameScrollingNodeRemoteIOS::minimumScrollPosition() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to