[webkit-changes] [WebKit/WebKit] 4223b7: When interpolating colors, analogous components mu...

Sam Weinig noreply at github.com
Sat May 4 13:27:39 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4223b7f3eb559e7f06c7fcbe5a4ce9831f891390
      https://github.com/WebKit/WebKit/commit/4223b7f3eb559e7f06c7fcbe5a4ce9831f891390
  Author: Sam Weinig <weinig at apple.com>
  Date:   2024-05-04 (Sat, 04 May 2024)

  Changed paths:
    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-valid-relative-color-expected.txt
    M Source/WebCore/css/color/CSSResolvedColorMix.cpp
    M Source/WebCore/css/parser/CSSPropertyParserConsumer+Color.cpp
    M Source/WebCore/platform/graphics/Color.h
    M Source/WebCore/platform/graphics/ColorBlending.cpp
    M Source/WebCore/platform/graphics/ColorConversion.h
    M Source/WebCore/platform/graphics/ColorInterpolation.cpp
    M Source/WebCore/platform/graphics/ColorModels.h
    M Source/WebCore/platform/graphics/ColorSerialization.cpp
    M Source/WebCore/platform/graphics/cg/GradientRendererCG.cpp

  Log Message:
  -----------
  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



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