Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ddea07179839833efb4df7022cbc6269d7b070cd
      
https://github.com/WebKit/WebKit/commit/ddea07179839833efb4df7022cbc6269d7b070cd
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-06-26 (Thu, 26 Jun 2025)

  Changed paths:
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/LocalFrameView.h
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.h
    M Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.h
    M Tools/TestWebKitAPI/cocoa/TestWKWebView.mm

  Log Message:
  -----------
  [Liquid Glass] [macOS] Blank gap above top fixed header when rubber-banding 
against top of page
https://bugs.webkit.org/show_bug.cgi?id=295001
rdar://151482288

Reviewed by Abrar Rahman Protyasha and Aditya Keerthi.

Currently, when rubber-banding against the top of a webpage in Safari with a 
fixed element near the
top of the viewport, the page background color shows up in the gap between the 
bottom of the color
extension view and the top edge of the fixed element.

To fill in this gap, we introduce a new `m_layerForTopOverhangColorExtension` 
whose background color
is updated to match the predominant sampled color of the fixed element near the 
top. We then place
this new layer above the existing overhang layer for the page's extended 
background color. The layer
becomes visible when rubber-banding past the top of the page.

* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::setWantsLayerForTopOverhangColorExtension const):

Add a new helper method to create and install 
`m_layerForTopOverhangColorExtension` in the
`GraphicsLayer` hierarchy. This layer is inserted right before the existing
`m_layerForTopOverhangArea` (which has now been renamed to avoid confusion).

(WebCore::LocalFrameView::setWantsLayerForTopOverhangImage const):
(WebCore::LocalFrameView::setWantsLayerForTopOverHangArea const): Deleted.

Rename the existing `m_layerForTopOverhangArea` to 
`m_layerForTopOverhangImage`, to clarify that
it's only used to contain the image supplied by the injected bundle client via 
the SPI function
`WKBundlePageSetTopOverhangImage`. Note that this is only used by Safari's 
continuous reader mode.
This renaming is important to disambiguate it from this new 
`m_layerForTopOverhangColorExtension`,
which also sits inside the overhang area.

* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateFixedContainerEdges):

Add or remove `m_layerForTopOverhangColorExtension` as needed (i.e., when 
there's a predominant
sampled color).

* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::~RenderLayerCompositor):
(WebCore::RenderLayerCompositor::frameViewDidChangeSize):

Update the `m_layerForTopOverhangColorExtension`'s bounds, alongside the 
existing
`m_layerForOverhangAreas`.

(WebCore::RenderLayerCompositor::updateRootLayerPosition):
(WebCore::RenderLayerCompositor::updateLayerForTopOverhangImage):
(WebCore::RenderLayerCompositor::updateLayerForTopOverhangColorExtension):

Add logic to add or remove `m_layerForTopOverhangColorExtension` — note that 
this new layer is
inserted under `m_scrolledContentsLayer` (matching 
`m_layerForTopOverhangImage`), but goes beneath
`m_layerForTopOverhangImage` in sublayer order if that already exists.

(WebCore::RenderLayerCompositor::updateSizeAndPositionForOverhangAreaLayer):
(WebCore::RenderLayerCompositor::updateSizeAndPositionForTopOverhangColorExtensionLayer):
(WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea): Deleted.
* Source/WebCore/rendering/RenderLayerCompositor.h:
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::setTopOverhangImage):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ObscuredContentInsets.mm:
(TestWebKitAPI::TEST(ObscuredContentInsets, TopOverhangColorExtensionLayer)):

Add an API test that searches the layer hierarchy for this new `CALayer` (by 
name) and sanity checks
its bounds, position, and background color.

* Tools/TestWebKitAPI/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/cocoa/TestWKWebView.mm:
(forEachCALayer):
(-[WKWebView forEachCALayer:]):

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