[webkit-changes] [WebKit/WebKit] 1fbfb9: [macOS] Make it possible for clients to set a left...

Wenson Hsieh noreply at github.com
Mon Feb 10 12:23:40 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1fbfb97625d62916adbd8b7b30b01735694346e1
      https://github.com/WebKit/WebKit/commit/1fbfb97625d62916adbd8b7b30b01735694346e1
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2025-02-10 (Mon, 10 Feb 2025)

  Changed paths:
    M LayoutTests/fast/scrolling/latching/scroll-select-bottom-test.html
    M LayoutTests/fast/scrolling/mac/async-scroll-overflow-top-inset.html
    M LayoutTests/platform/mac-wk1/fast/backgrounds/top-content-inset-fixed-attachment.html
    M LayoutTests/platform/mac-wk2/accessibility/content-inset-scrollview-frame.html
    M LayoutTests/platform/mac/fast/events/content-inset-hit-testing-in-frame.html
    M LayoutTests/platform/mac/fast/events/content-inset-hit-testing.html
    M LayoutTests/scrollingcoordinator/mac/top-content-inset-to-zero.html
    M LayoutTests/tiled-drawing/scrolling/non-fast-region/top-content-inset-header.html
    M LayoutTests/tiled-drawing/scrolling/non-fast-region/top-content-inset.html
    A LayoutTests/tiled-drawing/scrolling/scroll-with-top-left-content-inset-expected.html
    A LayoutTests/tiled-drawing/scrolling/scroll-with-top-left-content-inset.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-body.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-cover-expected.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-cover-local-expected.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-cover-local.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-cover.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-expected.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-local-expected.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-local.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-positioned-expected.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-positioned.html
    M LayoutTests/tiled-drawing/top-content-inset-fixed-attachment.html
    A LayoutTests/tiled-drawing/top-left-content-insets-expected.html
    A LayoutTests/tiled-drawing/top-left-content-insets.html
    M LayoutTests/tiled-drawing/visible-rect-content-inset.html
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/LocalFrameView.h
    M Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
    M Source/WebCore/page/scrolling/coordinated/ScrollingTreeFrameScrollingNodeCoordinated.cpp
    M Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
    M Source/WebCore/rendering/BackgroundPainter.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.cpp
    M Source/WebKit/UIProcess/API/C/WKPage.cpp
    M Source/WebKit/UIProcess/API/C/WKPagePrivate.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
    M Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm
    M Source/WebKit/UIProcess/WebPageProxyTesting.cpp
    M Source/WebKit/UIProcess/WebPageProxyTesting.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPageTesting.cpp
    M Source/WebKit/WebProcess/WebPage/WebPageTesting.h
    M Source/WebKit/WebProcess/WebPage/WebPageTesting.messages.in
    M Source/WebKitLegacy/mac/WebView/WebView.mm
    M Source/WebKitLegacy/mac/WebView/WebViewPrivate.h
    M Tools/DumpRenderTree/TestRunner.cpp
    M Tools/DumpRenderTree/TestRunner.h
    M Tools/DumpRenderTree/mac/TestRunnerMac.mm
    M Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
    M Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
    M Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
    M Tools/WebKitTestRunner/TestController.cpp

  Log Message:
  -----------
  [macOS] Make it possible for clients to set a left obscured content inset
https://bugs.webkit.org/show_bug.cgi?id=287340
rdar://144115092

Reviewed by Tim Horton.

Add (partial) support for a new SPI on macOS:

```
- (void)_setObscuredContentInsets:(NSEdgeInsets)insets immediate:(BOOL)immediate;
```

...which allows WebKit clients to set content insets on all edges, which represents regions of the
page that are obscured by the app. This patch also adjusts related testing-only helpers that
currently set top content inset via `testRunner`, such that they can now be used to specify content
insets on all sides.

* LayoutTests/fast/scrolling/latching/scroll-select-bottom-test.html:
* LayoutTests/fast/scrolling/mac/async-scroll-overflow-top-inset.html:
* LayoutTests/platform/mac-wk2/accessibility/content-inset-scrollview-frame.html:
* LayoutTests/platform/mac-wk1/fast/backgrounds/top-content-inset-fixed-attachment.html:
* LayoutTests/platform/mac/fast/events/content-inset-hit-testing-in-frame.html:
* LayoutTests/platform/mac/fast/events/content-inset-hit-testing.html:
* LayoutTests/scrollingcoordinator/mac/top-content-inset-to-zero.html:
* LayoutTests/tiled-drawing/scrolling/scroll-with-top-left-content-inset-expected.html: Added.
* LayoutTests/tiled-drawing/scrolling/scroll-with-top-left-content-inset.html: Added.

