Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0d38c8510a6ac78bd7390c26c6b61770df090aea
      
https://github.com/WebKit/WebKit/commit/0d38c8510a6ac78bd7390c26c6b61770df090aea
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-09-01 (Mon, 01 Sep 2025)

  Changed paths:
    M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
    M Source/WebKit/UIProcess/mac/WebViewImpl.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm

  Log Message:
  -----------
  [Liquid Glass] [macOS] Music app: hard scroll pocket appears in iTune Stores 
after resizing the window
https://bugs.webkit.org/show_bug.cgi?id=298134
rdar://156118454

Reviewed by Tim Horton.

Currently, in macOS 26, using `-_setTopContentInset:` to set a nonzero top 
content inset for the web
view automatically installs a scroll pocket as well. This is because in Safari 
(and various other
system apps), the top content inset represents the area near the top of the web 
view, where UI
overlaps the content while scrolling (e.g. the navigation bar). While this SPI 
existed long before
macOS 26, it was recently generalized to all 4 rect edges, and additionally 
renamed to
`-setObscuredContentInsets:` to clarify the fact that these insets represent 
the dimensions of UI
that obscures the webpage.

However, the Music app (and possibly others) have always used 
`-_setTopContentInset:` to represent
a *non-obscuring* part of the UI that sits above the web view; as such, they're 
setting a top
content inset only to ensure that there's ~70px of additional scrollable 
content height above the
web view, when scrolled to the very top. Note that while this is technically 
incorrect due to the
fact that setting top content inset also shrinks the layout viewport for 
fixed-position elements, it
ultimately works out in the Music app's case, which doesn't have any fixed 
elements in their web
view anyways.

To fix the Music app while allowing Safari and other "obscured top content 
inset" clients to
automatically install a top scroll pocket, we require the client to use either:

1.  `-_setObscuredContentInsets:immediate:` or `-setObscuredContentInsets:` to 
set a top inset value
2.  `-_setTopContentInset:` in combination with any of the other SPIs that 
customizes the appearance
    or behavior of the top scroll pocket

...in order for WebKit to automatically create and install a scroll pocket at 
the top of the web
view. If only `-_setTopContentInset:` is used and (as far as WebKit can tell) 
the client doesn't
otherwise indicate that it requires a scroll pocket, we fall back to shipping 
behavior and avoid
installing the scroll pocket.

* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView _setTopContentInset:]):
(-[WKWebView _setObscuredContentInsets:immediate:]):
(-[WKWebView _setOverflowHeightForTopScrollEdgeEffect:]):
(-[WKWebView _setOverrideTopScrollEdgeEffectColor:]):
(-[WKWebView _setUsesAutomaticContentInsetBackgroundFill:]):

Implicitly opt into showing the magic pocket when using any of the other macOS 
web view SPIs for
customizing the pocket appearance, even if only a top content inset is set. 
This is necessary to
keep other system web views that use only `-_setTopContentInset:` from 
breaking, e.g. AMSUI's web
views.

* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::updateScrollPocket):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm:
(TestWebKitAPI::TEST(ObscuredContentInsets, NonObscuredTopContentInset)):

Canonical link: https://commits.webkit.org/299408@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

Reply via email to