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

  Changed paths:
    A 
LayoutTests/fast/page-color-sampling/color-sampling-includes-sides-that-had-insets-expected.txt
    A 
LayoutTests/fast/page-color-sampling/color-sampling-includes-sides-that-had-insets.html
    M Source/WebCore/platform/FixedContainerEdges.cpp
    M Source/WebCore/platform/FixedContainerEdges.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/UIProcess/Cocoa/WKColorExtensionView.h
    M Source/WebKit/UIProcess/Cocoa/WKColorExtensionView.mm
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm

  Log Message:
  -----------
  [Single Tab mode] Safari UI flickers when scrolling with color-extension on 
the bottom edge
https://bugs.webkit.org/show_bug.cgi?id=294083
rdar://151639773

Reviewed by Abrar Rahman Protyasha.

When fixed color extension views are shown, there's currently a slight flicker 
when scrolling down
in Safari in single tab mode, due to the fact that the color extension view 
fades in over the course
of 100 ms.

To fix this, we make several adjustments to stabilize the bottom sampled color 
even when the bottom
obscured inset is zero (i.e. no color extension view is actually required), 
such that we don't end
up with a visible flash when the bottom inset becomes nonzero again.

See below for more details.

* 
LayoutTests/fast/page-color-sampling/color-sampling-includes-sides-that-had-insets-expected.txt:
 Added.
* 
LayoutTests/fast/page-color-sampling/color-sampling-includes-sides-that-had-insets.html:
 Added.

Add a layout test to exercise this new behavior, by verifying that the bottom 
sampled color is
visible even if the bottom obscured inset becomes 0.

* Source/WebCore/platform/FixedContainerEdges.cpp:
(WebCore::FixedContainerEdges::fixedEdges const):
* Source/WebCore/platform/FixedContainerEdges.h:

Add a helper method to return all edges that contain fixed edges.

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

Drive-by rename: `_updateFixedColorExtensionEdges` -> 
`_updateHiddenContentInsetFillEdges`, to
better reflect the purpose of this method.

(-[WKWebView colorExtensionViewWillDisappear:]):
(-[WKWebView colorExtensionViewDidAppear:]):

Also adjust `WKColorExtensionView` so that it instantly changes background 
colors when updated with
a background color while hidden (instead of fading over the course of 100 ms). 
Note that we'll still
animate when transitioning between different background colors, or when the 
color fades out. This
ensures that the Safari UI doesn't change colors while it's animating in.

(-[WKWebView _updateFixedColorExtensionEdges]): Deleted.
(-[WKWebView colorExtensionViewWillFadeOut:]): Deleted.
(-[WKWebView colorExtensionViewDidFadeIn:]): Deleted.

Rename these delegate methods from `WillFadeOut`/`DidFadeIn` -> 
`WillDisappear`/`DidAppear`, to
reflect the fact that they don't always fade between the target colors.

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _setObscuredInsets:]):

Fix one flaky issue I discovered while debugging this, where — in single tab 
mode — the bottom fixed
color view sometimes fails to appear at all. This is because we currently only 
update the frames of
fixed color views when changing obscured insets (in an attempt to avoid doing 
more work per frame),
but the full call to `-_updateFixedColorExtensionViews` is necessary in the 
case where an obscured
inset either becomes zero (from nonzero) or vice versa.

* Source/WebKit/UIProcess/Cocoa/WKColorExtensionView.h:
* Source/WebKit/UIProcess/Cocoa/WKColorExtensionView.mm:
(-[WKColorExtensionView updateColor:]):
(-[WKColorExtensionView fadeOut]):
(-[WKColorExtensionView _updateColor:visible:]):
(-[WKColorExtensionView animationDidStop:finished:]):
(-[WKColorExtensionView fadeToColor:]): Deleted.
(-[WKColorExtensionView _fadeToColor:visible:]): Deleted.

Rename `fadeToColor` to `updateColor` to reflect the fact that it may no longer 
perform animated
transitions, and make it instantly set the color in the case where the view was 
hidden beforehand.

* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::sidesRequiringFixedContainerEdges const):

Even on rect sides that don't contain obscured insets, continue sampling those 
edges until there's
no longer any fixed container on that edge. This ensures that in the case where 
the obscured inset
reaches 0 temporarily but comes back later (after scrolling), the sampled color 
will remain up-to-
date and we don't end up with a flicker.

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