-
Notifications
You must be signed in to change notification settings - Fork 665
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-adjust-1] Disallow repetition of color-scheme keywords? #3848
Comments
I don't see a useful meaning to it, so I'd support dropping this. |
I suspect @lilles did that because if we allow parsing arbitrary identifiers for future compat, then you need to keep some kind of hash set of strings or such while parsing the property, to know if there are duplicates (since the engine doesn't have any internal representation for those)... But I'm not sure why parsing arbitrary identifiers is ok, it seems undesirable, at least from the |
Because CSS isn't super-great at handling properties that are additive sets in the first place, let alone ones that'll expand over time. It would really suck if you designed your page to handle all the color schemes, including the new |
Well, I mean, you'd use something like |
Otherwise there's no way to know if the UA actually supports the sepia color-scheme. |
Even if the UA knows about |
Ah, ok, fine then, sorry for the noise :) |
We do allow repetition of property names in transition-property, and names in animation-name, for instance. |
They don't go away in the computed style as mentioned on the original comment on this issue though, right? I think Rune's argument about consistency with these other properties makes sense. |
I am fine with keeping all names in the computed style. The current draft requires the order has to be kept as well. I drafted the way I did for computed style mainly to make it efficient to evaluate the used value in the implementation without recomputing style or used values for on preferred color scheme changes. |
I was wondering about that - your spec contained a comment about being able to collapse the computed value down to a bitset, but it also made order important for |
Yeah, storing it as a bitset is also incompatible with preserving unknown identifiers, afaict. FWIW, the way will-change and such is implemented in Firefox is keeping the known properties in a bitfield, and the specified value in a separate array. So you pay a bit more memory (on byte) more than the array of names, but get fast checking: But it's not clear to me that's what @lilles refers to, necessarily... Not sure how not keeping duplicated names helps to handle color scheme changes dynamically. I'd be curious to know though :) |
@tabatkins @emilio never mind the bitset thing. It assumed order of the known color-schemes didn't matter. Currently, the spec says only to keep recognized color-schemes. Doing the implementation here, I'm currently keeping all as specified. Should we just let computed style be 'auto' or optional 'only' followed by the color schemes in the order they were specified? WDYT? |
I think keeping them as specified is better, since it matches will-change and similar properties that right now take an arbitrary amount of idents. Any reason not to do that? |
Sounds good to me. |
The benefit of collapsing down repetitions is to facilitate computed value comparisons, which is something we do for animations and transitions. It might not matter so much in this particular property, but we should set a good precedent for future properties. |
@fantasai Your proposal is to allow repetitions, but only keep the first instance of a repeated color scheme, so that specified -> computed becomes: light dark blah light -> light dark blah ? |
Where?
I'd rather not make specified and computed value differ unnecessarily. |
@emilio the repeated values in The general rule about simplifying computed style to not include redundant content is useful for animations and transitions in the sense that it makes it easier for the animation engines to know if two values are different & how to match them up for interpolating between them. But that said, I don't think animations and transitions are important for this property. And I can't actually think of another property that allows arbitrary repeats of tokens but collapses them in the computed value. @fantasai do you have specific examples? |
The CSS Working Group just discussed
The full IRC log of that discussion<dael> Topic: Disallow repetition of color-scheme keywords?<dael> github: https://github.com//issues/3848 <futhark> I was trying but Tab can present <dael> TabAtkins: for future extensibility we allowed arbitrary keywords and they're ignored. Question is what happens when you repeat color-scheme keyword? We don't want to disallow, but do we keep it in computed value? Collapse along the way? <dael> TabAtkins: No strong argument either way <dael> TabAtkins: originally thoguth there was an efficiency argument but that's not true if trying to preserve unknown. I think conclusion is keep the same and don't simplify. <dael> TabAtkins: Just have computed value = specified value <futhark> I’m fine with either, it’s just that dropping duplicates means having to keep track of them during parsing <dael> astearns: Any comments? <futhark> Which requires a hash map or something <dael> astearns: So close no change? <dael> TabAtkins: I don't recall current state <dael> TabAtkins: Let me look <dael> TabAtkins: It would be changing spec <fantasai> Proposal is to resolve no change [in the value] :) <dael> astearns: That computed is same as specified value <dael> TabAtkins: Yes <dael> astearns: Obj to computed value of color-scheme match its specified value? <dael> RESOLVED: computed value of color-scheme match its specified value |
[css-color-adjust-1] Don't drop repeated keywords from computed color-scheme. Issue #3848.
Currently 'color-scheme' is defined to allow repeated keywords, like
color-scheme: light light
, and the repetitions are just dropped from the computed value.I copied this from Rune's initial spec, but I'm not sure if we want it; we don't usually allow meaningful things to be repeated. Would it be okay to just call this invalid?
The text was updated successfully, but these errors were encountered: