At the Hamburg Face-to-Face meeting earlier this month the CSS WG agreed to change currentColor so that it's a computed value (by changing the computed value lines of the properties that accept it). We should change our implementation to match. This is easy for: * border-color * outline-color * column-rule-color * text-decoration-color since we already have an implementation of this concept under a different name. It'll require a drop more work for things already stored in some sort of union or structure: * fill * stroke * gradient color stops * shadow colors and a little more still for the things we just store as nscolor: * background-color *-moz-border-*-colors * flood-color * lighting-color * stop-color This is a pretty useful simplification for the first four properties, though a bit more work for the others. Might want to wait until after bug 629882 lands.
The minutes from the meeting were: http://lists.w3.org/Archives/Public/www-style/2012May/0541.html and point to: http://www.w3.org/Style/CSS/Tracker/issues/244 which in turn points to: http://lists.w3.org/Archives/Public/www-style/2012Jan/0521.html http://lists.w3.org/Archives/Public/www-style/2012Jan/0936.html
A few notes: - we've already done this for text-emphasis-color, text-decoration-color, and -webkit-text-fill-color - we already have an implementation of this concept under another name (-moz-use-text-color) for border-color - it requires additional per-property code (like for the above properties) for all other CSS properties that take colors
I think we probably shouldn't make any more properties do this until we have the ability to interpolate between currentcolor and real colors. Otherwise we risk making the web depend on them *not* being interpolable, when we actually want them to be interpolable. See bug 1260543 and https://lists.w3.org/Archives/Public/www-style/2016Apr/0284.html .
This blocks stylo per the comment at https://github.com/servo/servo/blob/f16aac0e5d53fce673b884476a68b9439f6042ba/components/style/properties/gecko.mako.rs#L232
Hmmmm... currentcolor is so hard... I think we have three choices: 1. make stylo follow how gecko handle it currently (so access nsStyleColor when needed) 2. follow the WebKit way (which was implemented in bug 1260543 comment 15) and turn all currentcolor (except for 'color') to the real used-value time currentcolor 3. implement an internal version of blend() function (and push CSSWG to standardize it) The thrid way needs lots of work, but might be the best thing to do in long term. dbaron, what do you think?
(In reply to Xidorn Quan [:xidorn] (UTC+10) from comment #6) > Hmmmm... currentcolor is so hard... > > I think we have three choices: > 1. make stylo follow how gecko handle it currently (so access nsStyleColor > when needed) > 2. follow the WebKit way (which was implemented in bug 1260543 comment 15) > and turn all currentcolor (except for 'color') to the real used-value time > currentcolor > 3. implement an internal version of blend() function (and push CSSWG to > standardize it) > > The thrid way needs lots of work, but might be the best thing to do in long > term. So I believe current specs call for (2). Is the reason you're suggesting (3) so that animation works better with 'currentcolor' values? (That is a known risk for switching to what the spec wants.) But for animation, what's wrong with the standardized version at https://drafts.csswg.org/css-color-4/#blend-adjuster other than complexity?
Per discussion with dbaron on IRC: The current spec calls for making currentcolor not interpolatable with other color value, which isn't what we want. We can follow the WebKit way to treat currentcolor as a static value of "color" property at a given moment, which should not cause bigger compatibility issue in the future than our current behavior. But before we start implementing that way, we should bring it up in www-style to let other vendors know that we are going this way.
I'm going to work on this.
Assignee: nobody → xidorn+moz
It looks like Blink implements the full interpolation of currentcolor. I'm going to go that way as well. I think we can implement that without fully implementing blend() function. (The only issue is getComputedStyle(). But I guess it's fine to make resolved value of color properties to be used value later.)
(In reply to David Baron :dbaron: ⌚️UTC-7 (review requests must explain patch) from comment #7) > But for animation, what's wrong with the standardized version at > https://drafts.csswg.org/css-color-4/#blend-adjuster other than complexity? It seems the spec still doesn't say anything about how currentcolor should be interpolated with a numeric color value. The current interpolation approach for color value defined in CSS Transitions doesn't use this blenda function. Instead, it just does a linear interpolation on premultipled color channels. That means if we use blenda for interpolation between currentcolor value and numeric color value, we would have inconsistent behavior. In addition, it doesn't seem to me that the blenda function is something stable enough in the spec. There is still an issue calls for potential better formula  (as the current formula of blenda was determined empirically without any theory support), and I don't quite agree with some part of the current algorithm (the part how alpha channel is computed). I'd probably go with linear interpolation on premultipled color channels, then.  https://github.com/w3c/csswg-drafts/issues/305
Looks like Blink is using linear interpolation on premultipled color, FWIW.
Priority: P3 → P2
Summary: change 'currentColor' keyword to be a computed value (except for 'color' property) → stylo: implement currentColor
This is not a stylo bug.
Priority: P2 → P3
Summary: stylo: implement currentColor → change 'currentColor' keyword to be a computed value (except for 'color' property)
(In reply to Xidorn Quan [:xidorn] (UTC+10) from comment #13) > This is not a stylo bug. Oh I see, I didn't read the bug history carefully enough. Filed bug 1345709 for the stylo work item.
You need to log in before you can comment on or make changes to this bug.