Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 78e487f91bd19e10527f2e89d693ee4588f27eb7
      
https://github.com/WebKit/WebKit/commit/78e487f91bd19e10527f2e89d693ee4588f27eb7
  Author: Tim Horton <[email protected]>
  Date:   2026-06-16 (Tue, 16 Jun 2026)

  Changed paths:
    M Source/WebKit/UIProcess/PageClient.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/mac/PageClientImplMac.h
    M Source/WebKit/UIProcess/mac/PageClientImplMac.mm
    M Source/WebKit/UIProcess/mac/WKAppKitGestureController.h
    M Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm
    M Source/WebKit/UIProcess/mac/WebViewImpl.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Source/WebKit/WebProcess/WebPage/EventDispatcher.h
    M Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp
    M Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKitGesturesTests.swift

  Log Message:
  -----------
  [AppKit Gestures] Scrolling, then interrupting, sometimes follows the link 
below the mouse
https://bugs.webkit.org/show_bug.cgi?id=317265
rdar://174849278

Reviewed by Abrar Rahman Protyasha.

Prevent a scroll-interrupting gesture from triggering any other gestures,
including link navigation... except another scroll, of course!

Test: Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKitGesturesTests.swift

* Source/WebKit/UIProcess/PageClient.h:
(WebKit::PageClient::didEndSyntheticMomentumScrolling):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.mm:
(WebKit::RemoteLayerTreeEventDispatcher::didEndSyntheticMomentumScrolling):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didEndSyntheticMomentumScrolling):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/mac/PageClientImplMac.h:
* Source/WebKit/UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::didEndSyntheticMomentumScrolling):
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::didEndSyntheticMomentumScrolling):
* Source/WebKit/WebProcess/WebPage/EventDispatcher.h:
* Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp:
(WebKit::MomentumEventDispatcher::didEndMomentumPhase):
* Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.h:
Plumb the end of MomentumEventGenerator-driven scrolling out to clients (all 
the way to WKAppKitGestureController).

* Source/WebKit/UIProcess/mac/WKAppKitGestureController.h:
* Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm:
(-[WKAppKitGestureController panGestureRecognized:]):

When a pan gesture completes successfully (possibly kicking off momentum),
reset the "caught a momentum scroll" bit, since it necessarily cannot be true 
at that point.

(-[WKAppKitGestureController singleClickGestureRecognized:]):
If this gesture is downstream of one that interrupted momentum, ignore it.

(-[WKAppKitGestureController sendWheelEventForGesture:]):
Zero the delta for the first pan event after an interruption, to avoid a hop.
Future events will have deltas starting from the interruption point.
This matches the behavior of the native scroller.

(-[WKAppKitGestureController interruptMomentumIfNeeded]):
Now that we keep better track of whether momentum is actually active, we can
set a bit (or two!) if it is active when we interrupt, and use that to drive
all the other parts of this patch.

(-[WKAppKitGestureController didEndSyntheticMomentumScrolling]):
(-[WKAppKitGestureController _resetCaughtDeceleratingScroll]):
(-[WKAppKitGestureController reset]):
(-[WKAppKitGestureController gestureRecognizerShouldBegin:]):
Disallow all of our other gestures from starting if we interrupted scrolling.
We allow single click, which will fire and reset the interruption state,
and we let pan use its normal logic to determine whether or not to recognize.
All other gestures are blocked.

* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKitGesturesTests.swift:
(AppKitGesturesTests.interruptingDeceleratingScrollDoesNotFollowLink):
Add a test for this behavior!

Canonical link: https://commits.webkit.org/315351@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to