[css-values] Property-scoped random() should use different UA prefix when substituted early
Categories
(Core :: CSS Parsing and Computation, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: sajidanwar, Assigned: sajidanwar)
References
(Blocks 1 open bug)
Details
Attachments
(2 external files)
Bug 2080511 added support for arbitrary substitution functions that parse their arguments at substitution time (which is at computed value time). This is called early substitution and it affects the prefix used by property-scoped / property-index-scoped random keys. For example:
width: if(style(--level < random(0, 10)): random(0px, 100px))- Theif's condition is substituted early, so function is equivalent torandom(element-scoped ua-early-width-1, 0, 10). The branch value is substituted normally, so it is equivalent torandom(element-scoped ua-width-1, 0px, 100px).width: attr(data-width type(<length>))withdata-width="random(property-scoped, 0px, 100px)"- The attribute value is parsed as part of early substitution, so it is equivalent torandom(ua-early-width, 0px, 100px).animation-name: ident('animation-style-' random(1, 5, 1))- The arguments are substituted and parsed early in order to construct the ident, so the random function is equivalent torandom(element-scoped ua-early-animation-name-1, 1, 5, 1).
This requires adding a mode to the ParserContext to indicate early substitution.
| Assignee | ||
Comment 1•16 days ago
|
||
Bug 2080511 added support for arbitrary substitution functions that parse their
arguments at substitution/computed-value time. This is called early substitution
and it affects the prefix used by property-scoped / property-index-scoped random
keys -- for example, when random() is used in attribute values of a typed attr(),
the conditions of if(), or the ident() function.
Generating the correct <random-ua-ident> for such random keys requires adding a
parsing mode to indicate early substitution, and introducing a separate counter for
early random() functions. This patch also propagates the correct property name
through the entire substitution process.
Updated•16 days ago
|
| Assignee | ||
Comment 2•9 days ago
|
||
Comment 4•7 days ago
|
||
| bugherder | ||
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/65027 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Backed out for causing wpt failures at custom-property-explicit-inherit-invalidation.html
Backout link
Push with failures
Failure log(s)
| Assignee | ||
Comment 9•5 days ago
|
||
Failure for this patch is actually in random-computed.tentative.html, for example, this job. The root cause is that I have tests that try to test whether a <length> random value is using the expected ua-<PROPERTY>-<INDEX> identifier, by doing something like this (through arbitrary substitution functions):
margin: random(property-index-scoped, 1px, 300000px);
--registered-length: random(ua-margin-1, 1px, 300000px);
These should compute to the same value because the margin declaration should implicitly resolve to a ua-margin-1 random key.
The test failure occurs intermittently and is due to a serialization issue. Because margin is one of the properties that returns the used/resolved value from getComputedStyle, and Gecko represents layout values using fixed point app units, the value that the test sees may be slightly different from the --registered-length which is an f32. So for some large random values, the serialization can differ between the fixed and floating point values and can then fail the test.
So to fix, I'm changing this to use a 1px step so that the values are all representable and serialized the same.
Comment 10•5 days ago
|
||
Comment 11•5 days ago
|
||
| bugherder | ||
Comment 12•5 days ago
|
||
| bugherder | ||
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/65151 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Description
•