Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 88d25d8b73a78ffa2dff8623221c9acc44fec330
https://github.com/WebKit/WebKit/commit/88d25d8b73a78ffa2dff8623221c9acc44fec330
Author: Wenson Hsieh <[email protected]>
Date: 2025-07-10 (Thu, 10 Jul 2025)
Changed paths:
M Source/WebKit/UIProcess/ViewGestureController.cpp
M Source/WebKit/UIProcess/ViewGestureController.h
M Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm
M Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
M Tools/TestWebKitAPI/SourcesCocoa.txt
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A Tools/TestWebKitAPI/Tests/WebKitCocoa/NavigationSwipeTests.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/NetworkProcess.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm
R Tools/TestWebKitAPI/Tests/ios/NavigationSwipeTests.mm
R Tools/TestWebKitAPI/Tests/mac/CustomSwipeViewTests.mm
M Tools/TestWebKitAPI/cocoa/TestWKWebView.h
M Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
Log Message:
-----------
[Liquid Glass] [macOS] Tab snapshots overlap with tab bar when swiping
back/forwards
https://bugs.webkit.org/show_bug.cgi?id=295755
rdar://154032062
Reviewed by Abrar Rahman Protyasha.
Tab snapshots are currently horizontally offset by the horizontal sidebar
width, in the case where
the sidebar is open on macOS. This happens because the `m_swipeSnapshotLayer`'s
frame currently
overlaps with the left obscured inset area, as it's always placed at (0, 0) —
bottom left on macOS,
relative to its parent `m_swipeLayer`. The y-coordinate happens to work out
because Safari only
ever sets the top content inset in practice, so the bottom of the snapshot
layer is always flush
against the bottom of the snapshot root layer.
However, when Liquid Glass is enabled, Safari now sets a left obscured content
inset when the
sidebar is open. This requires the `m_swipeSnapshotLayer` to be positioned at
`(sidebar width, 0)`,
and failure to do so results in the snapshot layer being tucked behind the
sidebar.
To fix this, we set the `m_swipeSnapshotLayer`'s frame to:
- `x` -> `left obscured inset`
- `y` -> `bottom obscured inset`
- `width` -> `swipe area width, subtracting horizontal insets`
- `height` -> `swipe area height, subtracting vertical insets`
Note: this applies to both cases where a custom swipe view is used (e.g.
swiping between the start
page and a website), and the case where there's no custom swipe view (e.g.
swiping between
websites).
* Source/WebKit/UIProcess/ViewGestureController.cpp:
(WebKit::ViewGestureController::itemForSwipeDirection const):
Add a helper method to return the relevant back/forward history list item when
swiping in the given
direction.
* Source/WebKit/UIProcess/ViewGestureController.h:
* Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
* Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
Implement the main fix here; see above for more details.
(WebKit::ViewGestureController::beginSimulatedSwipeInDirectionForTesting):
(WebKit::ViewGestureController::completeSimulatedSwipeInDirectionForTesting):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::beginBackSwipeForTesting):
Add support for simulated navigation swipe testing hooks on macOS. We also
adjust this codepath to
_ensure_ the gesture controller if it doesn't already exist, rather than
bailing if the testing hook
is invoked while the controller hasn't been instantiated.
(WebKit::WebViewImpl::updateScrollPocket):
Drive-by fix: adjust the z-index to be the lowest `float` instead of the lowest
`double`, to avoid a
benign warning in QuartzCore.
* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/NavigationSwipeTests.mm: Renamed from
Tools/TestWebKitAPI/Tests/ios/NavigationSwipeTests.mm.
Refactor this API test file:
1. Move it from `ios/` to `WebKitCocoa/`, so that we can put macOS-specific
tests there as well.
2. Merge the single API test in `CustomSwipeViewTests` into this new suite.
(-[TestNavigationInteractiveTransition startInteractiveTransition:]):
(TestWebKitAPI::TEST(NavigationSwipeTests,
RestoreFirstResponderAfterNavigationSwipe)):
(TestWebKitAPI::TEST(NavigationSwipeTests,
DoNotBecomeFirstResponderAfterNavigationSwipeIfWebViewIsUnparented)):
(TestWebKitAPI::TEST(NavigationSwipeTests,
DoNotAssertWhenSnapshottingZeroSizeView)):
(TestWebKitAPI::TEST(NavigationSwipeTests,
WindowRelativeBoundsForCustomSwipeViews)):
(TestWebKitAPI::TEST(NavigationSwipeTests, SwipeSnapshotLayerBounds)):
Add a new API test that exercises the bug by directly checking the bounds of
the swipe snapshot
layer after simulating a swipe backwards.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/NetworkProcess.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm:
(TestWebKitAPI::TEST(ObscuredContentInsets, TopOverhangColorExtensionLayer)):
* Tools/TestWebKitAPI/Tests/mac/CustomSwipeViewTests.mm: Removed.
Move this test into `NavigationSwipeTests`, and rename it appropriately.
* Tools/TestWebKitAPI/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:
(forEachCALayer):
(-[WKWebView forEachCALayer:]):
(-[WKWebView firstLayerWithName:]):
Make a couple adjustments to the testing helpers:
- Add a mechanism to stop iteration early when traversing the `CALayer` tree.
- Add a second helper method to grab a `CALayer` by name.
Canonical link: https://commits.webkit.org/297248@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