Bug 250653 - Scrolling can stutter when the main thread is causing jank
Summary: Scrolling can stutter when the main thread is causing jank
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: https://codepen.io/bramus/pen/LYBLeYv
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-01-15 12:26 PST by Simon Fraser (smfr)
Modified: 2023-01-15 13:49 PST (History)
4 users (show)

See Also:


Attachments
Test (4.64 KB, text/html)
2023-01-15 12:28 PST, Simon Fraser (smfr)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2023-01-15 12:26:51 PST
Even though we have off-main-thread scrolling, some kinds of main thread jank still cause scroll stutters.

See https://twitter.com/bramus/status/1614606416932741121
Comment 1 Radar WebKit Bug Importer 2023-01-15 12:27:10 PST
<rdar://problem/104280648>
Comment 2 Simon Fraser (smfr) 2023-01-15 12:28:03 PST
Created attachment 464509 [details]
Test
Comment 3 Simon Fraser (smfr) 2023-01-15 12:39:23 PST
We get into a state where ThreadedScrollingTree::m_state is Idle, but the main thread is blocked. Noting is triggering the m_delayedRenderingUpdateDetectionTimer in this case.
Comment 4 Simon Fraser (smfr) 2023-01-15 12:52:50 PST
The interesting thing about this test case is that the jank is pure JS; nothing is touching the DOM, so nothing triggers `ThreadedScrollingTree::didScheduleRenderingUpdate` which sets some state that allows the scrolling thread to take over scrolling.
Comment 5 Simon Fraser (smfr) 2023-01-15 12:56:20 PST
Specifically, m_renderingUpdateWasScheduled is false in ThreadedScrollingTree::displayDidRefreshOnScrollingThread() so we don't trigger the unresponsive main thread detection.