Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cdbc8c4bc2740024cfe85fa50043589b02e5166e
      
https://github.com/WebKit/WebKit/commit/cdbc8c4bc2740024cfe85fa50043589b02e5166e
  Author: Sam Weinig <[email protected]>
  Date:   2026-06-21 (Sun, 21 Jun 2026)

  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-color-mix-function.html
    M Source/WebCore/platform/graphics/ColorConversion.h

  Log Message:
  -----------
  [Color] Add support for analogous set missing component forwarding
https://bugs.webkit.org/show_bug.cgi?id=317497

Reviewed by Darin Adler.

When converting a color to into the interpolation colorspace, CSS Color 4 has 
added
an additional rule for forwarding missing components.

Previously, if a component in the input was missing (e.g. none, or internally 
NaN) and
there was an "analogous" component in the output colorspace, the missing value 
would be
"forwarded" to the output in the analogous components index. For example, when 
converting
`oklab(none 0.1 0.2)` to `oklch` for interpolation, the result of that 
conversion would
be an `oklch(none 0.223 63deg)` because the lightness component in both 
colorspaces are
said to be analogous. WebKit already supports this.

More recently, the additional concept of "analogous sets" was added. An 
"analogous set"
for a conversion is comprised of all the components that don't have analogous 
components.
Taking the example from above of conversion from `oklab` to `oklch` for 
interpolation,
`lightness` (and `alpha`, but is always analogous) is the only "analogous" 
component, so
the `{a,b}` components from `oklab` form an analogous set with the `{c,h}` 
components from
`oklch`. The rule for an "analogous set" is that all the components of the set 
must be
missing for them to forward. For example, when converting `oklab(0.2 none 
none)` to `oklch`
for interpolation, the result of that conversion would be `oklch(0.2 none 
none)` because
all the components in the analogous set were missing. If only one had been 
missing, like
in `oklab(0.2 none 0.1)`, the missing value would not be forwarded.

See https://drafts.csswg.org/css-color-4/#analogous-set.

* 
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-color-mix-function.html:
* Source/WebCore/platform/graphics/ColorConversion.h:

Canonical link: https://commits.webkit.org/315569@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to