-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When interpolating colors, analogous components must be carried forward
https://bugs.webkit.org/show_bug.cgi?id=273033 Reviewed by Tim Nguyen. Adds support for missing analogous component forwarding as described by CSS Color 4 § 12. Color Interpolating. This allows missing components to survive color space conversion in cases where the input and output color spaces have analogous components. For example, when converting `lch(10 20 none)` to HSL, the missing hue in the LCH would be carried forward to the hue of the HSL. * 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-valid-relative-color-expected.txt: - Update results for newly passing tests. * Source/WebCore/platform/graphics/ColorModels.h: - Add analogous component values to the ColorModel component descriptions. * Source/WebCore/platform/graphics/ColorConversion.h: (WebCore::analogousComponentIndex): (WebCore::tryToCarryForwardComponentIfMissing): (WebCore::convertColorCarryingForwardMissing): - Implement support for the carrying using the analogous component descriptions now in ColorModels. (WebCore::computeDeltaEOK): (WebCore::ColorConversion::handleToFloatConversion): (WebCore::ColorConversion::handleToByteConversion): (WebCore::ColorConversion::toLinearEncoded): (WebCore::ColorConversion::toGammaEncoded): (WebCore::ColorConversion::toExtended): (WebCore::ColorConversion::toBounded): (WebCore::ColorConversion::handleRGBFamilyConversion): (WebCore::ColorConversion::handleMatrixConversion): - Remove some unnecessary "inline" annotations for template functions. * Source/WebCore/platform/graphics/Color.h: (WebCore::Color::toColorTypeLossyCarryingForwardMissing const): - Add new helper on Color to invoke the new conversion function. * Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.cpp: (WebCore::CSSPropertyParserHelpers::consumeAndNormalizeRelativeComponents): - Utilize the new conversion function. * Source/WebCore/css/color/CSSResolvedColorMix.cpp: (WebCore::mixColorComponentsUsingColorInterpolationMethod): - Utilize the new conversion function. * Source/WebCore/platform/graphics/ColorBlending.cpp: (WebCore::blend): - Utilize the new conversion function. * Source/WebCore/platform/graphics/ColorInterpolation.cpp: (WebCore::interpolateColors): - Utilize the new conversion function. * Source/WebCore/platform/graphics/ColorSerialization.cpp: (WebCore::serializationForCSS): - Utilize the new conversion function. * Source/WebCore/platform/graphics/cg/GradientRendererCG.cpp: (WebCore::GradientRendererCG::makeShading const): - Utilize the new conversion function. Canonical link: https://commits.webkit.org/278379@main
- Loading branch information
Showing
12 changed files
with
198 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.