- From: CSS Meeting Bot via GitHub <sysbot+gh@w3.org>
- Date: Wed, 19 Mar 2025 17:04:50 +0000
- To: public-css-archive@w3.org
The CSS Working Group just discussed `[css-values-5] Maybe min, max and step should not be part of the random-caching-key`. <details><summary>The full IRC log of that discussion</summary> <fantasai> Proposal at https://github.com/w3c/csswg-drafts/issues/11742#issuecomment-2707697957<br> <emilio> TabAtkins: defining randomness in CSS because the execution model is not strictly temporal<br> <emilio> ... can't hold on to existing values<br> <emilio> ... don't want to calculate a random value on every recalc<br> <emilio> ... you need to have some stability<br> <emilio> ... the old draft did this via a caching key approach<br> <emilio> ... so if the key is the same between two instances of a random() function then the values need to be the same<br> <emilio> ... this caching key has changed tho<br> <emilio> ... author could provide a custom-ident, but also min/max/step values were pulled in<br> <emilio> ... any other random function would probably have a different step and thus generate a different random value<br> <emilio> ... this worked reasonably well but did mean that values could be accidentally linked together<br> <emilio> ... so random width/height you would get a random square<br> <emilio> ... rather than a random value<br> <fantasai> s/value/rectangle<br> <emilio> ... fantasai proposed something else, which is on the spec right now. Caching key is (property, index among random values in that property)<br> <emilio> ... so if you use `width: ...;` the key is (width, 0)<br> <emilio> fantasai: you don't want a global random<br> <emilio> ... caching key also includes the element identity<br> <emilio> ... all of that gets computed to a random value which they inherits so that we don't recalc it for inheritable properties<br> <emilio> TabAtkins: so on a single element if you use the same values on different properties you're guaranteed to get distinct values<br> <emilio> ... you can override it if you want, so you could still pass the same ident to width/height<br> <emilio> ... some good examples of this are in the spec<br> <emilio> ... don't know what people might need for this but I propose we accept the new draft based on elika's proposal for the different key<br> <emilio> q+<br> <emilio> ... one further question about bikeshedding the keyword name<br> <weinig> q+<br> <astearns> ack emilio<br> <fantasai> emilio: Is this declaration index thing local to each element you compute?<br> <fantasai> TabAtkins: There's a 2nd thing you can provide, which is a keyword indicating whether this value should be shared by all elements with this style, or be element-specific.<br> <fantasai> TabAtkins: Then it either includes the element identity in the caching key or not<br> <weinig> q-<br> <fantasai> emilio: Say you have 2 selectors with random() and you have an element that matches one, and another that matches both of them<br> <fantasai> emilio: so in one the index ...<br> <fantasai> TabAtkins: index is just the number of random() instances in that declaration.<br> <fantasai> TabAtkins: so for 'width' always index of zero<br> <fantasai> emilio: So if they're in different elements, they would be shared?<br> <fantasai> TabAtkins: if not adding extra "match-across-elements" keyword, then they all include element ident<br> <fantasai> TabAtkins: This is new, because CSS generally doesn't care where a value came from<br> <fantasai> TabAtkins: whether spell out in comma-separated selector list, or in a style attr, these are all the same<br> <fantasai> TabAtkins: I want to maintain that equivalence as much as possible<br> <fantasai> TabAtkins: so only including information from declaration it lives in. Nothing from style rule or selector.<br> <fantasai> emilio: So maybe some things that you would expect to work don't?<br> <fantasai> emilio: e.g. 10 elements, each with style blah: random()<br> <fantasai> emilio: ok, sounds good<br> <fantasai> TabAtkins: To be clear, having it vary by element is the default. You have to specify keyword to make it shared across elements.<br> <fantasai> TabAtkins: so common case would be what you expect there<br> <fantasai> emilio: seems reasonable<br> <fantasai> emilio: Shorthands maybe funny?<br> <fantasai> TabAtkins: it uses the declared property, e.g. in 'margin' you'd use 'margin' as part of the key, not the longhand names<br> <fantasai> TabAtkins: if you write 'margin: random(...)' you get equal margins on all four sides<br> <fantasai> TabAtkins: there's a bit of text in the draft about how this works for custom properties, it's a bit weird (unfortunately)<br> <fantasai> TabAtkins: unregistered vs registered properties, since the latter compute and the former don't before substitution<br> <fantasai> emilio: Might be confusing, but as long as we clarify impact of registration should be ok<br> <fantasai> astearns: over time<br> <astearns> ack fantasai<br> <emilio> fantasai: what we're trying to do is by default you get max randomness (varies by element, property, declaration index), but doesn't by where you declare it<br> <emilio> ... within an element you can make it shared by using the custom property<br> <emilio> ... can share across elements with the keyword tbd<br> <emilio> ... I think it's the right direction<br> <emilio> astearns: a bit concerned about oriol's comments<br> <fantasai> astearns: Concerned about Oriol not being convinced yet.<br> <emilio> TabAtkins: I feel strongly about this model<br> <emilio> fantasai: we should give oriol a chance to comment on here<br> <emilio> astearns: let's defer this to next week<br> </details> -- GitHub Notification of comment by css-meeting-bot Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11742#issuecomment-2737419031 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 19 March 2025 17:04:51 UTC