Skip to content
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

[css-color-4] Conversion of hsl(none none none) to srgb clarification. #42677

Closed
tiaanl opened this issue Oct 22, 2023 · 4 comments
Closed

[css-color-4] Conversion of hsl(none none none) to srgb clarification. #42677

tiaanl opened this issue Oct 22, 2023 · 4 comments

Comments

@tiaanl
Copy link
Contributor

tiaanl commented Oct 22, 2023

In the tests here:

https://github.com/web-platform-tests/wpt/blob/master/css/css-color/parsing/color-computed-color-mix-function.html#L80

There is a test with color-mix(in hsl, hsl(none none none), hsl(none none none)) which should result in hsl(none none none) (and it does), but then of course will be converted to srgb for serialization. That result is color(srgb none none none), which I'm not sure how it is calculated.

Chrome passes the test, but that seems to be a bug. They never clear the none flags after conversion to srgb, so color-mix(in hsl, hsl(30deg 40% none), hsl(30deg 40% none)) would result in color(srgb 0 0 none), just because lightness was none.

I think we should change the test to color(srgb 0 0 0)?

@svgeesus
Copy link
Contributor

From “Missing” Color Components and the none Keyword (my emphasis)

For handling of missing component in color interpolation, see § 12.2 Interpolating with Missing Components.

For all other purposes, a missing component behaves as a zero value, in the appropriate unit for that component: 0, 0%, or 0deg. This includes rendering the color directly, converting it to another color space, performing computations on the color component values, etc.

So yes, when the color() function is serialized is will have 0 not none.

@tiaanl
Copy link
Contributor Author

tiaanl commented Oct 23, 2023

Perfect, will update the test. Thank! 👍

@tiaanl tiaanl closed this as completed Oct 23, 2023
moz-wptsync-bot pushed a commit that referenced this issue Oct 24, 2023
This fixes a test where serializing `none` values should be treated as
`0` for hsl and hwb.

See: #42677

Differential Revision: https://phabricator.services.mozilla.com/D191691

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1860661
gecko-commit: 5ff1ceab2635be491fdda5ca61c10560f732ba39
gecko-reviewers: jwatt
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Oct 24, 2023
…jwatt

This fixes a test where serializing `none` values should be treated as
`0` for hsl and hwb.

See: web-platform-tests/wpt#42677

Differential Revision: https://phabricator.services.mozilla.com/D191691
moz-wptsync-bot pushed a commit that referenced this issue Oct 24, 2023
This fixes a test where serializing `none` values should be treated as
`0` for hsl and hwb.

See: #42677

Differential Revision: https://phabricator.services.mozilla.com/D191691

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1860661
gecko-commit: 5ff1ceab2635be491fdda5ca61c10560f732ba39
gecko-reviewers: jwatt
vinnydiehl pushed a commit to vinnydiehl/mozilla-unified that referenced this issue Oct 25, 2023
…jwatt

This fixes a test where serializing `none` values should be treated as
`0` for hsl and hwb.

See: web-platform-tests/wpt#42677

Differential Revision: https://phabricator.services.mozilla.com/D191691
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 30, 2023
…jwatt

This fixes a test where serializing `none` values should be treated as
`0` for hsl and hwb.

See: web-platform-tests/wpt#42677

Differential Revision: https://phabricator.services.mozilla.com/D191691

UltraBlame original commit: 5ff1ceab2635be491fdda5ca61c10560f732ba39
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 30, 2023
…jwatt

This fixes a test where serializing `none` values should be treated as
`0` for hsl and hwb.

See: web-platform-tests/wpt#42677

Differential Revision: https://phabricator.services.mozilla.com/D191691

UltraBlame original commit: 5ff1ceab2635be491fdda5ca61c10560f732ba39
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 30, 2023
…jwatt

This fixes a test where serializing `none` values should be treated as
`0` for hsl and hwb.

See: web-platform-tests/wpt#42677

Differential Revision: https://phabricator.services.mozilla.com/D191691

UltraBlame original commit: 5ff1ceab2635be491fdda5ca61c10560f732ba39
@mysteryDate
Copy link
Contributor

mysteryDate commented Nov 9, 2023

So, the key verbiage here from the spec is "converting it to another color space"? When the resulting hsl color is converted to srgb for serialization, the nones will get replaced with zeroes?

@mysteryDate
Copy link
Contributor

Since RCS with hsl/hwb/legacy rgb involve color space conversion, would explicit "nones" become zeros here too? i.e.:

hsl(from blue none none none) = color(srgb 0 0 0)?

Does this look a little weird with legacy rgb?
rgb(from blue none none none) = color(srgb 0 0 0)?

And then, does this also apply to alpha?
rgb(from blue r g b / none) = color(srgb 0 0 1 / 0)?

while:
color(srgb from blue r g b / none) = color(srgb 0 0 1 / none)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants