Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 83e10b359df5a0647ebb2cd5a9e597617a8973ce
https://github.com/WebKit/WebKit/commit/83e10b359df5a0647ebb2cd5a9e597617a8973ce
Author: Wenson Hsieh <[email protected]>
Date: 2025-05-28 (Wed, 28 May 2025)
Changed paths:
M Source/WebCore/page/LocalFrameView.cpp
M Source/WebCore/page/LocalFrameView.h
M Source/WebCore/platform/graphics/GeometryUtilities.cpp
M Source/WebCore/platform/graphics/GeometryUtilities.h
M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in
M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h
M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm
M
Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
M
Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h
M Source/WebKit/UIProcess/DrawingAreaProxy.h
M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h
M
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.h
M
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm
M Source/WebKit/UIProcess/ViewGestureController.cpp
M Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h
M Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
M Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm
M Source/WebKit/WebProcess/WebPage/mac/RemoteLayerTreeDrawingAreaMac.mm
Log Message:
-----------
[macOS] Content under left obscured content inset area is clipped when
pinch-zooming
https://bugs.webkit.org/show_bug.cgi?id=293600
rdar://151854427
Reviewed by Abrar Rahman Protyasha and Simon Fraser.
When applying transient zoom (i.e. during pinch zooming on macOS) while the
left obscured content
inset is nonzero, web content underneath the obscured content inset area is
clipped by the main
frame's clip layer, until the transient zoom finishes and the clip layer size
and position is
updated to include the obscured content inset area.
This happens because transient zoom currently works by applying a transform to
only the layer for
page scaling (i.e. the `RenderView`'s primary layer); however, since the page
is contained within a
clip layer whose bounds don't change while in transient zoom state (during
pinch zoom), any content
that would normally show up in the obscured inset area is clipped.
To fix this, we add logic to temporarily reposition and inflate the size of the
clip layer (as well
as the scrolled contents layer underneath) while the user is in transient zoom,
such that the clip
layer no longer clips any part of the page that falls inside a content inset
area. See below for
more details.
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::clipLayer const):
Add a helper method to grab the frame view's render layer compositor's
top-level clip layer.
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/platform/graphics/GeometryUtilities.cpp:
(WebCore::scaledRectAtOrigin):
Add a helper method that scales the given `FloatRect`, relative to the given
`origin` point.
* Source/WebCore/platform/graphics/GeometryUtilities.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTree.serialization.in:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::mainFrameClipLayerID const):
(WebKit::RemoteLayerTreeTransaction::setMainFrameClipLayerID):
Add plumbing to provide the main frame clip layer ID in remote layer tree
transactions, so that we
can obtain the clip layer in the UI-side remote drawing area proxy below.
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::description const):
*
Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
(WebKit::DrawingAreaProxyCoordinatedGraphics::adjustTransientZoom):
*
Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h:
* Source/WebKit/UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::adjustTransientZoom):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
Rename the existing `m_transientZoomOrigin` to
`m_transientZoomOriginInLayerForPageScale`, to
differentiate it from the new `m_transientZoomOriginInVisibleRect` (which is
used to resize and
reposition the clip layer).
*
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.h:
*
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::didCommitLayerTree):
Obtain the layer IDs of the main frame clip layer, as well as the scrolled
contents layer.
(WebKit::fillFowardsAnimationWithKeyPathAndValue):
(WebKit::transientZoomTransformOverrideAnimation):
(WebKit::transientSizeAnimation):
(WebKit::transientPositionAnimation):
Add more helper functions here to create size (`bounds.size`) and position
animations, which we
apply to the clipping and scrolled contents layers below.
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::applyTransientZoomToLayer):
Implement the main fix here:
1. Compute the scaled frame of the clip layer, given the current transient
zoom scale, and the
current frame of the clip layer. Animate the `position` and `bounds.size`
of the clip layer
using this rect.
2. Reposition the scrolled contents layer under the clip layer, to ensure that
content underneath
shows up in the correct location after repositioning the clip layer
position in (1).
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::removeTransientZoomFromLayer):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::adjustTransientZoom):
Plumb the `originInVisibleRect` alongside the existing `origin`, which is in
`layerForPageScaling`'s
coordinate space.
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::commitTransientZoom):
Remove the position and size animations from the scrolled contents and clip
layers when committing
the transient zoom, to prevent a jump in the case when we're rubber-banding
against the min or max
scale before ending transient zooming.
* Source/WebKit/UIProcess/ViewGestureController.cpp:
(WebKit::ViewGestureController::applyMagnification):
Pass in `m_magnificationOrigin` here; this will eventually become the drawing
area's
`m_transientZoomOriginInVisibleRect`.
* Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom):
* Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::didCollectGeometryForSmartMagnificationGesture):
* Source/WebKit/WebProcess/WebPage/mac/RemoteLayerTreeDrawingAreaMac.mm:
(WebKit::RemoteLayerTreeDrawingAreaMac::willCommitLayerTree):
Set the `mainFrameClipLayerID` here.
Canonical link: https://commits.webkit.org/295495@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes