Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e9cbce21b93f42122a43cc3d9f420e4f2022f78f
      
https://github.com/WebKit/WebKit/commit/e9cbce21b93f42122a43cc3d9f420e4f2022f78f
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-10-17 (Fri, 17 Oct 2025)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
    M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
    M Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.mm
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm

  Log Message:
  -----------
  [macOS] Allow clients to force solid color hard pocket on the top scroll 
pocket
https://bugs.webkit.org/show_bug.cgi?id=301020
rdar://162881310

Reviewed by Lily Spiniolas.

Expose `_alwaysPrefersSolidColorHardPocket` (currently an internal property on 
`WKWebView`) as
`_prefersSolidColorHardScrollPocket` for clients; see below for more details.

Note that setting this to `YES` guarantees a solid color hard pocket; however, 
setting this to `NO`
does not guarantee a non-solid hard pocket, since the engine may have other 
reasons to use a solid
color hard pocket.

Test: ObscuredContentInsets.PreferSolidColorHardPocket

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _addReasonToPreferSolidColorHardPocket:]):
(-[WKWebView _removeReasonToPreferSolidColorHardPocket:]):

Refactor this so that whether or not we should _really_ prefer solid color hard 
pocket depends on
the state of an `OptionSet<PreferSolidColorHardPocketReason>`, with two reason 
flags.

(-[WKWebView _alwaysPrefersSolidColorHardPocket]): Deleted.
(-[WKWebView _setAlwaysPrefersSolidColorHardPocket:]): Deleted.

Replace these with internal methods that add or remove the new 
`PreferSolidColorHardPocketReason`
flags.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView _prefersSolidColorHardScrollPocket]):
(-[WKWebView _setPrefersSolidColorHardScrollPocket:]):
* Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController didAttachOrDetach]):

Since we currently set this internal property from within the engine itself, we 
refactor this to add
the `PreferSolidColorHardPocketReason::AttachedInspector` reason flag, instead 
of overriding the new
property (which may have been set by the WebKit client).

* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::updatePrefersSolidColorHardPocket):

Make this check the `OptionSet<PreferSolidColorHardPocketReason>` instead of 
the value of the SPI
property, to account for both reasons.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm:
(TestWebKitAPI::TEST(ObscuredContentInsets, PreferSolidColorHardPocket)):

Add an API test to exercise this new method.

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