Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c495a3af9e9a28d3b461e151721569785ce1e059
https://github.com/WebKit/WebKit/commit/c495a3af9e9a28d3b461e151721569785ce1e059
Author: Wenson Hsieh <[email protected]>
Date: 2025-08-26 (Tue, 26 Aug 2025)
Changed paths:
M Source/WebKit/UIProcess/PageClient.h
M Source/WebKit/UIProcess/ViewSnapshotStore.cpp
M Source/WebKit/UIProcess/ViewSnapshotStore.h
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/ios/PageClientImplIOS.h
M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
M Source/WebKit/UIProcess/ios/UIKitUtilities.h
M Source/WebKit/UIProcess/ios/UIKitUtilities.mm
M Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm
M Source/WebKit/UIProcess/ios/WKContentView.mm
M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
Log Message:
-----------
[Liquid Glass] [iOS] Swipe-back snapshot misaligned after closing sidebar
https://bugs.webkit.org/show_bug.cgi?id=297943
rdar://154122055
Reviewed by Abrar Rahman Protyasha.
When swiping back/forward in Safari, a snapshot of the webpage in the
back/forward list is shown
only if certain criteria are met (e.g. the size of the web view and the
snapshot must match).
However, this size does not account for any obscured insets. Since iOS 26,
opening or closing the
sidebar changes the left obscured inset. As such, if we go forward, toggle the
sidebar, and then
swipe to go back (or vice versa), we end up showing a snapshot that's
incorrectly sized and offset
relative to the actual unobscured rect.
To fix this, we simply account for changes to obscured content insets in this
case, and (if the
change is more than some arbitrary threshold) we avoid using the back/forward
snapshot, as if the
size of the web view had changed.
This arbitrary "significant change" threshold exists (as opposed to checking
for equality in order
to keep using snapshots in common cases (especially on phone) where the tab bar
may have collapsed
or expanded. The mismatch is subtle in these cases, and keeping snapshots
visible in this case
matches shipping behavior. In the case of the left sidebar opening or closing,
this causes a
difference of a few hundred points, which results in a very noticeable (and
jarring) jump when
swiping.
* Source/WebKit/UIProcess/PageClient.h:
* Source/WebKit/UIProcess/ViewSnapshotStore.cpp:
(WebKit::ViewSnapshotStore::recordSnapshot):
* Source/WebKit/UIProcess/ViewSnapshotStore.h:
(WebKit::ViewSnapshot::setComputedObscuredInset):
(WebKit::ViewSnapshot::computedObscuredInset const):
Add the computed obscured inset as a member on `ViewSnapshot`, so that we can
check it (along with
size and scroll position) when determining whether the snapshot is suitable for
use.
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::computedObscuredInset const):
Add plumbing from `WebPageProxy` -> `PageClient` -> `WKWebView` to grab the
computed obscured inset.
* Source/WebKit/UIProcess/ios/UIKitUtilities.h:
* Source/WebKit/UIProcess/ios/UIKitUtilities.mm:
(WebKit::floatBoxExtent):
Move this static helper into UIKitUtilities, so that we can use it in
`PageClientImplIOS.mm` above.
* Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
* Source/WebKit/UIProcess/ios/WKContentView.mm:
(-[WKContentView
didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:viewStability:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]):
(floatBoxExtent): Deleted.
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::computedObscuredInset const):
Canonical link: https://commits.webkit.org/299185@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