-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
"parse a CSS <color> value" should take into account that currentColor can be nested in color-mix() #9940
Comments
This seems like another case where new CSS features regressed HTML. That argues for changing the layering such that HTML calls even more directly into CSS and CSS maintains the API such that it doesn't break when new features are added. cc @tabatkins @svgeesus @whatwg/css |
I think the expected result here is clear, it is the behavior that you are planning to implement in Servo. Which is just replacing the usages of currentColor with what the HTML spec defines, then taking the computed color. I would consider this as implementation bugs rather than a spec issue. I don't think the spec has any ambiguity here. |
I guess the CSS spec could define a "resolve a color algorithm" that takes in a parameter that is the current color. |
I still think it's a spec issue, because https://html.spec.whatwg.org/multipage/infrastructure.html#parsed-as-a-css-color-value says
So it's not covering CSS already has https://drafts.csswg.org/css-color/#resolving-color-values, I guess HTML could invoke that but overriding the resolution of |
It would be good if CSS had a dedicated entry point for this that it would commit to supporting long term. We've seen here that locally overriding something is not tenable so we should not move to a solution that still does that. |
Yeah, we can make an algo for that, that can take an optional element to supply the context-specific data. (There's more than just currentcolor; the system keywords need an element ref to know what color scheme to be.) |
Okay, check https://drafts.csswg.org/css-color-4/#parse-color in a few minutes. |
Seems to assume there is a used value. Do we have a used value with |
For colors? Not sure why we wouldn't, yeah. |
@tabatkins I think that implies a change from opaque black to CanvasText. And I guess by default that does the correct thing, but not sure it always does? |
It will always do the "correct" thing, aka "give the same color you'd get if you put that value into a CSS property on the element". And without an element for context, in theory it could give something besides opaque black, but in practice with |
Nice, but also needs a copy in CSS Color 5, because Color 4 doesn't have, for example, Resolving color-mix() |
Also not covering |
I'm not sure I understand. The text covers future additions to When we un-delta Color 5 it'll move over, but I don't see any particular need to duplicate it right now. |
Okay, just checking. |
Our definition had issues such as not resolving currentcolor correctly when used as part of CSS color functions. Fixes #9940.
Thanks everyone. I put up #10175. |
Our definition had issues such as not resolving currentcolor correctly when used as part of CSS color functions. Fixes #9940.
@tabatkins, to be sure, parse-color should also be able to handle values set through CSS variables, right? Context: Currently no browser seems to support that. https://jsfiddle.net/6p5zusag/ |
What is the issue with the HTML Standard?
https://html.spec.whatwg.org/multipage/infrastructure.html#parsed-as-a-css-color-value
It assumes that
currentColor
, if present, needs to be the whole value of thecolor
property.However, this is perfectly valid:
So consider
The
shadowColor
ends up being#ff0000
in both Blink and WebKit, i.e. they rejectcolor-mix(in srgb, currentcolor, cyan)
, even though they accept it in CSS. They also rejectcolor-mix(in srgb, cyan, cyan)
even without a nestedcurrentcolor
.In Firefox,
shadowColor
becomes#008080
, so I guess it treatscurrentcolor
as#000000
, even though a lonecurrentcolor
would become#ffff00
.In Servo I plan to do what I think is more reasonable (modulo #8917) and produce
#80ff80
.The text was updated successfully, but these errors were encountered: