Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: bc5b392973637f900bd2f3d89cfb722f08aaedf5 https://github.com/WebKit/WebKit/commit/bc5b392973637f900bd2f3d89cfb722f08aaedf5 Author: Sam Weinig <wei...@apple.com> Date: 2024-04-21 (Sun, 21 Apr 2024)
Changed paths: M LayoutTests/TestExpectations M LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-computed-color-mix-function-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-computed-relative-color-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-invalid-relative-color-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-valid-hsl-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-valid-relative-color-expected.txt M LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/relative-color-out-of-gamut-expected.txt M LayoutTests/platform/glib/fast/css/hsl-color-expected.txt M LayoutTests/platform/ios/fast/css/hsl-color-expected.txt M LayoutTests/platform/mac/fast/css/hsl-color-expected.txt M LayoutTests/platform/wincairo/fast/css/hsl-color-expected.txt M Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.cpp M Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.h M Source/WebCore/html/canvas/CanvasStyle.cpp M Source/WebCore/platform/graphics/Color.cpp M Source/WebCore/platform/graphics/ColorConversion.cpp M Source/WebCore/platform/graphics/ColorConversion.h M Source/WebCore/platform/graphics/ColorModels.h M Source/WebCore/platform/graphics/ColorNormalization.h M Source/WebCore/platform/graphics/ColorTypes.h Log Message: ----------- Re-sync hsl()/hsla() implementation with the latest spec https://bugs.webkit.org/show_bug.cgi?id=272941 Reviewed by Darin Adler. The CSS Color specification has changed since hsl()/hsla() was last worked on. This updates things to support: - Modified parsing rules which now allow <number> in places that previously supported <percentage>. - Expanded value range for saturation and lightness, and a constricted value range for hue. - Changes to the types used by the h/s/l/alpha symbols used in the relative color form to always be CSS_NUMBER. - Update conversion to/from sRGB that accounts for expanded value range. Since the value range is legal for values greater than what bounded sRGB supports, the reference color space for HSLA was changed to ExpandedSRGB and unnecessary clipping to the bounded form (such as after interpolation) was removed. * LayoutTests/TestExpectations: Two tests that use the expanded range of hsl() expecting it to be clipped now fail and will need to be revised with the working group. (Since the tests are reference tests, they now depend on the how the graphics library used by the engine maps out of gamut colors and the display properties it is being shown on). * LayoutTests/TestExpectations Added two tests as new image only failures due to their dependence on an sRGB display and unspecified gamut mapping. Tracking with webkit.org/b/272940. * LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-computed-color-mix-function-expected.txt * LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-computed-relative-color-expected.txt * LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-invalid-relative-color-expected.txt * LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-valid-hsl-expected.txt * LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-valid-relative-color-expected.txt * LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/relative-color-out-of-gamut-expected.txt Update a good chunk of tests to now pass. We still see some hsl()/hsla() failures due to not implementing analogous component forwarding yet. Tracked via webkit.org/b/273033. * LayoutTests/platform/glib/fast/css/hsl-color-expected.txt * LayoutTests/platform/ios/fast/css/hsl-color-expected.txt * LayoutTests/platform/mac/fast/css/hsl-color-expected.txt * LayoutTests/platform/wincairo/fast/css/hsl-color-expected.txt This test had an out of gamut hsl() color which is now getting a slightly more green result. The render tree dump can't deal with out of gamut colors and we should probably fix that. Tracking with webkit.org/b/273032. * Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.cpp: (WebCore::CSSPropertyParserHelpers::consumeRGBOrHSLLegacyOptionalAlphaRaw): (WebCore::CSSPropertyParserHelpers::colorByResolvingHSLComponentsModern): (WebCore::CSSPropertyParserHelpers::colorByResolvingHSLComponentsLegacy): (WebCore::CSSPropertyParserHelpers::parseRelativeHSLParametersRaw): (WebCore::CSSPropertyParserHelpers::parseNonRelativeHSLParametersLegacyRaw): (WebCore::CSSPropertyParserHelpers::parseNonRelativeHSLParametersModernRaw): (WebCore::CSSPropertyParserHelpers::parseNonRelativeHSLParametersRaw): (WebCore::CSSPropertyParserHelpers::parseHSLParametersRaw): (WebCore::CSSPropertyParserHelpers::parseColorFunctionRaw): (WebCore::CSSPropertyParserHelpers::parseColorFunction): (WebCore::CSSPropertyParserHelpers::colorByNormalizingHSLComponents): Deleted. Rework consumers to match the spec. * Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.h: Add option to clamp hsl()/hsla() components at parse time for temporary use by the canvas code. * Source/WebCore/html/canvas/CanvasStyle.cpp: Opt into quirk hsl()/hsla() gamut clipping while the issue is being discussed in the working group. Tracking with webkit.org/b/272940. * Source/WebCore/platform/graphics/ColorTypes.h: Update clamping behavior to preserve angles by using modular arithmetic rather than strict max/min clamping. This is needed now that angles are once again restricted to 0-360. Update reference color space for HSLA to ExtendedSRGBA. * Source/WebCore/platform/graphics/ColorModels.h: (WebCore::UnresolvedColorType::anyComponentIsNone const): Expose a anyComponentIsNone() helper, moved from Color. Update HSLA model to restrict angle and allow any saturation/lightness. * Source/WebCore/platform/graphics/ColorNormalization.h: Remove automatic normalization of HSLA to 8-bit sRGB since we now allow out of gamut values. * Source/WebCore/platform/graphics/Color.cpp: (WebCore::Color::anyComponentIsNone const): Use the newly exposed anyComponentIsNone() function on UnresolvedColor. * Source/WebCore/platform/graphics/ColorConversion.cpp: (WebCore::ExtendedSRGBA<float>>::convert): (WebCore::HSLA<float>>::convert): * Source/WebCore/platform/graphics/ColorConversion.h: Update color conversion code to use update algorithm from the spec which allows for extended value ranges. Canonical link: https://commits.webkit.org/277795@main To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes