Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 79d58a6856afda9361c92ad6aaad75a0a49f677d
https://github.com/WebKit/WebKit/commit/79d58a6856afda9361c92ad6aaad75a0a49f677d
Author: Wenson Hsieh <[email protected]>
Date: 2025-06-29 (Sun, 29 Jun 2025)
Changed paths:
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
M Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp
M Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h
M Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm
M Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.h
M Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.mm
M Source/WebKit/UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm
M Source/WebKit/UIProcess/PageClient.h
M Source/WebKit/UIProcess/mac/PageClientImplMac.h
M Source/WebKit/UIProcess/mac/PageClientImplMac.mm
M Source/WebKit/UIProcess/mac/WebViewImpl.mm
Log Message:
-----------
[Liquid Glass] [macOS] Safari UI background fill is clipped when attaching
web inspector view on the left or right side
https://bugs.webkit.org/show_bug.cgi?id=295169
rdar://153388693
Reviewed by Abrar Rahman Protyasha.
Currently, when Liquid Glass is enabled, revealing Web Inspector attached to
the left or right of
the web view in Safari causes the background color fill in the tab bar to
become clipped (the color
in the tab bar above the web view is either the background color or top fixed
color, while the color
above the inspector web view is the system background color). This happens
because the scroll pocket
(scroll edge effect) in the obscured inset area of the web view only matches
the width of the web
view, and is additionally clipped by the web view's parent view.
To fix this, we add a mechanism to let the inspector web view pull a solid
scroll pocket capture
color directly from the attached inspected web view, and keep the capture color
up to date if it
changes in the original web view. See below for more details.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _horizontallyAttachedInspectorWebView]):
Add a helper method to get the attached web inspector web view from the
inspected `WKWebView`.
(-[WKWebView _alwaysPrefersSolidColorHardPocket]):
(-[WKWebView _setAlwaysPrefersSolidColorHardPocket:]):
Add a property to force `-[NSScrollPocket prefersSolidColorHardPocket]` to
`YES` on the inspected
web view's pocket, only when it's docked to the left or right. This allows the
magic pocket (and
thus, the background of the tab bar) to be a solid color equal to the inspected
web view's pocket
capture color.
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView _setUsesAutomaticContentInsetBackgroundFill:]):
Drive-by fix: update the scroll pocket capture color when the pocket style
(hard vs. soft) changes.
This currently gets stale when changing from soft -> hard pocket style.
* Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp:
(WebKit::WebInspectorUIProxy::attach):
(WebKit::WebInspectorUIProxy::detach):
(WebKit::WebInspectorUIProxy::openLocalInspectorFrontend):
(WebKit::WebInspectorUIProxy::open):
(WebKit::WebInspectorUIProxy::closeFrontendPageAndWindow):
(WebKit::WebInspectorUIProxy::dispatchDidChangeLocalInspectorAttachment):
Add a mechanism to call into the inspected page when the local inspector's
attachment state (i.e.
attachment side, or whether it's attached at all) changes. This is necessary to
expand the pocket
bounds of the inspected web view to encompass the inspector web view as well;
despite being inside
of a clipped parent view, this is necessary for glass elements above the web
view's scroll pocket to
adapt correctly to the background color of the scroll pocket in the Safari UI.
* Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h:
* Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorUIProxyMac.mm:
(-[WKRemoteWebInspectorUIProxyObjCAdapter
inspectorViewControllerInspectorIsHorizontallyAttached:]):
Add a delegate hook that returns whether or not the inspector web view is
attached to the left or
right of the inspected web view.
* Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.h:
* Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController didAttachOrDetach]):
Whenever the inspector view is attached or detached, update the inspector web
view's scroll pocket
state so that it pulls the initial color of the inspected web view's scroll
pocket capture color,
using the capture color override, as well as the new
`_alwaysPrefersSolidColorHardPocket` property.
(-[WKInspectorViewController _horizontallyAttachedInspectedWebView]):
Add a helper method to get the attached inspected web view, from the inspector
web view.
* Source/WebKit/UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm:
(-[WKWebInspectorUIProxyObjCAdapter
inspectorViewControllerInspectorIsHorizontallyAttached:]):
(WebKit::WebInspectorUIProxy::platformCreateFrontendPage):
(WebKit::WebInspectorUIProxy::inspectedViewFrameDidChange):
When "content inset background fill" is enabled (i.e. the Liquid Glass runtime
flag), allow the
bounds of the web inspector view to extend to match the full height of the
inspected web view. The
existing infrastructure of applying safe area insets to the obscured content
insets of the web view
allows the inspector web view to still dodge the Safari UI, even when it's full
height.
(WebKit::WebInspectorUIProxy::platformAttach):
(WebKit::WebInspectorUIProxy::platformDetach):
Call `-didAttachOrDetach`.
* Source/WebKit/UIProcess/PageClient.h:
(WebKit::PageClient::didChangeLocalInspectorAttachment):
* Source/WebKit/UIProcess/mac/PageClientImplMac.h:
* Source/WebKit/UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::didChangeLocalInspectorAttachment):
Update the scroll pocket's layout bounds when the web inspector attachment mode
changes; see below.
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::updateTopScrollPocketCaptureColor):
Update the attached web inspector web view whenever the inspected web view's
scroll pocket capture
color changes.
(WebKit::WebViewImpl::updatePrefersSolidColorHardPocket):
Add support for `-_alwaysPrefersSolidColorHardPocket`, by returning `YES` if
the new flag is set.
(WebKit::WebViewImpl::updateScrollPocket):
Expand the bounds of the scroll pocket to include the area underneath the
attached web inspector
view. This is necessary in order to ensure that glass above the scroll pocket
adapts correctly and
consistently to the updated capture color, even if the scroll pocket is clipped.
Canonical link: https://commits.webkit.org/296782@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