⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 286719 in webkit


Ignore:
Timestamp:
Dec 8, 2021, 1:25:44 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r286411. rdar://problem/85928816

Scrolling complex websites can stutter: scrolling thread frame can fail to process wheel events
https://bugs.webkit.org/show_bug.cgi?id=233739
rdar://85946176

Reviewed by Tim Horton.

While the scrolling thread is chilling in
ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout(), waiting up to half a
frame to allow the main thread to handle the commit (for scroll synchronization), wheel
events may have been dispatched to the scrolling thread.

If we blow the timeout and commit anyway, we need to make sure we've handled these wheel
events first, so that the current frame can commit some layer movement. We can achieve this
by dispatching the applyLayerPositions(), which will enqueue it behind any waiting wheel
event dispatch from EventDispatcher::internalWheelEvent().

  • page/scrolling/ScrollingTree.cpp: (WebCore::ScrollingTree::applyLayerPositions):
  • page/scrolling/ThreadedScrollingTree.cpp: (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286411 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612.4.2.1-branch/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612.4.2.1-branch/Source/WebCore/ChangeLog

    r286718 r286719  
     12021-12-02  Russell Epstein  <repstein@apple.com>
     2
     3        Cherry-pick r286411. rdar://problem/85928816
     4
     5    Scrolling complex websites can stutter: scrolling thread frame can fail to process wheel events
     6    https://bugs.webkit.org/show_bug.cgi?id=233739
     7    rdar://85946176
     8   
     9    Reviewed by Tim Horton.
     10   
     11    While the scrolling thread is chilling in
     12    ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout(), waiting up to half a
     13    frame to allow the main thread to handle the commit (for scroll synchronization), wheel
     14    events may have been dispatched to the scrolling thread.
     15   
     16    If we blow the timeout and commit anyway, we need to make sure we've handled these wheel
     17    events first, so that the current frame can commit some layer movement. We can achieve this
     18    by dispatching the applyLayerPositions(), which will enqueue it behind any waiting wheel
     19    event dispatch from EventDispatcher::internalWheelEvent().
     20   
     21    * page/scrolling/ScrollingTree.cpp:
     22    (WebCore::ScrollingTree::applyLayerPositions):
     23    * page/scrolling/ThreadedScrollingTree.cpp:
     24    (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout):
     25   
     26    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286411 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     27
     28    2021-12-01  Simon Fraser  <simon.fraser@apple.com>
     29
     30            Scrolling complex websites can stutter: scrolling thread frame can fail to process wheel events
     31            https://bugs.webkit.org/show_bug.cgi?id=233739
     32            rdar://85946176
     33
     34            Reviewed by Tim Horton.
     35
     36            While the scrolling thread is chilling in
     37            ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout(), waiting up to half a
     38            frame to allow the main thread to handle the commit (for scroll synchronization), wheel
     39            events may have been dispatched to the scrolling thread.
     40
     41            If we blow the timeout and commit anyway, we need to make sure we've handled these wheel
     42            events first, so that the current frame can commit some layer movement. We can achieve this
     43            by dispatching the applyLayerPositions(), which will enqueue it behind any waiting wheel
     44            event dispatch from EventDispatcher::internalWheelEvent().
     45
     46            * page/scrolling/ScrollingTree.cpp:
     47            (WebCore::ScrollingTree::applyLayerPositions):
     48            * page/scrolling/ThreadedScrollingTree.cpp:
     49            (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout):
     50
    1512021-12-01  Alan Coon  <alancoon@apple.com>
    252
  • branches/safari-612.4.2.1-branch/Source/WebCore/page/scrolling/ScrollingTree.cpp

    r286718 r286719  
    417417void ScrollingTree::applyLayerPositions()
    418418{
    419     ASSERT(isMainThread());
    420419    Locker locker { m_treeLock };
    421420
  • branches/safari-612.4.2.1-branch/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp

    r286718 r286719  
    338338        // At this point we know the main thread is taking too long in the rendering update,
    339339        // so we give up trying to sync with the main thread and update layers here on the scrolling thread.
    340         if (canUpdateLayersOnScrollingThread())
    341             applyLayerPositionsInternal();
     340        if (canUpdateLayersOnScrollingThread()) {
     341            // Dispatch to allow for the scrolling thread to handle any outstanding wheel events before we commit layers.
     342            ScrollingThread::dispatch([protectedThis = makeRef(*this)]() {
     343                protectedThis->applyLayerPositions();
     344            });
     345        }
    342346        tracePoint(ScrollingThreadRenderUpdateSyncEnd, 1);
    343347    } else
Note: See TracChangeset for help on using the changeset viewer.