Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2c0658bf3b5d5ba387a3e2e8dae776abf78f196a
https://github.com/WebKit/WebKit/commit/2c0658bf3b5d5ba387a3e2e8dae776abf78f196a
Author: Wenson Hsieh <[email protected]>
Date: 2025-07-01 (Tue, 01 Jul 2025)
Changed paths:
A
LayoutTests/fast/page-color-sampling/color-sampling-for-sticky-element-after-scrolling-expected.txt
A
LayoutTests/fast/page-color-sampling/color-sampling-for-sticky-element-after-scrolling.html
M LayoutTests/resources/ui-helper.js
M Source/WebCore/page/scrolling/ScrollingTree.h
M Source/WebCore/page/scrolling/ScrollingTreeStickyNode.cpp
M Source/WebCore/page/scrolling/ScrollingTreeStickyNode.h
M Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h
M Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm
M
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp
M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h
M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp
M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Log Message:
-----------
[Liquid Glass] Color extensions sometimes fail to update when scrolling to
sticky elements
https://bugs.webkit.org/show_bug.cgi?id=295296
rdar://152196131
Reviewed by Abrar Rahman Protyasha.
Fixed and sticky color sampling/extensions currently update at most once per
rendering update, and
only when the geometry of viewport-constrained layers update or we paint into a
viewport-constrained
layer. This helps to minimize the performance overhead incurred by fixed/sticky
element background
color extension, a key mitigation for overlay UI in Safari when Liquid Glass is
enabled to prevent
visible web content from showing through gaps in the new UI, when there are
fixed/sticky elements
near the edges of the viewport.
However, there's currently no mechanism to ensure that a sticky element will be
detected and sampled
once it begins sticking to its enclosing constraining rect (for instance, when
a sticky element
starts behaving like a fixed element, and becomes constrained to the viewport).
As such, the
detection and sampling of sticky website content (often-times website headers)
is generally flaky,
but tends to work well in practice on most of the web due to the fact that
other unrelated viewport-
constrained elements are either repainted and/or moved around while scrolling,
thereby triggering a
sampling update. In simpler web content (such as the Severe Weather alert seen
in Safari view
controller in the Weather app), this doesn't happen since there's no other
viewport-constrained
objects being inserted/removed/repainted, and so we can end up with a visible
gap above sticky
elements.
To fix this, we add plumbing to make `ScrollingTreeStickyNode` observe when it
first begins to stick
to its constraining rect when handling a scrolling tree commit, and tell its
scrolling tree about
it. The remote scrolling tree then notifies its scrolling coordinator proxy in
the UI process, which
then forwards the message to the `WebPageProxy`, and ultimately notifies the
corresponding `WebPage`
to resample for color extension along edges with obscured insets. These
notifications are batched
together for all sticky nodes that began sticking in a single commit, to avoid
redundant IPC.
*
LayoutTests/fast/page-color-sampling/color-sampling-for-sticky-element-after-scrolling-expected.txt:
Added.
*
LayoutTests/fast/page-color-sampling/color-sampling-for-sticky-element-after-scrolling.html:
Added.
Add a layout test to exercise this change by scrolling down, and verifying that
the sticky element's
background color is sampled after scrolling.
* LayoutTests/resources/ui-helper.js:
(window.UIHelper.async scrollDown):
Add a helper method to scroll the page down on all platforms – on iOS, this
simulates a swipe
gesture from the bottom of the screen to the top, and on other platforms it
just simulates mouse
wheel scrolling. This allows us to avoid an `isIOSFamily()` check in the new
layout test itself,
instead keeping the platform check in the testing helper.
* Source/WebCore/page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::stickyScrollingTreeNodeBeganSticking):
* Source/WebCore/page/scrolling/ScrollingTreeStickyNode.cpp:
(WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
(WebCore::ScrollingTreeStickyNode::updateIsSticking):
(WebCore::ScrollingTreeStickyNode::isSticking const):
Add a flag to `ScrollingTreeStickyNode`, which tracks whether or not the sticky
node is sticking to
its constraining rect.
* Source/WebCore/page/scrolling/ScrollingTreeStickyNode.h:
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h:
* Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm:
(WebCore::ScrollingTreeStickyNodeCocoa::isCurrentlySticking const): Deleted.
Move this into the base class, in `ScrollingTreeStickyNode.cpp`. Also add a
FIXME here to also check
horizontal scroll offset; it's not necessary to fix this particular bug, so I
plan to address this
separately.
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::commitScrollingTreeState):
Add a new flag, `m_scrollingTreeNodesBeganBehavingAsFixed`, that keeps track of
when one or more
sticky scrolling tree nodes has begun sticking to the edges of its constraining
rect, during a
scrolling tree commit. We set this flag and call
`stickyScrollingTreeNodeBeganSticking` at the end
of the commit, if at least one node has begun sticking.
This flag prevents us from dispatching redundant IPC messages in the case where
there are multiple
sticky scrolling nodes that begin sticking in the same commit.
(WebKit::RemoteScrollingCoordinatorProxy::stickyScrollingTreeNodeBeganSticking):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::stickyScrollingTreeNodeBeganSticking):
Add some plumbing from `ScrollingTreeStickyNode` -> `RemoteScrollingTree` ->
`RemoteScrollingCoordinatorProxy` -> `WebPageProxy` when any sticky scrolling
tree node starts
sticking to the constraining rect (e.g. behaving as a fixed element).
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::stickyScrollingTreeNodeBeganSticking):
Whenever one or more sticky scrolling tree nodes begin sticking, tell the web
page to resampling
for fixed container edges (fixed/sticky element color extensions).
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
Add a new IPC message to invalidate `m_needsFixedContainerEdgesUpdate` on
`WebPage`.
Canonical link: https://commits.webkit.org/296901@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