Title: [287739] trunk/Source/WebCore
Revision
287739
Author
[email protected]
Date
2022-01-06 20:56:41 -0800 (Thu, 06 Jan 2022)

Log Message

Ensure that the scrolling thread always commits layer position changes to reduce scrolling stutters (v2)
https://bugs.webkit.org/show_bug.cgi?id=234937

Reviewed by Tim Horton.

Refine the logic added in r286932, which tries to ensure that the scrolling thread commits a
layer position change in cases where the main thread is also in the middle of a commit.

The condition used in r286932 forced a layer position change if the scroll position had
changed from the scroll position at the last display refresh. Tracing shows that this isn't
always correct, so, instead, use ThreadedScrollingTree's "desynchronized" state as the
signal to force a position change. We can thus remove the code related to maintaining
scrollPositionAtLastDisplayRefresh.

However, towards the end of a momentum scroll, when there isn't an event on every display
refresh, this caused too many forced commits. So make two changes to reduce the frequency of
going into the desynchronized state here:

1. Not every display refresh triggers a rendering update. So tell ThreadedScrollingTree, via
   RenderingUpdateScheduler, Page and ScrollingCoordinatorMac if a rendering update was scheduled.
   ThreadedScrollingTree::displayDidRefreshOnScrollingThread() uses this knowledge to avoid
   scheduling the delayed rendering update detection timer.

2. Not every rendering update results in a CA commit, yet the code assumed this. Fix by having
   ScrollingTreeMac::didCompleteRenderingUpdate() check to see if a CA transaction is active.
   This stops waitForRenderingUpdateCompletionOrTimeout() waiting for a signal that never
   comes and thus timing out.

* page/Page.cpp:
(WebCore::Page::scheduledRenderingUpdate):
* page/Page.h:
* page/RenderingUpdateScheduler.cpp:
(WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::scheduledRenderingUpdate):
* page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::isScrollingTreeMac const):
(WebCore::ScrollingTree::WTF_REQUIRES_LOCK):
* page/scrolling/ScrollingTreeScrollingNode.cpp:
(WebCore::ScrollingTreeScrollingNode::updateScrollPositionAtLastDisplayRefresh): Deleted.
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::scheduledRenderingUpdate):
(WebCore::ThreadedScrollingTree::willStartRenderingUpdate):
(WebCore::ThreadedScrollingTree::didCompleteRenderingUpdate):
(WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread):
(WebCore::ThreadedScrollingTree::isScrollingSynchronizedWithMainThread):
(WebCore::ThreadedScrollingTree::didCompletePlatformRenderingUpdate): Deleted.
(WebCore::ThreadedScrollingTree::storeScrollPositionsAtLastDisplayRefresh): Deleted.
* page/scrolling/ThreadedScrollingTree.h:
(WebCore::ThreadedScrollingTree::WTF_GUARDED_BY_LOCK):
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::scheduledRenderingUpdate):
(WebCore::ScrollingCoordinatorMac::didCompletePlatformRenderingUpdate):
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
* page/scrolling/mac/ScrollingTreeMac.h:
* page/scrolling/mac/ScrollingTreeMac.mm:
(ScrollingTreeMac::didCompleteRenderingUpdate):
(ScrollingTreeMac::didCompletePlatformRenderingUpdate):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (287738 => 287739)


