Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: f52fe75ad080437a7e5705f3ae3632797d537818 https://github.com/WebKit/WebKit/commit/f52fe75ad080437a7e5705f3ae3632797d537818 Author: Richard Robinson <richard_robins...@apple.com> Date: 2023-06-28 (Wed, 28 Jun 2023)
Changed paths: A LayoutTests/fast/scrolling/mac/keyboard-scroll-after-wheel-event-cancel-expected.txt A LayoutTests/fast/scrolling/mac/keyboard-scroll-after-wheel-event-cancel.html M Source/WebCore/page/scrolling/ScrollingTree.h M Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingUIState.cpp M Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingUIState.h M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.h M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm Log Message: ----------- REGRESSION: Space bar for page down works intermittently https://bugs.webkit.org/show_bug.cgi?id=258434 rdar://109638580 Reviewed by Simon Fraser. Keyboard scrolls do not begin if a user scroll is "in progress". This uncovered a bug with normal scrolling, which is that after performing a trackpad scroll with momentum, then tapping with two fingers, the `isUserScrollInProgress` bool was still `true`, even though at this point the scroll has stopped and so it should be `false`. When performing the scroll with momentum, the following sequence of wheel events phases happen: 1. Begin -> `isUserScrollInProgress = true` 2. End -> `isUserScrollInProgress = false` 3. Momentum Begin -> `isUserScrollInProgress = true` 4. Momentum End -> `isUserScrollInProgress = false` Then, when tapping with two fingers, these wheel event phases happen: 5. May Begin -> `isUserScrollInProgress = true` 6. Cancelled -> No action. The root problem is that when receiving a wheel event whose phase is "Cancelled", `isUserScrollInProgress` is not being set to `false`. This is because in `RemoteScrollingCoordinator`, the `m_nodesWithActiveUserScrolls` set does not get cleared when cancelling, which is what `isUserScrollInProgress` depends upon. This set comes from the state in `RemoteScrollingUIState`. For wheel events that have a phase that isn't "Cancelled", `ScrollingTree::setUserScrollInProgressForNode` gets called, and `m_treeState.nodesWithActiveUserScrolls` has nodes either added or removed. Then, `RemoteScrollingCoordinatorProxyMac::scrollingTreeNode{WillStart,DidEnd}Scroll` gets called, which updates the state of `RemoteScrollingUIState` and sends an update. However, for "Cancelled" wheel events, `ScrollingTree::clearNodesWithUserScrollInProgress` gets called, which clears `m_treeState.nodesWithActiveUserScrolls`, but does *not* update the corresponding state of `RemoteScrollingUIState` or send an update, so `m_nodesWithActiveUserScrolls` still has the stale nodes. To fix, just update the `RemoteScrollingUIState` state when clearing nodes like we do when adding or removing them. * LayoutTests/fast/scrolling/mac/keyboard-scroll-after-wheel-event-cancel-expected.txt: Added. * LayoutTests/fast/scrolling/mac/keyboard-scroll-after-wheel-event-cancel.html: Added. * Source/WebCore/page/scrolling/ScrollingTree.h: * Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingUIState.cpp: (WebKit::RemoteScrollingUIState::clearNodesWithActiveUserScroll): * Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingUIState.h: * Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h: (WebKit::RemoteScrollingCoordinatorProxy::clearNodesWithUserScrollInProgress): * Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: (WebKit::RemoteScrollingTree::clearNodesWithUserScrollInProgress): * Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h: * Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h: * Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm: (WebKit::RemoteScrollingCoordinatorProxyMac::clearNodesWithUserScrollInProgress): * Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.h: * Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm: (WebKit::RemoteScrollingTreeMac::clearNodesWithUserScrollInProgress): Canonical link: https://commits.webkit.org/265602@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes