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

  Changed paths:
    M Source/WebKit/Shared/WebEvent.serialization.in
    M Source/WebKit/Shared/WebWheelEvent.cpp
    M Source/WebKit/Shared/WebWheelEvent.h
    M Source/WebKit/UIProcess/mac/WKAppKitGestureController.mm
    A Source/WebKit/UIProcess/mac/WKFastScrollTracker.swift
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WebPage/AppKit Gesture 
Tests/BasicAppKitGesturesTests.swift

  Log Message:
  -----------
  [AppKit Gestures] Scrolling should accelerate on multiple quick swipes in the 
same direction
https://bugs.webkit.org/show_bug.cgi?id=320043
rdar://181051283

Reviewed by Abrar Rahman Protyasha.

Implement a mechanism to derive the proper acceleration multiplier factor for 
consecutive
scrolls within WKAppKitGestureController. This is done by introducing a new 
`WKFastScrollTracker`
type which is used to encapsulate all the necessary scrolling state and is 
updated by
`WKAppKitGestureController`.

The result is then passed down to MomentumEventDispatcher to be applied to the 
acceleration value.

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

* Source/WebKit/Modules/Internal/module.modulemap:
* Source/WebKit/Shared/WebEvent.serialization.in:
* Source/WebKit/Shared/WebWheelEvent.cpp:
(WebKit::WebWheelEvent::WebWheelEvent):
* Source/WebKit/Shared/WebWheelEvent.h:
(WebKit::WebWheelEvent::momentumFastScrollMultiplier const):
(WebKit::WebWheelEvent::setMomentumFastScrollMultiplier):

Add a new field `momentumFastScrollMultiplier` to be propagated from the 
gesture source
(WKAppKitGestureController) down to where the momentum even calculations reside 
in
(MomentumEventDispatcher).

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

Compute the multiplier in `startMomentumIfNeededForGesture` and pass it in to 
the created event.

* Source/WebKit/UIProcess/mac/WKFastScrollTracker.h: Added.
* Source/WebKit/UIProcess/mac/WKFastScrollTracker.swift: Added.
(WKFastScrollTracker.multiplier):
(WKFastScrollTracker.endTime):
(WKFastScrollTracker.lastHorizontalDirection):
(WKFastScrollTracker.lastVerticalDirection):
(WKFastScrollTracker.update(withLocation:velocity:time:)):
(WKFastScrollTracker.didCatchMomentum):
(WKFastScrollTracker.didStartGesture(atLocation:)):
(WKFastScrollTracker.reset):

Encapsulate the scrolling state calculations.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

* Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp:
(WebKit::MomentumEventDispatcher::didStartMomentumPhase):

Use the computed value as a scale factor for the acceleration value.

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

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



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

Reply via email to