Skip to content

[css-color-4] #10695 Fix rgbToHwb to use subset of rgbToHsl that only computes the hue #10718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

squelart
Copy link
Contributor

@squelart squelart commented Aug 9, 2024

Tests related to out-of-gamut relative colors [css-color-5] already implicitly match this corrected behavior.

…nly computes the hue

Tests related to out-of-gamut relative colors [css-color-5] already implicitly match the corrected behavior.
@svgeesus svgeesus merged commit ead8668 into w3c:main Aug 9, 2024
1 check passed
squelart added a commit to squelart/WebKit that referenced this pull request Aug 9, 2024
…algorithm

https://bugs.webkit.org/show_bug.cgi?id=277538
rdar://133045692

Reviewed by NOBODY (OOPS!).

The suggested rgbToHwb algorithm at https://drafts.csswg.org/css-color-4/#rgb-to-hwb
used to use rgbToHsl to compute the hue, discarding the saturation and lightness.
But rgbToHsl special-cases negative saturations (possible with out-of-gamut colors),
and flips the hue in that case, resulting in incorrect out-of-gamut HWB values.
This was fixed in w3c/csswg-drafts#10718

This patch here replicates w3c/csswg-drafts#10718 in the
equivalent WebKit function, it fixes failures in
relative-color-out-of-gamut-expected.html, but also in
color-mix-out-of-gamut-expected.html.

* LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-mix-out-of-gamut-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/relative-color-out-of-gamut-expected.txt:
* Source/WebCore/platform/graphics/ColorConversion.cpp:
(WebCore::ExtendedSRGBA<float>>::convert):
webkit-commit-queue pushed a commit to squelart/WebKit that referenced this pull request Aug 11, 2024
…algorithm

https://bugs.webkit.org/show_bug.cgi?id=277538
rdar://133045692

Reviewed by Tim Nguyen.

The suggested rgbToHwb algorithm at https://drafts.csswg.org/css-color-4/#rgb-to-hwb
used to use rgbToHsl to compute the hue, discarding the saturation and lightness.
But rgbToHsl special-cases negative saturations (possible with out-of-gamut colors),
and flips the hue in that case, resulting in incorrect out-of-gamut HWB values.
This was fixed in w3c/csswg-drafts#10718

This patch here replicates w3c/csswg-drafts#10718 in the
equivalent WebKit function, it fixes failures in
relative-color-out-of-gamut-expected.html, but also in
color-mix-out-of-gamut-expected.html.

* LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/color-mix-out-of-gamut-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-color/parsing/relative-color-out-of-gamut-expected.txt:
* Source/WebCore/platform/graphics/ColorConversion.cpp:
(WebCore::ExtendedSRGBA<float>>::convert):

Canonical link: https://commits.webkit.org/282101@main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants