-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
color-mix() tests look wrong. #34158
Comments
Looks like https://drafts.csswg.org/css-color-5/#resolving-color-values needs a section on Now we don't have to track all the system colors, the result should be either a |
Or if one of them is a custom property. So yeah, at computed-value time. |
Custom properties would work at parse time... I don't know, maybe it'd be ok to resolve as eagerly as possible, sorta like calc() does. Maybe @tabatkins has opinions? |
But yeah system colors and currentColor would need to wait until computed value time at least, because color-scheme and such affect how they resolve. |
Hi @emilio. Can you give me an example of one of the tests (perhaps a line in color-mix-computed.html?) that you think is wrong? I left our any tests of |
(actually, one thing that does look wrong, or rather probably just outdated, is that the |
@weinig All the tests in FWIW in general I'd rather serialize srgb colors as rgb/rgba, both for simplicity, but also because that way we can work on the different color-5 features more independently (we don't need to implement But I guess that's a different topic altogether anyways :) |
@emilio I think the spec is clear on how to serialize all the examples of As for not needing |
Well, sure. The thing is whether we should serialize the result at specified-value time vs at computed-value time, right? Which is w3c/csswg-drafts#7302.
That's fair enough. |
(To clarify, I think depending on the answer of w3c/csswg-drafts#7302, those examples in |
Sorry, so, I just want to make sure I understand, so let's just take one test line, like this one from color-mix-valid.html: test_valid_value(`color`, `color-mix(in hsl, hsl(120deg 10% 20%), hsl(30deg 30% 40%))`, `rgb(84, 92, 61)`); Is your assertion that the this should instead be: test_valid_value(`color`, `color-mix(in hsl, hsl(120deg 10% 20%), hsl(30deg 30% 40%))`, `color-mix(in hsl, hsl(120deg 10% 20%), hsl(30deg 30% 40%))`); |
Yes (or just omitting the third argument) |
Well actually it should probably use rgb() because browsers historically convert hsl to rgb at parse time... Colors are quite messy.. :( |
It's not clear to me there is much value in preserving all that for serialization when a more compact representation is available. Sure, for cases like As for the using legacy rgb() for hsl/hwb color-mix(). This was how things worked originally, but it was explicitly change to use color(srgb ...) to avoid the precision loss associated with legacy rgb() (which would be unfortunate in a mixing use case). |
I guess this really comes down to how import is preserving the full fidelity or the original source text input when round tripping in this context. |
I made sure the new fixes are covered. There are still a bunch of failures. Those can be explained by: * web-platform-tests/wpt#34158 (tests expecting color-mix() to go away at parse time) * Off-by-one in the color channels (so float precision errors). * Unimplemented features like the color() function. Differential Revision: https://phabricator.services.mozilla.com/D147008
I made sure the new fixes are covered. There are still a bunch of failures. Those can be explained by: * web-platform-tests/wpt#34158 (tests expecting color-mix() to go away at parse time) * Off-by-one in the color channels (so float precision errors). * Unimplemented features like the color() function. Differential Revision: https://phabricator.services.mozilla.com/D147008
The tests introduced in #31902 and #32711 look wrong to me. They expect
color-mix()
to go away at parse-time, which seems incorrect sincecurrentColor
can't go away at parse time, so at the very leastcolor-mix
should be resolved at computed-value time.cc @weinig @svgeesus @nt1m
The text was updated successfully, but these errors were encountered: