Changeset 262094 in webkit
- Timestamp:
- May 22, 2020 9:23:48 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r262093 r262094 1 2020-05-22 Simon Fraser <simon.fraser@apple.com> 2 3 Stuttery overflow scrolling in slow-scrolling regions (facebook messenger, feedly.com) 4 https://bugs.webkit.org/show_bug.cgi?id=212291 5 <rdar://problem/61940624> 6 7 Reviewed by Tim Horton. 8 9 Now that we do scrolling tree commits on the main thread, ThreadedScrollingTree::scrollingTreeNodeDidScroll() 10 can be called on the main thread. In this case, don't do an RunLoop::main().dispatch() which introduces 11 asynchrony; just call into the ScrollingCoordinator synchronously. 12 13 Do some minor refactoring to move noteScrollingThreadSyncCompleteForNode() into updateScrollPositionAfterAsyncScroll(). 14 15 Hard to test because it involves scrolling thread/main thread interactions. 16 17 * page/scrolling/AsyncScrollingCoordinator.cpp: 18 (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate): 19 (WebCore::AsyncScrollingCoordinator::synchronizeStateFromScrollingTree): 20 (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): 21 (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired): 22 (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): 23 * page/scrolling/AsyncScrollingCoordinator.h: 24 * page/scrolling/ThreadedScrollingTree.cpp: 25 (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll): 26 1 27 2020-05-22 Zalan Bujtas <zalan@apple.com> 2 28 -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r261985 r262094 265 265 bool inProgrammaticScroll = scrollableArea.currentScrollType() == ScrollType::Programmatic; 266 266 if (inProgrammaticScroll || inBackForwardCache) 267 updateScrollPositionAfterAsyncScroll(scrollingNodeID, scrollPosition, { }, ScrollType::Programmatic, ScrollingLayerPositionAction::Set );267 updateScrollPositionAfterAsyncScroll(scrollingNodeID, scrollPosition, { }, ScrollType::Programmatic, ScrollingLayerPositionAction::Set, InformWheelEventMonitor::No); 268 268 269 269 ASSERT(inProgrammaticScroll == (scrollType == ScrollType::Programmatic)); … … 300 300 if (scrollPosition && scrolledSinceLastCommit) { 301 301 LOG_WITH_STREAM(Scrolling, stream << "AsyncScrollingCoordinator::synchronizeStateFromScrollingTree - node " << nodeID << " scroll position " << scrollPosition); 302 updateScrollPositionAfterAsyncScroll(nodeID, scrollPosition.value(), layoutViewportOrigin, ScrollType::User, ScrollingLayerPositionAction::Set );302 updateScrollPositionAfterAsyncScroll(nodeID, scrollPosition.value(), layoutViewportOrigin, ScrollType::User, ScrollingLayerPositionAction::Set, InformWheelEventMonitor::No); 303 303 } 304 304 }); … … 332 332 updateScrollPositionAfterAsyncScroll(m_scheduledScrollUpdate.nodeID, m_scheduledScrollUpdate.scrollPosition, m_scheduledScrollUpdate.layoutViewportOrigin, ScrollType::User, m_scheduledScrollUpdate.updateLayerPositionAction); 333 333 updateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, layoutViewportOrigin, ScrollType::User, scrollingLayerPositionAction); 334 335 if (m_scheduledScrollUpdate.nodeID != nodeID)336 noteScrollingThreadSyncCompleteForNode(m_scheduledScrollUpdate.nodeID);337 noteScrollingThreadSyncCompleteForNode(nodeID);338 334 return; 339 335 } … … 346 342 { 347 343 updateScrollPositionAfterAsyncScroll(m_scheduledScrollUpdate.nodeID, m_scheduledScrollUpdate.scrollPosition, m_scheduledScrollUpdate.layoutViewportOrigin, ScrollType::User, m_scheduledScrollUpdate.updateLayerPositionAction); 348 noteScrollingThreadSyncCompleteForNode(m_scheduledScrollUpdate.nodeID);349 344 } 350 345 … … 381 376 } 382 377 383 void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, Optional<FloatPoint> layoutViewportOrigin, ScrollType scrollType, ScrollingLayerPositionAction scrollingLayerPositionAction )378 void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, Optional<FloatPoint> layoutViewportOrigin, ScrollType scrollType, ScrollingLayerPositionAction scrollingLayerPositionAction, InformWheelEventMonitor informWheelEventMonitor) 384 379 { 385 380 ASSERT(isMainThread()); 381 382 if (informWheelEventMonitor == InformWheelEventMonitor::Yes) 383 noteScrollingThreadSyncCompleteForNode(scrollingNodeID); 386 384 387 385 if (!m_page) -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
r261985 r262094 54 54 WEBCORE_EXPORT void scheduleUpdateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, const Optional<FloatPoint>& layoutViewportOrigin, ScrollingLayerPositionAction); 55 55 56 enum class InformWheelEventMonitor { Yes, No }; 57 void updateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, Optional<FloatPoint> layoutViewportOrigin, ScrollType, ScrollingLayerPositionAction, InformWheelEventMonitor = InformWheelEventMonitor::Yes); 58 56 59 #if PLATFORM(COCOA) 57 60 WEBCORE_EXPORT void handleWheelEventPhase(ScrollingNodeID, PlatformWheelEventPhase) final; … … 77 80 78 81 RefPtr<ScrollingTree> releaseScrollingTree() { return WTFMove(m_scrollingTree); } 79 80 void updateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, Optional<FloatPoint> layoutViewportOrigin, ScrollType, ScrollingLayerPositionAction);81 82 82 83 WEBCORE_EXPORT String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const override; -
trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp
r262046 r262094 149 149 LOG_WITH_STREAM(Scrolling, stream << "ThreadedScrollingTree::scrollingTreeNodeDidScroll " << node.scrollingNodeID() << " to " << scrollPosition << " bouncing to main thread"); 150 150 151 if (RunLoop::isMain()) { 152 m_scrollingCoordinator->updateScrollPositionAfterAsyncScroll(node.scrollingNodeID(), scrollPosition, layoutViewportOrigin, ScrollType::User, scrollingLayerPositionAction); 153 return; 154 } 155 151 156 RunLoop::main().dispatch([strongThis = makeRef(*this), nodeID = node.scrollingNodeID(), scrollPosition, layoutViewportOrigin, scrollingLayerPositionAction] { 152 157 if (auto* scrollingCoordinator = strongThis->m_scrollingCoordinator.get())
Note: See TracChangeset
for help on using the changeset viewer.