[css-random] Update random-computed.tentative.html WPT to fix percentage simplification cases
Categories
(Core :: CSS Parsing and Computation, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox161 | --- | fixed |
People
(Reporter: sajidanwar, Assigned: sajidanwar)
References
Details
Attachments
(1 external file)
Three cases in random-computed.tentative.html, related to simplification of percentages in random(), look like the WPT is wrong and Firefox/Safari is correct. Context: if a random() function has arguments that can't be simplified at computed-value time, then the key of the random() function must be replaced by fixed <number>.
border-image-slice: random(10%, 30%)- The test asserts that it should have
fixed, meaning Chrome is treating the percentages as not able to be simplified. But Chrome and Firefox agree thatborder-image-slice: min(10%, 30%)computes to10%, becauseborder-image-slicecomputes percentages as percentages. They're not computed relative to a basis, so I think the test is wrong and it should simplify.
- The test asserts that it should have
--transform-function: translate(random(30%, 10%))- The test asserts that it should not have
fixedand should compute totranslate(30%). Buttranslate()uses<length-percentage>when in a<transform-function>, so percentages can't be simplified. This computed value should havefixed.- (I remembered an open question about simplifying percentages in math functions, but just discovered that it was very recently resolved, so I think this case is clear: w3c/csswg-drafts#12131)
- The test asserts that it should not have
background-image: radial-gradient(at 30% random(33%, 1%), silver random(30%, 10%, 1%), gold random(70%, 10%, 1%))- The test asserts
fixedfor the first one (the gradient center), and simplified for the second and third (color stop positions). The<position>of the gradient center is a<length-percentage>, so that can't be simplified and must befixed. But the color stops are also<length-percentage>, so they also can't be simplified.
- The test asserts
| Assignee | ||
Comment 1•1 month ago
|
||
Three cases in random-computed.tentative.html, related to simplification of percentages in
random(), look incorrect. When a random() function has arguments that can't be simplified
at computed-value time, then its key must be replaced by fixed <number>.
-
border-image-slice: random(10%, 30%)- Test asserts the result has the
fixedkey. However, becauseborder-image-slicecomputes
percentages as<percentage>, and not relative to a basis, percentages in the property can
be simplified. Thisrandom()should therefore simplify to10%.
- Test asserts the result has the
-
translate(random(30%, 10%))- Test asserts the
random()simplifies to30%. Buttranslate()uses<length-percentage>
when in a<transform-function>, so percentages can't be simplified. This computed value
should haverandom(fixed ..., 30%, 10%).
- Test asserts the
-
radial-gradient(at 30% random(33%, 1%), silver random(30%, 10%, 1%), gold random(70%, 10%, 1%))- Test asserts that the first
random()can't simplify (the gradient center) while the second
and third (color stop positions) can simplify. But in radial gradient syntax, all three are
<length-percentage>values that can't be simplified and must compute torandom(fixed ...).
- Test asserts that the first
See also: https://github.com/w3c/csswg-drafts/issues/12131 (simplification of percentages)
Updated•1 month ago
|
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/64287 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Updated•21 days ago
|
Description
•