Add a new layout test to exercise both vertical and horizontal scrolling in a web view with both top
and left content insets.

* LayoutTests/tiled-drawing/scrolling/non-fast-region/top-content-inset-header.html:
* LayoutTests/tiled-drawing/scrolling/non-fast-region/top-content-inset.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-body.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-cover-expected.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-cover-local-expected.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-cover-local.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-cover.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-expected.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-local-expected.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-local.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-positioned-expected.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment-positioned.html:
* LayoutTests/tiled-drawing/top-content-inset-fixed-attachment.html:
* LayoutTests/tiled-drawing/top-left-content-insets-expected.html: Added.
* LayoutTests/tiled-drawing/top-left-content-insets.html: Added.

Add a new layout test to verify that setting top/left content insets results in visual margins
around the top left corner of the page.

* LayoutTests/tiled-drawing/visible-rect-content-inset.html:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::positionForInsetClipLayer):

Rename `yPositionForInsetClipLayer` → `positionForInsetClipLayer`, pass in the full set of insets,
and make it return a `FloatPoint` instead. This allows us to apply the same treatment for the top
content inset, to the left content inset as well.

(WebCore::LocalFrameView::positionForRootContentLayer):

Adjust `positionForRootContentLayer` to take all inset edges instead of just the top content inset;
account for this inset by clamping the root content layer position to the left inset (or the scroll
position, if the scroll position is less than the left inset).

(WebCore::LocalFrameView::positionForRootContentLayer const):
(WebCore::LocalFrameView::yPositionForInsetClipLayer): Deleted.
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
* Source/WebCore/page/scrolling/coordinated/ScrollingTreeFrameScrollingNodeCoordinated.cpp:
(WebCore::ScrollingTreeFrameScrollingNodeCoordinated::repositionRelatedLayers):
* Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
* Source/WebCore/rendering/BackgroundPainter.cpp:
(WebCore::BackgroundPainter::calculateBackgroundImageGeometry):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::positionForClipLayer const):
(WebCore::RenderLayerCompositor::ensureRootLayer):
* Source/WebKit/UIProcess/API/C/WKPage.cpp:
(WKPageSetObscuredContentInsetsForTesting):
(WKPageSetTopContentInsetForTesting): Deleted.

Update this test helper to include all 4 content inset values.

* Source/WebKit/UIProcess/API/C/WKPagePrivate.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
* Source/WebKit/UIProcess/API/mac/WKWebViewMac.mm:
(-[WKWebView _setObscuredContentInsets:immediate:]):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm:
(WebKit::RemoteScrollingTreeMac::scrollingNodeForPoint):
* Source/WebKit/UIProcess/WebPageProxyTesting.cpp:
(WebKit::WebPageProxyTesting::setObscuredContentInsets):
(WebKit::WebPageProxyTesting::setTopContentInset): Deleted.
* Source/WebKit/UIProcess/WebPageProxyTesting.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::obscuredContentInsets const): Deleted.

Remove this getter, now that it's no longer used by `WebPageTesting`.

* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPageTesting.cpp:
(WebKit::WebPageTesting::setObscuredContentInsets):
(WebKit::WebPageTesting::setTopContentInset): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPageTesting.h:
* Source/WebKit/WebProcess/WebPage/WebPageTesting.messages.in:
* Source/WebKitLegacy/mac/WebView/WebView.mm:
(-[WebView _setObscuredTopContentInsetForTesting:right:bottom:left:]):
(-[WebView _setTopContentInsetForTesting:]): Deleted.

Update this test helper to include all 4 content inset values.

* Source/WebKitLegacy/mac/WebView/WebViewPrivate.h:
* Tools/DumpRenderTree/TestRunner.cpp:
(setObscuredContentInsetsCallback):
(TestRunner::staticFunctions):
(setTopContentInsetCallback): Deleted.
* Tools/DumpRenderTree/TestRunner.h:
* Tools/DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setObscuredContentInsets):
(TestRunner::setTopContentInset): Deleted.
* Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setObscuredContentInsets):
(WTR::TestRunner::setTopContentInset): Deleted.
* Tools/WebKitTestRunner/InjectedBundle/TestRunner.h:
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveAsyncMessageFromInjectedBundle):

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



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


More information about the webkit-changes mailing list