[webkit-changes] [WebKit/WebKit] 559631: Changing color scheme does not update gradients wi...
Aditya Keerthi
noreply at github.com
Mon Mar 4 12:34:25 PST 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5596316ca6184ec9be4d8ba87e631dfbb25d4efe
https://github.com/WebKit/WebKit/commit/5596316ca6184ec9be4d8ba87e631dfbb25d4efe
Author: Aditya Keerthi <akeerthi at apple.com>
Date: 2024-03-04 (Mon, 04 Mar 2024)
Changed paths:
A LayoutTests/imported/w3c/web-platform-tests/css/css-images/gradient/color-scheme-dependent-color-stops-expected.html
A LayoutTests/imported/w3c/web-platform-tests/css/css-images/gradient/color-scheme-dependent-color-stops-ref.html
A LayoutTests/imported/w3c/web-platform-tests/css/css-images/gradient/color-scheme-dependent-color-stops.html
M Source/WebCore/css/StyleColor.cpp
M Source/WebCore/css/StyleColor.h
M Source/WebCore/css/color/CSSUnresolvedColor.cpp
M Source/WebCore/css/color/CSSUnresolvedColor.h
M Source/WebCore/style/StyleBuilderState.cpp
Log Message:
-----------
Changing color scheme does not update gradients with system colors or `light-dark()`
https://bugs.webkit.org/show_bug.cgi?id=267790
rdar://121285450
Reviewed by Matthieu Dubet.
`CSSGradientValue`s cache their generated `StyleImage` when possible. Currently,
caching is disallowed when the gradient contains one of the following color
keywords as a color stop: "-internal-document-text", "-webkit-link",
"-webkit-active-link", and "currentcolor".
However, that denylist is not comprehensive with respect to dynamic colors.
Notably, it excludes almost all system color keywords, and `light-dark()`.
Consequently, the same cached `StyleImage` is used even when the used color
scheme of an element changes.
Fix by updating `BuilderState::isColorFromPrimitiveValueDerivedFromElement`
to account for other scenarios where colors change dynamically.
* LayoutTests/imported/w3c/web-platform-tests/css/css-images/gradient/color-scheme-dependent-color-stops-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-images/gradient/color-scheme-dependent-color-stops-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-images/gradient/color-scheme-dependent-color-stops.html: Added.
* Source/WebCore/css/StyleColor.cpp:
(WebCore::StyleColor::colorFromKeyword):
Drive-by style fix.
(WebCore::StyleColor::containsColorSchemeDependentColor):
System colors, `light-dark()`, and any other unresolved colors containing
either of those, are color-scheme dependent colors.
* Source/WebCore/css/StyleColor.h:
* Source/WebCore/css/color/CSSUnresolvedColor.cpp:
(WebCore::CSSUnresolvedColor::containsColorSchemeDependentColor const):
* Source/WebCore/css/color/CSSUnresolvedColor.h:
* Source/WebCore/style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::isColorFromPrimitiveValueDerivedFromElement):
Update to cover colors that are color-scheme dependent.
Canonical link: https://commits.webkit.org/275645@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list