Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4233e371219bf7f7637cd489f5417baabc64d0a9
https://github.com/WebKit/WebKit/commit/4233e371219bf7f7637cd489f5417baabc64d0a9
Author: Wenson Hsieh <[email protected]>
Date: 2025-07-13 (Sun, 13 Jul 2025)
Changed paths:
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.h
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.h
M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
M Source/WebKit/UIProcess/ios/UIKitUtilities.h
M Source/WebKit/UIProcess/ios/UIKitUtilities.mm
M Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
M Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm
M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h
M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm
M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h
M Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
Log Message:
-----------
[Liquid Glass] Introduce new API to specify obscured content insets on
WKWebView
https://bugs.webkit.org/show_bug.cgi?id=294685
rdar://153876011
Reviewed by Abrar Rahman Protyasha.
Add support for a new `-obscuredContentInsets` property on `WKWebView`. This
property is nearly
identical to the existing `-_obscuredInset` property on iOS and the
`-_topContentInset` property on
macOS, both of which are currently used to inset the layout viewport (relative
to the web view's
bounds) to account for overlapping browser UI, such as the tab bar or unified
field.
On macOS, this is just a thin wrapper around `-_setObscuredContentInsets:…
immediate:NO`. However,
on iOS, this effectively wraps *both* `-_setObscuredInsets:` and
`-_overrideLayoutParametersWithMinimumLayoutSize:…:`. When this API is used
(and notably, when the
existing SPI is _not_ used), the active view layout size will be automatically
inset, such that the
layout viewport fits within the unobscured area.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView obscuredContentInsets]):
(-[WKWebView setObscuredContentInsets:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView activeViewLayoutSize:]):
Automatically inset the view layout size by obscured content insets, only if
the new API was used to
specify obscured insets.
(-[WKWebView _setObscuredInsets:]):
(-[WKWebView _setObscuredInsetsInternal:]):
Add a new flag, `_automaticallyAdjustsViewLayoutSizesWithObscuredInset`, that
determines whether
we should automatically shrink the layout viewport by the client-specified
obscured inset, relative
to the web view bounds. This flag is enabled once the WebKit client specifies
non-zero insets with
the new API, but it's actually turned off when using the legacy
`-_obscuredInsets` SPI to maintain
compatibility with clients that use
`-_overrideLayoutParametersWithMinimumLayoutSize:…:`.
* Source/WebKit/UIProcess/ios/UIKitUtilities.h:
* Source/WebKit/UIProcess/ios/UIKitUtilities.mm:
(WebKit::maxEdgeInsets):
Add a helper function to compute the max extents of two `UIEdgeInsets`.
* Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setAutomaticallyAdjustsContentInsets):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm:
(TestWebKitAPI::TEST(ObscuredContentInsets, SetAndGetObscuredContentInsets)):
(TestWebKitAPI::TEST(ObscuredContentInsets, ScrollViewFrameWithObscuredInsets)):
(TestWebKitAPI::TEST(ObscuredContentInsets, ResizeScrollPocket)):
(TestWebKitAPI::TEST(ObscuredContentInsets, ScrollPocketCaptureColor)):
(TestWebKitAPI::TEST(ObscuredContentInsets, TopOverhangColorExtensionLayer)):
(TestWebKitAPI::TEST(ObscuredContentInsets, TopScrollPocketKVO)):
(TestWebKitAPI::TEST(ObscuredContentInsets,
AdjustedColorForTopContentInsetColor)):
Add test coverage by deploying the new API in tests, in place of the SPI
`-_setObscuredContentInsets:immediate:`.
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h:
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::UIScriptControllerCocoa::setObscuredInsets):
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h:
* Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::setObscuredInsets): Deleted.
Add test coverage by deploying the new API in layout tests, in place of the SPI
`-_setObscuredInset:`. Note that we no longer need to separately override
layout parameters here,
because this new API takes care of both obscured insets and layout size
override.
Canonical link: https://commits.webkit.org/297319@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