Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 153ae030bbdec163692f4b2826096674c01ed360
https://github.com/WebKit/WebKit/commit/153ae030bbdec163692f4b2826096674c01ed360
Author: Abrar Rahman Protyasha <[email protected]>
Date: 2026-08-26 (Wed, 26 Aug 2026)
Changed paths:
M
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm
M Source/WebKit/UIProcess/ViewGestureController.cpp
M Source/WebKit/UIProcess/ViewGestureController.h
M Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.mm
M Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm
M Source/WebKit/UIProcess/mac/WebViewImpl.h
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
Log Message:
-----------
[AppKit Gestures] Magnification can snap the scroll position unexpectedly
https://bugs.webkit.org/show_bug.cgi?id=322602
rdar://185721724
Reviewed by Tim Horton.
Our gesture recognizer driven magnification can drive two independent
subsystems at once: the pan GR synthesizes wheel events that produce
scrolling, while the magnification GR drives a transient zoom. When
driven through NSResponder magnification, these are not supposed to
overlap. Three separate problems (and how we solve them) fall out of that:
1. Transient zoom compensates for growing the main frame clip layer by
shifting the scrolled contents layer back, and prescribes a new
position derived from the layer's current one. If there is a
simultaneous scroll, then the scrolling tree rewrites that position
every frame, too, and these mechanisms start fighting each other.
We can instead let the scrolling tree continue being the only writer
of that data if we derive an additive compensation rather than an
absolute position in RLTDrawingAreaProxyMac::applyTransientZoomToLayer.
This is a no-op for configurations where the scrolling tree does not
actually touch the scrolled content layer position during a
magnification gesture.
2. scaledMagnificationOrigin() is derived from the magnification gesture's
origin, so we can end up double accounting when the origin changes
(due to a scroll). This made sense in the past since we did not have
a configuration that allowed scrolls during a transient zoom, but now
it only makes sense for NSResponder magnification. As such, we limit
this behavior change behind the gesture input source.
3. -sendWheelEventForGesture: computed the scrollability along each axis
and handed that over to the directional scroll lock tracker. However,
certain gestures can bypass this scrollability check (those that
"prefer unlocked scrolls"). This produced unwanted sideways jitter ->
rubberband stretch rather than a scroll. We should instead let the
directional scroll tracker do its internal updating with the provided
scrollability values, and then enforce a hard clamp separately. I
left a FIXME to try to incorporate this witihn the tracker itself,
but this shape minimizes the risk (since we also use this for
momentum calulcations).
*
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm:
(WebKit::additiveTransientPositionAnimation):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::applyTransientZoomToLayer):
* Source/WebKit/UIProcess/ViewGestureController.cpp:
(WebKit::ViewGestureController::didEndGesture):
(WebKit::ViewGestureController::scaledMagnificationOrigin):
* Source/WebKit/UIProcess/ViewGestureController.h:
* Source/WebKit/UIProcess/mac/AppKitGestures/WKAppKitGestureController.mm:
(-[WKAppKitGestureController sendWheelEventForGesture:]):
(-[WKAppKitGestureController magnificationGestureRecognized:]):
* Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::handleMagnificationGesture):
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::magnifyWithEvent):
(WebKit::WebViewImpl::gestureEventWasNotHandledByWebCoreFromViewOnly):
(WebKit::WebViewImpl::magnificationGestureEventWasNotHandledByWebCoreFromViewOnly):
(WebKit::WebViewImpl::applyNativeMagnification):
Canonical link: https://commits.webkit.org/319888@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications