Title: [275790] trunk/Source/WebCore
Revision
275790
Author
[email protected]
Date
2021-04-09 19:11:02 -0700 (Fri, 09 Apr 2021)

Log Message

scrollingTreeNodeDidScroll() should just trigger a rendering udpate
https://bugs.webkit.org/show_bug.cgi?id=224394

Reviewed by Tim Horton.

After handling wheel events on the scrolling thread,
ThreadedScrollingTree::scrollingTreeNodeDidScroll() appends to a queue of pending updates
and then triggers applyPendingScrollUpdates() on the main thread to process those updates.
However, every rendering update also processes pending scroll updates via
synchronizeStateFromScrollingTree(), so it's simpler if we just trigger a rendering update.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::scrollingThreadAddedPendingUpdate):
(WebCore::AsyncScrollingCoordinator::scheduleRenderingUpdate):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
* page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp:
(WebCore::ScrollingCoordinatorNicosia::scheduleTreeStateCommit):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (275789 => 275790)


--- trunk/Source/WebCore/ChangeLog	2021-04-10 01:55:26 UTC (rev 275789)
+++ trunk/Source/WebCore/ChangeLog	2021-04-10 02:11:02 UTC (rev 275790)
@@ -1,3 +1,27 @@
+2021-04-09  Simon Fraser  <[email protected]>
+
+        scrollingTreeNodeDidScroll() should just trigger a rendering udpate
+        https://bugs.webkit.org/show_bug.cgi?id=224394
+
+        Reviewed by Tim Horton.
+
+        After handling wheel events on the scrolling thread,
+        ThreadedScrollingTree::scrollingTreeNodeDidScroll() appends to a queue of pending updates
+        and then triggers applyPendingScrollUpdates() on the main thread to process those updates.
+        However, every rendering update also processes pending scroll updates via
+        synchronizeStateFromScrollingTree(), so it's simpler if we just trigger a rendering update.
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::scrollingThreadAddedPendingUpdate):
+        (WebCore::AsyncScrollingCoordinator::scheduleRenderingUpdate):
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
+        * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp:
+        (WebCore::ScrollingCoordinatorNicosia::scheduleTreeStateCommit):
+
 2021-04-09  Jean-Yves Avenard  <[email protected]>
 
         Media Session action should default to the MediaElement's default when no MediaSession handler are set

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (275789 => 275790)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2021-04-10 01:55:26 UTC (rev 275789)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2021-04-10 02:11:02 UTC (rev 275790)
@@ -69,6 +69,11 @@
     scheduleTreeStateCommit();
 }
 
+void AsyncScrollingCoordinator::scrollingThreadAddedPendingUpdate()
+{
+    scheduleRenderingUpdate();
+}
+
 #if PLATFORM(COCOA)
 void AsyncScrollingCoordinator::handleWheelEventPhase(ScrollingNodeID nodeID, PlatformWheelEventPhase phase)
 {
@@ -305,6 +310,11 @@
     }
 }
 
+void AsyncScrollingCoordinator::scheduleRenderingUpdate()
+{
+    m_page->scheduleRenderingUpdate(RenderingUpdateStep::ScrollingTreeUpdate);
+}
+
 FrameView* AsyncScrollingCoordinator::frameViewForScrollingNode(ScrollingNodeID scrollingNodeID) const
 {
     if (!m_scrollingStateTree->rootStateNode())

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (275789 => 275790)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2021-04-10 01:55:26 UTC (rev 275789)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2021-04-10 02:11:02 UTC (rev 275790)
@@ -50,6 +50,7 @@
     ScrollingTree* scrollingTree() const { return m_scrollingTree.get(); }
 
     void scrollingStateTreePropertiesChanged();
+    void scrollingThreadAddedPendingUpdate();
 
     void applyPendingScrollUpdates();
 
@@ -87,6 +88,7 @@
     WEBCORE_EXPORT String scrollingTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const override;
     WEBCORE_EXPORT void willCommitTree() override;
     void synchronizeStateFromScrollingTree();
+    void scheduleRenderingUpdate();
 
     bool eventTrackingRegionsDirty() const { return m_eventTrackingRegionsDirty; }
 

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (275789 => 275790)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2021-04-10 01:55:26 UTC (rev 275789)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2021-04-10 02:11:02 UTC (rev 275790)
@@ -210,7 +210,7 @@
         return;
     }
 
-    LOG_WITH_STREAM(Scrolling, stream << "ThreadedScrollingTree::scrollingTreeNodeDidScroll " << node.scrollingNodeID() << " to " << scrollPosition << " bouncing to main thread");
+    LOG_WITH_STREAM(Scrolling, stream << "ThreadedScrollingTree::scrollingTreeNodeDidScroll " << node.scrollingNodeID() << " to " << scrollPosition << " triggering main thread rendering update");
 
     auto scrollUpdate = ScrollUpdate { node.scrollingNodeID(), scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction };
     addPendingScrollUpdate(WTFMove(scrollUpdate));
@@ -218,7 +218,7 @@
     auto deferrer = WheelEventTestMonitorCompletionDeferrer { wheelEventTestMonitor(), reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(node.scrollingNodeID()), WheelEventTestMonitor::ScrollingThreadSyncNeeded };
     RunLoop::main().dispatch([strongThis = makeRef(*this), deferrer = WTFMove(deferrer)] {
         if (auto* scrollingCoordinator = strongThis->m_scrollingCoordinator.get())
-            scrollingCoordinator->applyPendingScrollUpdates();
+            scrollingCoordinator->scrollingThreadAddedPendingUpdate();
     });
 }
 

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm (275789 => 275790)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2021-04-10 01:55:26 UTC (rev 275789)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2021-04-10 02:11:02 UTC (rev 275790)
@@ -102,8 +102,7 @@
 
 void ScrollingCoordinatorMac::scheduleTreeStateCommit()
 {
-    // FIXME: This one needs work.
-    m_page->scheduleRenderingUpdate(RenderingUpdateStep::ScrollingTreeUpdate);
+    scheduleRenderingUpdate();
 }
 
 void ScrollingCoordinatorMac::commitTreeStateIfNeeded()

Modified: trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp (275789 => 275790)


--- trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp	2021-04-10 01:55:26 UTC (rev 275789)
+++ trunk/Source/WebCore/page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp	2021-04-10 02:11:02 UTC (rev 275790)
@@ -89,6 +89,7 @@
 
 void ScrollingCoordinatorNicosia::scheduleTreeStateCommit()
 {
+    // FIXME: This should probably just call scheduleRenderingUpdate().
     if (!m_scrollingStateTreeCommitterTimer.isActive())
         m_scrollingStateTreeCommitterTimer.startOneShot(0_s);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to