Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 93fffd881e9d01735558b16dfd64d1c4d3c6959e
      
https://github.com/WebKit/WebKit/commit/93fffd881e9d01735558b16dfd64d1c4d3c6959e
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-11-06 (Thu, 06 Nov 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:
  -----------
  [macOS] Simple WKWebView app with a toolbar fails to get a toolbar background
https://bugs.webkit.org/show_bug.cgi?id=302098
rdar://161370795

Reviewed by Abrar Rahman Protyasha.

Currently, an app that uses none of the following SPI or API methods:

• `-setObscuredContentInsets:` / `-_setObscuredContentInsets:immediate:`
• `-_setOverflowHeightForTopScrollEdgeEffect:`
• `-_setOverrideTopScrollEdgeEffectColor:`
• `-_setUsesAutomaticContentInsetBackgroundFill:`

...will not get an automatic hard scroll pocket in the top content inset area. 
This was done to
prevent clients that only specify a top content inset without obscuring content 
(e.g. the Music
app's iTunes pane) from unexpectedly getting a hard pocket (see  
https://webkit.org/b/298134).

However, this also means that a WebKit client that uses neither 
`-_setTopContentInset:` nor
`-_setAutomaticallyAdjustsContentInsets:` but still expects a top inset due to 
the automatic
content inset adjustment won't get a top scroll pocket, when it actually needs 
it.

To mitigate this, we adjust this policy so that we only avoid adding the scroll 
pocket in the case
where we are not automatically computing content insets; in both cases where:

- The client gets its top content inset automatically, from the window's title 
bar.
- The client has used one of the above APIs, which implies the need for a top 
scroll pocket.

Test: ObscuredContentInsets.ScrollPocketWithAutomaticTopContentInset

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

Rename `m_canInstallScrollPocket` to 
`m_clientImplicitlyRequestedTopScrollPocket`, to better reflect
its new purpose.

(WebKit::WebViewImpl::setCanInstallScrollPocket): Deleted.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm:
(TestWebKitAPI::TEST(ObscuredContentInsets, NonObscuredTopContentInset)):

Adjust this test to disable automatic top content inset compuation, to ensure 
that the top scroll
pocket is created.

(TestWebKitAPI::TEST(ObscuredContentInsets, 
ScrollPocketWithAutomaticTopContentInset)):

Canonical link: https://commits.webkit.org/302682@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to