--- trunk/Source/WebCore/ChangeLog	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/ChangeLog	2022-01-07 04:56:41 UTC (rev 287739)
@@ -1,3 +1,67 @@
+2022-01-06  Simon Fraser  <[email protected]>
+
+        Ensure that the scrolling thread always commits layer position changes to reduce scrolling stutters (v2)
+        https://bugs.webkit.org/show_bug.cgi?id=234937
+
+        Reviewed by Tim Horton.
+
+        Refine the logic added in r286932, which tries to ensure that the scrolling thread commits a
+        layer position change in cases where the main thread is also in the middle of a commit.
+
+        The condition used in r286932 forced a layer position change if the scroll position had
+        changed from the scroll position at the last display refresh. Tracing shows that this isn't
+        always correct, so, instead, use ThreadedScrollingTree's "desynchronized" state as the
+        signal to force a position change. We can thus remove the code related to maintaining
+        scrollPositionAtLastDisplayRefresh.
+
+        However, towards the end of a momentum scroll, when there isn't an event on every display
+        refresh, this caused too many forced commits. So make two changes to reduce the frequency of
+        going into the desynchronized state here:
+        
+        1. Not every display refresh triggers a rendering update. So tell ThreadedScrollingTree, via
+           RenderingUpdateScheduler, Page and ScrollingCoordinatorMac if a rendering update was scheduled.
+           ThreadedScrollingTree::displayDidRefreshOnScrollingThread() uses this knowledge to avoid
+           scheduling the delayed rendering update detection timer.
+
+        2. Not every rendering update results in a CA commit, yet the code assumed this. Fix by having
+           ScrollingTreeMac::didCompleteRenderingUpdate() check to see if a CA transaction is active.
+           This stops waitForRenderingUpdateCompletionOrTimeout() waiting for a signal that never
+           comes and thus timing out.
+
+        * page/Page.cpp:
+        (WebCore::Page::scheduledRenderingUpdate):
+        * page/Page.h:
+        * page/RenderingUpdateScheduler.cpp:
+        (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::scheduledRenderingUpdate):
+        * page/scrolling/ScrollingTree.h:
+        (WebCore::ScrollingTree::isScrollingTreeMac const):
+        (WebCore::ScrollingTree::WTF_REQUIRES_LOCK):
+        * page/scrolling/ScrollingTreeScrollingNode.cpp:
+        (WebCore::ScrollingTreeScrollingNode::updateScrollPositionAtLastDisplayRefresh): Deleted.
+        * page/scrolling/ScrollingTreeScrollingNode.h:
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::scheduledRenderingUpdate):
+        (WebCore::ThreadedScrollingTree::willStartRenderingUpdate):
+        (WebCore::ThreadedScrollingTree::didCompleteRenderingUpdate):
+        (WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread):
+        (WebCore::ThreadedScrollingTree::isScrollingSynchronizedWithMainThread):
+        (WebCore::ThreadedScrollingTree::didCompletePlatformRenderingUpdate): Deleted.
+        (WebCore::ThreadedScrollingTree::storeScrollPositionsAtLastDisplayRefresh): Deleted.
+        * page/scrolling/ThreadedScrollingTree.h:
+        (WebCore::ThreadedScrollingTree::WTF_GUARDED_BY_LOCK):
+        * page/scrolling/mac/ScrollingCoordinatorMac.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        (WebCore::ScrollingCoordinatorMac::scheduledRenderingUpdate):
+        (WebCore::ScrollingCoordinatorMac::didCompletePlatformRenderingUpdate):
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
+        * page/scrolling/mac/ScrollingTreeMac.h:
+        * page/scrolling/mac/ScrollingTreeMac.mm:
+        (ScrollingTreeMac::didCompleteRenderingUpdate):
+        (ScrollingTreeMac::didCompletePlatformRenderingUpdate):
+
 2022-01-06  Tim Horton  <[email protected]>
 
         Move linkedOnOrAfter() to WTF

Modified: trunk/Source/WebCore/page/Page.cpp (287738 => 287739)


--- trunk/Source/WebCore/page/Page.cpp	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/Page.cpp	2022-01-07 04:56:41 UTC (rev 287739)
@@ -1503,6 +1503,14 @@
     renderingUpdateScheduler().scheduleRenderingUpdate();
 }
 
+void Page::didScheduleRenderingUpdate()
+{
+#if ENABLE(ASYNC_SCROLLING)
+    if (auto* scrollingCoordinator = this->scrollingCoordinator())
+        scrollingCoordinator->didScheduleRenderingUpdate();
+#endif
+}
+
 void Page::computeUnfulfilledRenderingSteps(OptionSet<RenderingUpdateStep> requestedSteps)
 {
     // m_renderingUpdateRemainingSteps only has more than one entry for the re-entrant rendering update triggered by testing.

Modified: trunk/Source/WebCore/page/Page.h (287738 => 287739)


--- trunk/Source/WebCore/page/Page.h	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/Page.h	2022-01-07 04:56:41 UTC (rev 287739)
@@ -611,6 +611,7 @@
 
     // Schedule a rendering update that coordinates with display refresh.
     WEBCORE_EXPORT void scheduleRenderingUpdate(OptionSet<RenderingUpdateStep> requestedSteps);
+    void didScheduleRenderingUpdate();
     // Trigger a rendering update in the current runloop. Only used for testing.
     void triggerRenderingUpdateForTesting();
 

Modified: trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp (287738 => 287739)


--- trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/RenderingUpdateScheduler.cpp	2022-01-07 04:56:41 UTC (rev 287739)
@@ -84,6 +84,8 @@
         LOG_WITH_STREAM(DisplayLink, stream << "RenderingUpdateScheduler::scheduleRenderingUpdate for interval " << m_page.preferredRenderingUpdateInterval() << " falling back to timer");
         startTimer(m_page.preferredRenderingUpdateInterval());
     }
+    
+    m_page.didScheduleRenderingUpdate();
 }
 
 bool RenderingUpdateScheduler::isScheduled() const

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (287738 => 287739)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2022-01-07 04:56:41 UTC (rev 287739)
@@ -101,6 +101,7 @@
     // Traverses the scrolling tree, setting layer positions to represent the current scrolled state.
     virtual void applyScrollingTreeLayerPositions() { }
 
+    virtual void didScheduleRenderingUpdate() { }
     virtual void willStartRenderingUpdate() { }
     virtual void didCompleteRenderingUpdate() { }
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (287738 => 287739)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2022-01-07 04:56:41 UTC (rev 287739)
@@ -87,6 +87,7 @@
     WEBCORE_EXPORT virtual ~ScrollingTree();
 
     virtual bool isThreadedScrollingTree() const { return false; }
+    virtual bool isScrollingTreeMac() const { return false; }
     virtual bool isRemoteScrollingTree() const { return false; }
     virtual bool isScrollingTreeIOS() const { return false; }
 
@@ -220,6 +221,8 @@
     virtual void lockLayersForHitTesting() { }
     virtual void unlockLayersForHitTesting() { }
 
+    virtual bool isScrollingSynchronizedWithMainThread() WTF_REQUIRES_LOCK(m_treeLock) { return true; }
+
     virtual void willSendEventToMainThread(const PlatformWheelEvent&) { }
     virtual void waitForEventToBeProcessedByMainThread(const PlatformWheelEvent&) { };
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (287738 => 287739)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2022-01-07 04:56:41 UTC (rev 287739)
@@ -303,11 +303,6 @@
     scrollingTree().scrollingTreeNodeDidScroll(*this, action);
 }
 
-void ScrollingTreeScrollingNode::updateScrollPositionAtLastDisplayRefresh()
-{
-    m_scrollPositionAtLastDisplayRefresh = m_currentScrollPosition;
-}
-
 bool ScrollingTreeScrollingNode::scrollPositionAndLayoutViewportMatch(const FloatPoint& position, std::optional<FloatRect>)
 {
     return position == m_currentScrollPosition;

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (287738 => 287739)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2022-01-07 04:56:41 UTC (rev 287739)
@@ -141,9 +141,6 @@
 
     virtual void repositionScrollingLayers() { }
     virtual void repositionRelatedLayers() { }
-    
-    void updateScrollPositionAtLastDisplayRefresh();
-    std::optional<FloatPoint> scrollPositionAtLastDisplayRefresh() { return m_scrollPositionAtLastDisplayRefresh; };
 
     void applyLayerPositions() override;
 
@@ -177,7 +174,6 @@
     std::optional<unsigned> m_currentHorizontalSnapPointIndex;
     std::optional<unsigned> m_currentVerticalSnapPointIndex;
     ScrollableAreaParameters m_scrollableAreaParameters;
-    std::optional<FloatPoint> m_scrollPositionAtLastDisplayRefresh;
 #if ENABLE(SCROLLING_THREAD)
     OptionSet<SynchronousScrollingReason> m_synchronousScrollingReasons;
 #endif

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (287738 => 287739)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2022-01-07 04:56:41 UTC (rev 287739)
@@ -334,10 +334,17 @@
     return hasProcessedWheelEventsRecently() || hasNodeWithActiveScrollAnimations();
 }
 
+void ThreadedScrollingTree::didScheduleRenderingUpdate()
+{
+    m_renderingUpdateWasScheduled = true;
+}
+
 void ThreadedScrollingTree::willStartRenderingUpdate()
 {
     ASSERT(isMainThread());
 
+    m_renderingUpdateWasScheduled = false;
+
     if (!scrollingThreadIsActive())
         return;
 
@@ -430,17 +437,9 @@
 
 void ThreadedScrollingTree::didCompleteRenderingUpdate()
 {
-    // macOS needs to wait for the CA commit (the "platform rendering update").
-#if !PLATFORM(MAC)
     renderingUpdateComplete();
-#endif
 }
 
-void ThreadedScrollingTree::didCompletePlatformRenderingUpdate()
-{
-    renderingUpdateComplete();
-}
-
 void ThreadedScrollingTree::renderingUpdateComplete()
 {
     ASSERT(isMainThread());
@@ -490,9 +489,11 @@
 
     switch (m_state) {
     case SynchronizationState::Idle: {
-        m_state = SynchronizationState::WaitingForRenderingUpdate;
-        constexpr auto maxStartRenderingUpdateDelay = 1_ms;
-        scheduleDelayedRenderingUpdateDetectionTimer(maxStartRenderingUpdateDelay);
+        if (m_renderingUpdateWasScheduled) {
+            m_state = SynchronizationState::WaitingForRenderingUpdate;
+            constexpr auto maxStartRenderingUpdateDelay = 1_ms;
+            scheduleDelayedRenderingUpdateDetectionTimer(maxStartRenderingUpdateDelay);
+        }
         break;
     }
     case SynchronizationState::WaitingForRenderingUpdate:
@@ -500,8 +501,6 @@
     case SynchronizationState::Desynchronized:
         break;
     }
-    
-    storeScrollPositionsAtLastDisplayRefresh();
 }
 
 void ThreadedScrollingTree::displayDidRefresh(PlatformDisplayID displayID)
@@ -527,12 +526,9 @@
     m_nodesWithPendingScrollAnimations.remove(nodeID);
 }
 
-void ThreadedScrollingTree::storeScrollPositionsAtLastDisplayRefresh()
+bool ThreadedScrollingTree::isScrollingSynchronizedWithMainThread()
 {
-    // Ideally this would be a tree walk for every scrolling node, but scrolling trees can get big so for now just do this for the root;
-    // ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers() uses the state to know whether it should force a commit.
-    if (auto* rootNode = this->rootNode())
-        rootNode->updateScrollPositionAtLastDisplayRefresh();
+    return m_state != SynchronizationState::Desynchronized;
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h (287738 => 287739)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2022-01-07 04:56:41 UTC (rev 287739)
@@ -58,11 +58,10 @@
 
     WEBCORE_EXPORT void displayDidRefresh(PlatformDisplayID);
 
+    void didScheduleRenderingUpdate();
     void willStartRenderingUpdate();
-    void didCompleteRenderingUpdate();
+    virtual void didCompleteRenderingUpdate();
 
-    void didCompletePlatformRenderingUpdate();
-
     Lock& treeLock() WTF_RETURNS_LOCK(m_treeLock) { return m_treeLock; }
 
     bool scrollAnimatorEnabled() const { return m_scrollAnimatorEnabled; }
@@ -84,6 +83,8 @@
     void currentSnapPointIndicesDidChange(ScrollingNodeID, std::optional<unsigned> horizontal, std::optional<unsigned> vertical) override;
 #endif
 
+    void renderingUpdateComplete();
+
     void reportExposedUnfilledArea(MonotonicTime, unsigned unfilledArea) override;
     void reportSynchronousScrollingReasonsChanged(MonotonicTime, OptionSet<SynchronousScrollingReason>) override;
 
@@ -98,7 +99,6 @@
 
     void displayDidRefreshOnScrollingThread();
     void waitForRenderingUpdateCompletionOrTimeout() WTF_REQUIRES_LOCK(m_treeLock);
-    void renderingUpdateComplete();
 
     bool canUpdateLayersOnScrollingThread() const WTF_REQUIRES_LOCK(m_treeLock);
 
@@ -107,7 +107,7 @@
 
     void hasNodeWithAnimatedScrollChanged(bool) final;
     
-    void storeScrollPositionsAtLastDisplayRefresh() WTF_REQUIRES_LOCK(m_treeLock);
+    bool isScrollingSynchronizedWithMainThread() final WTF_REQUIRES_LOCK(m_treeLock);
 
     void serviceScrollAnimations(MonotonicTime) WTF_REQUIRES_LOCK(m_treeLock);
 
@@ -137,6 +137,7 @@
     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 };
