Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 601969e2bc01b65a3d24003531a7ce503b6f95c3
      
https://github.com/WebKit/WebKit/commit/601969e2bc01b65a3d24003531a7ce503b6f95c3
  Author: Sean Patterson <[email protected]>
  Date:   2026-09-27 (Sun, 27 Sep 2026)

  Changed paths:
    M Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.h
    M Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.mm
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm

  Log Message:
  -----------
  [AppKit Gestures] Magnification doesn't zoom content that tracks mouse buttons
https://bugs.webkit.org/show_bug.cgi?id=324914
rdar://187738644

Reviewed by Abrar Rahman Protyasha.

The mouse tracking gesture recognizers recognize simultaneously with 
magnification and rotation, so
a magnification gesture reaches the page as a held left button drag alongside 
the zoom wheels it
produces. Content that treats a held button as an exclusive interaction 
discards those wheels and
never zooms; three.js OrbitControls, for example, returns early from 
`onMouseWheel` while
`state !== STATE.NONE`.

Other content relies on the simultaneous drag: maps.apple.com pans by mouse 
drag while it zooms, and
keeps panning after the magnification ends. So keep delivering both by default, 
and only stop the
drag when the content declines the transform gesture. A magnification gesture 
change that WebCore
reports as not handled means the content prevented neither the `gesturechange` 
event nor the wheel
event produced from it; `WebViewImpl::gestureEventWasNotHandledByWebCore` then 
calls
`-transformGestureWasNotHandledByContent`, which marks the transform gesture as 
declined and sends
the mouse up. Rotation changes are ignored, since they carry no scale and 
produce no zoom wheels, so
a page that pans with the drag and ignores gesture events keeps its drag 
through the rotation that
most magnification gestures include. The mark lasts until both the 
magnification and rotation
gestures end.

While a declined transform gesture is driving, mouse tracking does not deliver 
its drag. AppKit
fires the magnification and rotation actions only on the frames where that 
component dominates its
transform analyzer, but leaves the recognizer changed until the gesture ends, so
`-_shouldSuppressMouseTrackingForTransformGesture` requires a recent action as 
well as the state,
letting the drag resume once the gesture stops magnifying or rotating.

`-_transformGestureDidDrive` sends the mouse up directly rather than cancelling 
the mouse tracking
recognizers, which would not recognize again within the same gesture. A drag 
that resumes presses at
`mouseLocationInWindow`, since backdating it to `startLocationInWindow` would 
jump the content by the
distance travelled while the button was up. Resuming also rebases the movement 
baseline, so the first
mouse dragged event afterwards does not report that same distance as 
`movementX|Y`.

* Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.h:
* Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.mm:
(-[WKAppKitGestureController _isRecognizingTransformGesture]):
(-[WKAppKitGestureController _shouldSuppressMouseTrackingForTransformGesture]):
(-[WKAppKitGestureController transformGestureWasNotHandledByContent]):
(-[WKAppKitGestureController _transformGestureDidEnd]):
(-[WKAppKitGestureController _transformGestureDidDrive]):
(-[WKAppKitGestureController mouseTrackingGestureRecognized:]):
(-[WKAppKitGestureController magnificationGestureRecognized:]):
(-[WKAppKitGestureController rotationGestureRecognized:]):
(-[WKAppKitGestureController reset]):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::gestureEventWasNotHandledByWebCore):

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



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

Reply via email to