Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 374db8069358c8c82eb223f460a6ed91b1bfaab1
https://github.com/WebKit/WebKit/commit/374db8069358c8c82eb223f460a6ed91b1bfaab1
Author: David Quesada <[email protected]>
Date: 2026-06-23 (Tue, 23 Jun 2026)
Changed paths:
M Source/WebKit/UIProcess/Cocoa/WKColorExtensionView.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SampledPageTopColor.mm
Log Message:
-----------
WKColorExtensionView can outlive its WKWebView
https://bugs.webkit.org/show_bug.cgi?id=317608
rdar://180334423
Reviewed by Wenson Hsieh.
In some flows, WKColorExtensionView can stay retained for the lifetime of
the process, long after its owning WKWebView has deallocated. In this state,
the view is retained by CoreAnimation since it serves as the delegate for
the "WKColorExtensionViewFade" animation, which doesn't get explicitly
removed in all cases.
Prevent this eternal retain cycle by restoring the CAAnimation default
behavior of "removedOnCompletion" == YES, ensuring that the cycle is broken
when the animation completes (or when the view is removed from the hierarchy
when tearing down a web view). This class doesn't refer to the animation
after its completion (and would just create a new animation instance when
the color changes again), so there was no value in retaining it.
While here, remove a redundant usage of kCAFillModeForwards. This ensured
that after the animation had completed, the layer would keep the backgroundColor
as specified by the "to value" of the animation, instead of reverting to the
color from the model layer. But since the code to set up the animation already
sets the backgroundColor of the model layer to same color as the animation,
explicitly requesting to keep that "to value" makes no visual difference.
Furthermore, this fill mode becomes inconsequential with this change -- it
doesn't matter what post-completion effect the animation would have on the
layer's appearance if the animation gets removed upon its completion.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SampledPageTopColor.mm
* Source/WebKit/UIProcess/Cocoa/WKColorExtensionView.mm:
(-[WKColorExtensionView _updateColor:visible:]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SampledPageTopColor.mm:
(TestWebKitAPI::TEST(SampledPageTopColor,
ColorExtensionViewDeallocatesWithWebView)):
Canonical link: https://commits.webkit.org/315678@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications