[webkit-changes] [WebKit/WebKit] cf0675: Hue interpolation "specified" is not correctly imp...
Sam Weinig
noreply at github.com
Sat Sep 24 19:25:44 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cf0675f3297a9890c3a7bb0226896b0904caa958
https://github.com/WebKit/WebKit/commit/cf0675f3297a9890c3a7bb0226896b0904caa958
Author: Sam Weinig <weinig at apple.com>
Date: 2022-09-24 (Sat, 24 Sep 2022)
Changed paths:
A LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-hsl-expected-mismatch.html
A LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-hsl.html
A LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-hwb-expected-mismatch.html
A LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-hwb.html
A LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-lch-expected-mismatch.html
A LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-lch.html
A LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-oklch-expected-mismatch.html
A LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-oklch.html
M LayoutTests/platform/glib/TestExpectations
M Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp
M Source/WebCore/platform/graphics/ColorConversion.cpp
M Source/WebCore/platform/graphics/ColorInterpolation.cpp
M Source/WebCore/platform/graphics/ColorModels.h
M Source/WebCore/platform/graphics/ColorNormalization.h
M Source/WebCore/platform/graphics/ColorSerialization.cpp
Log Message:
-----------
Hue interpolation "specified" is not correctly implemented for hues < 0 or > 360
https://bugs.webkit.org/show_bug.cgi?id=245552
<rdar://100344615>
Reviewed by Darin Adler.
Defers normalization of the hue component of lch(), oklch(), hsl() and hwb()
colors until necessary, such as due to a color conversion, non-"specified" hue
interpolation method use or serialization (though that one is unclear and is
with the spec editors to decide on via https://github.com/w3c/csswg-drafts/issues/7782).
By deferring this normalization, we now implement the "specified" hue interpolation
method correctly, which explicitly allows for a hue to rotate around the spectrum
multiple times if the difference between angles requires it.
To support this for hsl() and hwb(), which usually are stored as 8-bit sRGB, we use
the same technique as was employed for "none" support, and conditionally use their
extended form if an angle < 0 or > 360 is provided. This means that in the common
cases there will be no change in memory usage.
Additionally, I update the "longer" hue interpolation method to match the updated
spec which changed a "< 0" to a "<= 0".
Tests were added to show that gradients that prior to this change would render the
same due to angle normalization, now render differently.
* LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-hsl-expected-mismatch.html: Added.
* LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-hsl.html: Added.
* LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-hwb-expected-mismatch.html: Added.
* LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-hwb.html: Added.
* LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-lch-expected-mismatch.html: Added.
* LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-lch.html: Added.
* LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-oklch-expected-mismatch.html: Added.
* LayoutTests/fast/gradients/gradient-using-specified-hue-interpolation-method-oklch.html: Added.
* Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::colorByNormalizingHSLComponents):
(WebCore::CSSPropertyParserHelpers::parseHWBParameters):
(WebCore::CSSPropertyParserHelpers::parseLCHParameters):
* Source/WebCore/platform/graphics/ColorConversion.cpp:
(WebCore::HSLA<float>>::convert):
(WebCore::HWBA<float>>::convert):
* Source/WebCore/platform/graphics/ColorInterpolation.cpp:
(WebCore::fixupHueComponentsPriorToInterpolation):
* Source/WebCore/platform/graphics/ColorModels.h:
* Source/WebCore/platform/graphics/ColorNormalization.h:
(WebCore::makeColorTypeByNormalizingComponents<HWBA<float>>):
(WebCore::makeColorTypeByNormalizingComponents<HSLA<float>>): Deleted.
(WebCore::makeColorTypeByNormalizingComponents<LCHA<float>>): Deleted.
(WebCore::makeColorTypeByNormalizingComponents<OKLCHA<float>>): Deleted.
* Source/WebCore/platform/graphics/ColorSerialization.cpp:
(WebCore::serializationOfLabLikeColorsForCSS):
(WebCore::serializationOfLCHLikeColorsForCSS):
(WebCore::serializationForCSS):
(WebCore::serializationOfLabFamilyForCSS): Deleted.
Canonical link: https://commits.webkit.org/254833@main
More information about the webkit-changes
mailing list