[webkit-changes] [WebKit/WebKit] 98862c: Implement contrast-color( <color> max? ) CSS function
Sam Weinig
noreply at github.com
Wed Sep 18 23:20:58 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 98862c0184b0b513c5bbd0562a5313bc6bb77f28
https://github.com/WebKit/WebKit/commit/98862c0184b0b513c5bbd0562a5313bc6bb77f28
Author: Sam Weinig <sam at webkit.org>
Date: 2024-09-18 (Wed, 18 Sep 2024)
Changed paths:
A LayoutTests/fast/css/color-computed-contrast-color-function-expected.txt
A LayoutTests/fast/css/color-computed-contrast-color-function.html
A LayoutTests/fast/css/color-invalid-contrast-color-function-expected.txt
A LayoutTests/fast/css/color-invalid-contrast-color-function.html
A LayoutTests/fast/css/color-valid-contrast-color-function-expected.txt
A LayoutTests/fast/css/color-valid-contrast-color-function.html
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/css/CSSValueKeywords.in
A Source/WebCore/css/color/CSSContrastColorResolver.cpp
A Source/WebCore/css/color/CSSContrastColorResolver.h
A Source/WebCore/css/color/CSSContrastColorSerialization.h
M Source/WebCore/css/color/CSSUnresolvedColor.h
A Source/WebCore/css/color/CSSUnresolvedContrastColor.cpp
A Source/WebCore/css/color/CSSUnresolvedContrastColor.h
M Source/WebCore/css/color/StyleColor.cpp
M Source/WebCore/css/color/StyleColor.h
A Source/WebCore/css/color/StyleContrastColor.cpp
A Source/WebCore/css/color/StyleContrastColor.h
M Source/WebCore/css/parser/CSSParserContext.cpp
M Source/WebCore/css/parser/CSSParserContext.h
M Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.cpp
M Source/WebCore/platform/graphics/Color.cpp
M Source/WebCore/platform/graphics/ColorLuminance.cpp
M Source/WebCore/platform/graphics/ColorLuminance.h
Log Message:
-----------
Implement contrast-color( <color> max? ) CSS function
https://bugs.webkit.org/show_bug.cgi?id=279735
Reviewed by Darin Adler.
Adds support for CSS Color Module 5's contrast-color() function.
Currently behind the feature flag CSSContrastColorEnabled with an
initial status of testable.
The current resolver is extremely naive, only ever choosing either
the color 'black' or the color 'white', depending on which would
give the greatest contrast, which appears to be within spec, though
clearly non-ideal. Further discussion is needed to work out an
optimal algorithm for color selection.
* LayoutTests/fast/css/color-computed-contrast-color-function-expected.txt: Added.
* LayoutTests/fast/css/color-computed-contrast-color-function.html: Added.
* LayoutTests/fast/css/color-invalid-contrast-color-function-expected.txt: Added.
* LayoutTests/fast/css/color-invalid-contrast-color-function.html: Added.
* LayoutTests/fast/css/color-valid-contrast-color-function-expected.txt: Added.
* LayoutTests/fast/css/color-valid-contrast-color-function.html: Added.
- Parsing and resolution tests.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
- Add new feature flag.
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
- Add new files.
* Source/WebCore/css/CSSValueKeywords.in:
- Add new keyword, 'contrast-color'.
* Source/WebCore/css/parser/CSSParserContext.cpp:
* Source/WebCore/css/parser/CSSParserContext.h:
- Add flag for contrast-color() feature flag.
* Source/WebCore/css/color/CSSContrastColorResolver.cpp: Added.
* Source/WebCore/css/color/CSSContrastColorResolver.h: Added.
- Implements a naive resolver that just chooses white or black.
* Source/WebCore/css/color/CSSContrastColorSerialization.h: Added.
- Generic serializer for use by either the unresolved or
style implementation.
* Source/WebCore/css/color/CSSUnresolvedContrastColor.cpp: Added.
* Source/WebCore/css/color/CSSUnresolvedContrastColor.h: Added.
* Source/WebCore/css/color/CSSUnresolvedColor.h:
- Adds CSSUnresolvedContrastColor variant value.
* Source/WebCore/css/color/StyleContrastColor.cpp: Added.
* Source/WebCore/css/color/StyleContrastColor.h: Added.
* Source/WebCore/css/color/StyleColor.cpp:
* Source/WebCore/css/color/StyleColor.h:
- Add StyleContrastColor variant value. This is needed for the case
that currentColor is used with the contrast-colors input color.
* Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.cpp:
- Implement parsing of contrast-color().
* Source/WebCore/platform/graphics/ColorLuminance.cpp:
* Source/WebCore/platform/graphics/ColorLuminance.h:
- Add helper to compute relative luminance from a WebCore::Color.
Canonical link: https://commits.webkit.org/283900@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