Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7f4fa54b63f297c3eaf011a2e59d275a1af8fed1
      
https://github.com/WebKit/WebKit/commit/7f4fa54b63f297c3eaf011a2e59d275a1af8fed1
  Author: Wenson Hsieh <[email protected]>
  Date:   2025-05-06 (Tue, 06 May 2025)

  Changed paths:
    M 
LayoutTests/compositing/cocoa/clip-sticky-element-to-viewport-expected.html
    M LayoutTests/compositing/cocoa/clip-sticky-element-to-viewport.html
    M LayoutTests/resources/ui-helper.js
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm
    A Source/WebKit/UIProcess/Cocoa/WKColorExtensionView.h
    A Source/WebKit/UIProcess/Cocoa/WKColorExtensionView.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
    M Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
    M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h
    M Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm

  Log Message:
  -----------
  [Page color sampling] Fixed element background color extension views should 
animate
https://bugs.webkit.org/show_bug.cgi?id=292623
rdar://150400616

Reviewed by Abrar Rahman Protyasha.

This patch refactors background color extension views for fixed-position 
elements docked to edges of
the viewport, such that they update background colors with a short (100 ms) 
animation. This helps to
smooth out transitions and prevent flickering in cases where the background 
color thrashes.

See below for more details.

* LayoutTests/compositing/cocoa/clip-sticky-element-to-viewport-expected.html:
* LayoutTests/compositing/cocoa/clip-sticky-element-to-viewport.html:
* LayoutTests/resources/ui-helper.js:

Adjust an existing layout test to force color extension views to finish 
animating instantly before
ending the test, using the new testing helper method below.

(window.UIHelper.cancelFixedColorExtensionFadeAnimations):
* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _updateFixedColorExtensionViews]):

Pull out logic to update which edges of the viewport have color extension views 
into a separate
helper method. We no longer update this state immediately after updating 
`_fixedContainerEdges`,
since we now need to wait for the fixed color extension views to either finish 
animating in to
prevent a flicker due to `m_topContentInsetFillView` otherwise disappearing 
without animation.

(-[WKWebView _updateFixedColorExtensionEdges]):
(-[WKWebView _hasVisibleColorExtensionView:]):
(-[WKWebView colorExtensionViewWillFadeOut:]):
(-[WKWebView colorExtensionViewDidFadeIn:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _cancelFixedColorExtensionFadeAnimationsForTesting]):
* Source/WebKit/UIProcess/Cocoa/WKColorExtensionView.h: Added.
* Source/WebKit/UIProcess/Cocoa/WKColorExtensionView.mm: Added.
(-[WKColorExtensionView initWithFrame:delegate:]):

Add a new helper class to help facilitate animated transitions between targeted 
background colors,
in such a way that:

- Animations are reversible and cancelable.
- The view is hidden after animating to `+clearColor`.
- The view can notify its delegate when it's about to begin fading out, or when 
it's done fading in.

(-[WKColorExtensionView fadeToColor:]):
(-[WKColorExtensionView fadeOut]):
(-[WKColorExtensionView _fadeToColor:visible:]):

Add support for methods to fade to a target color, fade out entirely (setting 
`-isHidden` when
finished), and also cancel any pending fade animation.

(-[WKColorExtensionView animationDidStop:finished:]):
(-[WKColorExtensionView isHiddenOrFadingOut]):
(-[WKColorExtensionView cancelFadeAnimation]):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* Tools/TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::cancelFixedColorExtensionFadeAnimations const):

Add a testing hook to immediately fast-forward ongoing fade animations in all 
of the color extension
views. This is used to ensure that `clip-sticky-element-to-viewport.html` above 
doesn't fail due to
taking a snapshot that includes the color extension view, while the color 
extension view is still in
the middle of its animation.

* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.h:
* Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:
(WTR::UIScriptControllerCocoa::cancelFixedColorExtensionFadeAnimations const):

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