Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3a5a2dc6d7b110ce9ee677a6f033b51343b1ddb0
      
https://github.com/WebKit/WebKit/commit/3a5a2dc6d7b110ce9ee677a6f033b51343b1ddb0
  Author: Simon Fraser <simon.fra...@apple.com>
  Date:   2023-12-18 (Mon, 18 Dec 2023)

  Changed paths:
    A 
LayoutTests/view-gestures/smart-magnify/double-tap-zoom-scroll-above-top-expected.html
    A 
LayoutTests/view-gestures/smart-magnify/double-tap-zoom-scroll-above-top.html
    M 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm

  Log Message:
  -----------
  REGRESSION (UI-side compositing): Unable to scroll to top of page after 
double tapping trackpad causes page to scroll down
https://bugs.webkit.org/show_bug.cgi?id=266529
rdar://116419609

Reviewed by Tim Horton.

The smart magnify gesture (two-finger double tap on the trackpad) results in 
some combination of
scrolling and zooming. 
`RemoteLayerTreeDrawingAreaProxyMac::commitTransientZoom()` uses a
CAAnimation to animate to the final state, but the completion handler of that 
animation put the
transform directly onto the `layerForPageScale`.

That's OK if the gesture results in a scale change; that transform will get 
replaced by one that
comes from the web process. However, if a gesture just resulted in a scroll 
with no scale change,
we never get a new transform from the web process, so we leave that transform on
`layerForPageScale`. This transform has a translation baked in, so this causes 
a permanent scroll
offset.

So we have to stop shoving the transform onto this layer. This revealed an 
issue where there was a
jump when the animation was removed. Fixing this just requires two things:

1. Delay removing the transient zoom animations until we know the web process 
has committed the new
   scale and scroll position (via a `callAfterNextPresentationUpdate()`).

2. Override any scroll position changes that come from the web process before 
this by adding a
   CAAnimation onto the scrolled contents layer which overrides the `position` 
property. If we
   don't do this, scroll position changes cause a flash of offset content. This 
requires tracking
   m_pageScrollingLayerID, but that information was already in the transaction 
for banner hookup.

* 
LayoutTests/view-gestures/smart-magnify/double-tap-zoom-scroll-above-top-expected.html:
 Added.
* 
LayoutTests/view-gestures/smart-magnify/double-tap-zoom-scroll-above-top.html: 
Added.
* 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.h:
* 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::didCommitLayerTree):
(WebKit::fillFowardsAnimationWithKeyPath):
(WebKit::transientZoomTransformOverrideAnimation):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::applyTransientZoomToLayer):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::removeTransientZoomFromLayer):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::commitTransientZoom):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::sendCommitTransientZoom):

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to