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
Test oklab()/oklch() with lightness close to 0/1 #45073
Test oklab()/oklch() with lightness close to 0/1 #45073
Conversation
I am adding these tests so that implementing the same behavior as Chrome would fail these tests, to make the discontinuity that results from special-casing lightness 100% very obvious. |
3313f54
to
2937067
Compare
I've updated this PR to also test a color with lightness close to 0. |
2937067
to
e41fa48
Compare
https://wpt.fyi/results/css/css-color?label=pr_head&max-count=1&pr=45073 is updated now and what I expected. The ones close to 0 aren't very interesting to look at, the problem is that the channel values aren't quite zero, but you need to know it to see it. Here is Chrome, Firefox and Safari for oklab-l-almost-1.html, since there aren't screenshots for passing tests. Chrome: Firefox and Safari both look like this: That's it. Please review :) |
The tests look very convincing to me that this discontinuity is very unfortunate 👍 But are they following the spec ? The wording of the spec "displayed as black ..due to gamut mapping to the display" seems to indicate that the discontinuity should not happen because a proper gamut mapping should prevent it ? Which mapping ? cc @svgeesus |
AFAIK, the spec doesn't say anything normative to the effect of "no large discontinuities" so the tests are written from a place of "something this close must round to the same thing". I deliberately avoiding depending on what the color(s) actually are, to shine a light on the interoperability issue here. Other tests could test the colors of 0 / 0.0001% / 99.9999% / 1, it's just not what I was trying to isolate out here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hoping @svgeesus can look at the substance here, but I have one wording comment:
I've sent #45092 to update the tests I took inspiration from. If that lands, I can make these tests match that style. |
This is an interop issue where Chrome's behavior is different from Firefox and Safari's: https://crbug.com/329106317 These tests don't care what the color is, as long as it is the same.
e41fa48
to
fa52cdd
Compare
I was impatient, so I've updated to match #45092 before it lands. It's easy to change the class names or wording if a reviewer asks for that. |
The spec used to say that L <=0 (black) and L>= 100% (white) got clamped, which effectively mandated a discontinuity between, say, 99.98% and 100.02%. It was changed to say that this was caused by gamut mapping to the display, which has two benefits:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the special casing is no longer in the spec so this undesirable discontinuity used to be spec compliant but no longer is.
Thanks for review and the spec background @svgeesus! |
This is an interop issue where Chrome's behavior is different from
Firefox and Safari's: https://crbug.com/329106317
These tests don't care what the color is, as long as it is the same.