Changeset 258753 in webkit


Ignore:
Timestamp:
Mar 19, 2020 11:03:34 PM (4 years ago)
Author:
Simon Fraser
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):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r258749 r258753  
     12020-03-19  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Some scroll snapping tests are still flaky
     4        https://bugs.webkit.org/show_bug.cgi?id=165196
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        WheelEventTestMonitor could trigger too early if the main thread was bogged down, delaying
     9        the firing of the m_updateNodeScrollPositionTimer scheduled from
     10        AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll().
     11
     12        Fix by extending the life of the "ScrollingThreadSyncNeeded" reason until after the m_updateNodeScrollPositionTimer
     13        has fired
     14
     15        Fixes flakiness of tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-mainframe-slow-vertical.html
     16        and others.
     17
     18        * page/scrolling/AsyncScrollingCoordinator.cpp:
     19        (WebCore::AsyncScrollingCoordinator::noteScrollingThreadSyncCompleteForNode):
     20        (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
     21        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
     22        * page/scrolling/AsyncScrollingCoordinator.h:
     23        * page/scrolling/ThreadedScrollingTree.cpp:
     24        (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
     25
    1262020-03-19  Peng Liu  <peng.liu6@apple.com>
    227
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r258679 r258753  
    270270}
    271271
     272void AsyncScrollingCoordinator::noteScrollingThreadSyncCompleteForNode(ScrollingNodeID nodeID)
     273{
     274#if PLATFORM(MAC)
     275    if (m_page && m_page->isMonitoringWheelEvents()) {
     276        LOG_WITH_STREAM(WheelEventTestMonitor, stream << "    (!) AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll: Removing deferral on " << nodeID << " for reason " << WheelEventTestMonitor::ScrollingThreadSyncNeeded);
     277        m_page->wheelEventTestMonitor()->removeDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(nodeID), WheelEventTestMonitor::ScrollingThreadSyncNeeded);
     278    }
     279#else
     280    UNUSED_PARAM(nodeID);
     281#endif
     282}
     283
    272284void AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, const Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction scrollingLayerPositionAction)
    273285{
     
    285297        updateScrollPositionAfterAsyncScroll(m_scheduledScrollUpdate.nodeID, m_scheduledScrollUpdate.scrollPosition, m_scheduledScrollUpdate.layoutViewportOrigin, ScrollType::User, m_scheduledScrollUpdate.updateLayerPositionAction);
    286298        updateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, layoutViewportOrigin, ScrollType::User, scrollingLayerPositionAction);
     299       
     300        if (m_scheduledScrollUpdate.nodeID != nodeID)
     301            noteScrollingThreadSyncCompleteForNode(m_scheduledScrollUpdate.nodeID);
     302        noteScrollingThreadSyncCompleteForNode(nodeID);
    287303        return;
    288304    }
     
    295311{
    296312    updateScrollPositionAfterAsyncScroll(m_scheduledScrollUpdate.nodeID, m_scheduledScrollUpdate.scrollPosition, m_scheduledScrollUpdate.layoutViewportOrigin, ScrollType::User, m_scheduledScrollUpdate.updateLayerPositionAction);
     313    noteScrollingThreadSyncCompleteForNode(m_scheduledScrollUpdate.nodeID);
    297314}
    298315
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h

    r258679 r258753  
    142142    void updateEventTrackingRegions();
    143143   
     144    void noteScrollingThreadSyncCompleteForNode(ScrollingNodeID);
     145   
    144146    FrameView* frameViewForScrollingNode(ScrollingNodeID) const;
    145147
  • trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp

    r258679 r258753  
    117117#endif
    118118
    119     RunLoop::main().dispatch([strongThis = makeRef(*this), nodeID = node.scrollingNodeID(), scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction, monitoringWheelEvents] {
     119    RunLoop::main().dispatch([strongThis = makeRef(*this), nodeID = node.scrollingNodeID(), scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction] {
    120120        strongThis->m_scrollingCoordinator->scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction);
    121 #if PLATFORM(MAC)
    122         if (monitoringWheelEvents)
    123             strongThis->removeWheelEventTestCompletionDeferralForReason(reinterpret_cast<WheelEventTestMonitor::ScrollableAreaIdentifier>(nodeID), WheelEventTestMonitor::ScrollingThreadSyncNeeded);
    124 #else
    125         UNUSED_PARAM(monitoringWheelEvents);
    126 #endif
    127121    });
    128122}
Note: See TracChangeset for help on using the changeset viewer.