Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0bde437173a5e888be34b3f95515b307fdee9a09
      
https://github.com/WebKit/WebKit/commit/0bde437173a5e888be34b3f95515b307fdee9a09
  Author: Richard Robinson <[email protected]>
  Date:   2026-07-27 (Mon, 27 Jul 2026)

  Changed paths:
    M Source/WebCore/page/mac/WheelEventDeltaFilterMac.mm
    M Source/WebCore/platform/mac/ScrollingEffectsController.mm
    M Source/WebKit/PlatformMac.cmake
    M Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm
    A Source/WebKit/UIProcess/mac/WKDirectionalScrollLockTracker.swift
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/BasicAppKitGesturesTests.swift

  Log Message:
  -----------
  [AppKit Gestures] Support directional scroll locking for diagonal scrolls
https://bugs.webkit.org/show_bug.cgi?id=320222
rdar://181047541

Reviewed by Abrar Rahman Protyasha.

Add a custom directional scroll locking algorithm instead of the existing 
predominant
axis filter, which has no tolerance band.

A future PR will refactor and unify this logic along with the fast scroll 
tracker with WKPanGestureRecognizer.

Test: Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/BasicAppKitGesturesTests.swift

* Source/WebCore/page/mac/WheelEventDeltaFilterMac.mm:
(WebCore::WheelEventDeltaFilterMac::updateCurrentVelocityFromEvent):
* Source/WebCore/platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::handleWheelEvent):

Opt-out of the existing mechanism when needed, since 
WKDirectionalScrollLockTracker now takes care of it.

* Source/WebKit/PlatformMac.cmake:
* Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm:
(-[WKAppKitGestureController initWithPage:viewImpl:]):
(-[WKAppKitGestureController panGestureRecognized:]):
(-[WKAppKitGestureController sendWheelEventForGesture:]):
(-[WKAppKitGestureController startMomentumIfNeededForGesture:]):
(-[WKAppKitGestureController interruptMomentumIfNeeded]):
(-[WKAppKitGestureController reset]):

Set-up the tracker within WKAppKitGestureController like the existing fast 
scroll tracker.

* Source/WebKit/UIProcess/mac/WKDirectionalScrollLockTracker.swift: Added.
(WKDirectionalScrollLockTracker.lockedAxis):
(WKDirectionalScrollLockTracker.lastLockedAxis):
(WKDirectionalScrollLockTracker.lastEventTime):
(WKDirectionalScrollLockTracker.uncommittedTranslation):
(WKDirectionalScrollLockTracker.update(delta:canScrollHorizontally:canScrollVertically:time:)):
(WKDirectionalScrollLockTracker.filterVelocity(_:)):
(WKDirectionalScrollLockTracker.didStartGesture):
(WKDirectionalScrollLockTracker.didEndGesture):
(WKDirectionalScrollLockTracker.didCatchMomentum):
(WKDirectionalScrollLockTracker.reset):
(WKDirectionalScrollLockTracker.apply(_:to:)):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

Add another scroll tracker whose state mainly keeps track of the current locked 
axis. Generally,
this works by deciding which axis to lock to depending on the accumulated 
gesture translation within
a specific tolerance band.

* Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/BasicAppKitGesturesTests.swift:

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



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

Reply via email to