Title: [258753] trunk/Source/WebCore
Revision
258753
Author
[email protected]
Date
2020-03-19 23:03:34 -0700 (Thu, 19 Mar 2020)

Log Message

Some scroll snapping tests are still flaky
https://bugs.webkit.org/show_bug.cgi?id=165196

Reviewed by Wenson Hsieh.

WheelEventTestMonitor could trigger too early if the main thread was bogged down, delaying
the firing of the m_updateNodeScrollPositionTimer scheduled from
AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll().

Fix by extending the life of the "ScrollingThreadSyncNeeded" reason until after the m_updateNodeScrollPositionTimer
has fired

Fixes flakiness of tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html
and others.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::noteScrollingThreadSyncCompleteForNode):
(WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (258752 => 258753)


--- trunk/Source/WebCore/ChangeLog	2020-03-20 05:06:59 UTC (rev 258752)
+++ trunk/Source/WebCore/ChangeLog	2020-03-20 06:03:34 UTC (rev 258753)
@@ -1,3 +1,28 @@
+2020-03-19  Simon Fraser  <[email protected]>
+
+        Some scroll snapping tests are still flaky
+        https://bugs.webkit.org/show_bug.cgi?id=165196
+
+        Reviewed by Wenson Hsieh.
+
+        WheelEventTestMonitor could trigger too early if the main thread was bogged down, delaying
+        the firing of the m_updateNodeScrollPositionTimer scheduled from
+        AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll().
+
+        Fix by extending the life of the "ScrollingThreadSyncNeeded" reason until after the m_updateNodeScrollPositionTimer
+        has fired
+
+        Fixes flakiness of tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html
+        and others.
+
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::noteScrollingThreadSyncCompleteForNode):
+        (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
+        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
+
 2020-03-19  Peng Liu  <[email protected]>
 
         Safari video gravity changes performance improvements

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (258752 => 258753)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2020-03-20 05:06:59 UTC (rev 258752)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2020-03-20 06:03:34 UTC (rev 258753)
@@ -269,6 +269,18 @@
     m_scrollingTree->applyLayerPositions();
 }
 
+void AsyncScrollingCoordinator::noteScrollingThreadSyncCompleteForNode(ScrollingNodeID nodeID)
+{
+#if PLATFORM(MAC)
+    if (m_page && m_page->isMonitoringWheelEvents()) {
+        LOG_WITH_STREAM(WheelEventTestMonitor, stream << "    (!) AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll: Removing deferral on " << nodeID << " for reason " << WheelEventTestMonitor::ScrollingThreadSyncNeeded);
+        m_page->wheelEventTestMonitor()->removeDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(nodeID), WheelEventTestMonitor::ScrollingThreadSyncNeeded);
+    }
+#else
+    UNUSED_PARAM(nodeID);
+#endif
+}
+
 void AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction)
 {
     ScheduledScrollUpdate scrollUpdate(nodeID, scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction);
@@ -284,6 +296,10 @@
         m_updateNodeScrollPositionTimer.stop();
         updateScrollPositionAfterAsyncScroll(m_scheduledScrollUpdate.nodeID, m_scheduledScrollUpdate.scrollPosition, m_scheduledScrollUpdate.layoutViewportOrigin, ScrollType::User, m_scheduledScrollUpdate.updateLayerPositionAction);
         updateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, layoutViewportOrigin, ScrollType::User, scrollingLayerPositionAction);
+        
+        if (m_scheduledScrollUpdate.nodeID != nodeID)
+            noteScrollingThreadSyncCompleteForNode(m_scheduledScrollUpdate.nodeID);
+        noteScrollingThreadSyncCompleteForNode(nodeID);
         return;
     }
 
@@ -294,6 +310,7 @@
 void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired()
 {
     updateScrollPositionAfterAsyncScroll(m_scheduledScrollUpdate.nodeID, m_scheduledScrollUpdate.scrollPosition, m_scheduledScrollUpdate.layoutViewportOrigin, ScrollType::User, m_scheduledScrollUpdate.updateLayerPositionAction);
+    noteScrollingThreadSyncCompleteForNode(m_scheduledScrollUpdate.nodeID);
 }
 
 FrameView* AsyncScrollingCoordinator::frameViewForScrollingNode(ScrollingNodeID scrollingNodeID) const

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (258752 => 258753)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2020-03-20 05:06:59 UTC (rev 258752)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2020-03-20 06:03:34 UTC (rev 258753)
@@ -141,6 +141,8 @@
     void setEventTrackingRegionsDirty();
     void updateEventTrackingRegions();
     
+    void noteScrollingThreadSyncCompleteForNode(ScrollingNodeID);
+    
     FrameView* frameViewForScrollingNode(ScrollingNodeID) const;
 
     Timer m_updateNodeScrollPositionTimer;

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (258752 => 258753)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2020-03-20 05:06:59 UTC (rev 258752)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2020-03-20 06:03:34 UTC (rev 258753)
@@ -116,14 +116,8 @@
         deferWheelEventTestCompletionForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(node.scrollingNodeID()), WheelEventTestMonitor::ScrollingThreadSyncNeeded);
 #endif
 
-    RunLoop::main().dispatch([strongThis = makeRef(*this), nodeID = node.scrollingNodeID(), scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction, monitoringWheelEvents] {
+    RunLoop::main().dispatch([strongThis = makeRef(*this), nodeID = node.scrollingNodeID(), scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction] {
         strongThis->m_scrollingCoordinator->scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction);
-#if PLATFORM(MAC)
-        if (monitoringWheelEvents)
-            strongThis->removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(nodeID), WheelEventTestMonitor::ScrollingThreadSyncNeeded);
-#else
-        UNUSED_PARAM(monitoringWheelEvents);
-#endif
     });
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to