+    std::atomic<bool> m_renderingUpdateWasScheduled;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h (287738 => 287739)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2022-01-07 04:56:41 UTC (rev 287739)
@@ -50,6 +50,7 @@
 private:
     void scheduleTreeStateCommit() final;
 
+    void didScheduleRenderingUpdate() final;
     void willStartRenderingUpdate() final;
     void didCompleteRenderingUpdate() final;
 

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2022-01-07 04:56:41 UTC (rev 287739)
@@ -123,6 +123,12 @@
     updateTiledScrollingIndicator();
 }
 
+void ScrollingCoordinatorMac::didScheduleRenderingUpdate()
+{
+    RefPtr<ThreadedScrollingTree> threadedScrollingTree = downcast<ThreadedScrollingTree>(scrollingTree());
+    threadedScrollingTree->didScheduleRenderingUpdate();
+}
+
 void ScrollingCoordinatorMac::willStartRenderingUpdate()
 {
     RefPtr<ThreadedScrollingTree> threadedScrollingTree = downcast<ThreadedScrollingTree>(scrollingTree());
@@ -150,7 +156,7 @@
 
 void ScrollingCoordinatorMac::didCompletePlatformRenderingUpdate()
 {
-    downcast<ThreadedScrollingTree>(scrollingTree())->didCompletePlatformRenderingUpdate();
+    downcast<ScrollingTreeMac>(scrollingTree())->didCompletePlatformRenderingUpdate();
     PlatformCALayerContentsDelayedReleaser::singleton().mainThreadCommitDidEnd();
 }
 

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm	2022-01-07 04:56:41 UTC (rev 287739)
@@ -182,7 +182,7 @@
         // The main thread may already have set the same layer position, but here we need to trigger a scrolling thread commit to
         // ensure that the scroll happens even when the main thread commit is taking a long time. So make sure the layer property changes
         // when there has been a scroll position change.
-        if (scrollPositionAtLastDisplayRefresh() && scrollPositionAtLastDisplayRefresh().value() != currentScrollPosition())
+        if (!scrollingTree().isScrollingSynchronizedWithMainThread())
             layer.position = CGPointZero;
     }
 

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.h (287738 => 287739)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.h	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.h	2022-01-07 04:56:41 UTC (rev 287739)
@@ -37,8 +37,12 @@
 public:
     static Ref<ScrollingTreeMac> create(AsyncScrollingCoordinator&);
 
+    void didCompletePlatformRenderingUpdate();
+
 private:
     explicit ScrollingTreeMac(AsyncScrollingCoordinator&);
+    
+    bool isScrollingTreeMac() const final { return true; }
 
     Ref<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) final;
 
@@ -61,6 +65,8 @@
     void lockLayersForHitTesting() final WTF_ACQUIRES_LOCK(m_layerHitTestMutex);
     void unlockLayersForHitTesting() final WTF_RELEASES_LOCK(m_layerHitTestMutex);
 
+    void didCompleteRenderingUpdate() final;
+
     // This lock protects the CALayer/PlatformCALayer tree.
     mutable Lock m_layerHitTestMutex;
     
@@ -69,4 +75,6 @@
 
 } // namespace WebCore
 
+SPECIALIZE_TYPE_TRAITS_SCROLLING_TREE(WebCore::ScrollingTreeMac, isScrollingTreeMac())
+
 #endif // ENABLE(ASYNC_SCROLLING) && ENABLE(SCROLLING_THREAD)

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm (287738 => 287739)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm	2022-01-07 04:54:03 UTC (rev 287738)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm	2022-01-07 04:56:41 UTC (rev 287739)
@@ -242,6 +242,18 @@
     m_layerHitTestMutex.unlock();
 }
 
+void ScrollingTreeMac::didCompleteRenderingUpdate()
+{
+    bool hasActiveCATransaction = [CATransaction currentState];
+    if (!hasActiveCATransaction)
+        renderingUpdateComplete();
+}
+
+void ScrollingTreeMac::didCompletePlatformRenderingUpdate()
+{
+    renderingUpdateComplete();
+}
+
 void ScrollingTreeMac::applyLayerPositionsInternal()
 {
     if (ScrollingThread::isCurrentThread())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to