Closed Bug 2086202 Opened 1 month ago Closed 1 month ago

[css-random] Update random-computed.tentative.html WPT to fix percentage simplification cases

Categories

(Core :: CSS Parsing and Computation, task)

task

Tracking

()

RESOLVED FIXED
161 Branch
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 that border-image-slice: min(10%, 30%) computes to 10%, because border-image-slice computes percentages as percentages. They're not computed relative to a basis, so I think the test is wrong and it should simplify.
  • --transform-function: translate(random(30%, 10%))
    • The test asserts that it should not have fixed and should compute to translate(30%). But translate() uses <length-percentage> when in a <transform-function>, so percentages can't be simplified. This computed value should have fixed.
      • (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)
  • background-image: radial-gradient(at 30% random(33%, 1%), silver random(30%, 10%, 1%), gold random(70%, 10%, 1%))
    • The test asserts fixed for 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 be fixed. But the color stops are also <length-percentage>, so they also can't be simplified.

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 fixed key. However, because border-image-slice computes
      percentages as <percentage>, and not relative to a basis, percentages in the property can
      be simplified. This random() should therefore simplify to 10%.
  • translate(random(30%, 10%))

    • Test asserts the random() simplifies to 30%. But translate() uses <length-percentage>
      when in a <transform-function>, so percentages can't be simplified. This computed value
      should have random(fixed ..., 30%, 10%).
  • 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 to random(fixed ...).

See also: https://github.com/w3c/csswg-drafts/issues/12131 (simplification of percentages)

Assignee: nobody → sajidanwar94
Status: NEW → ASSIGNED
Pushed by sajidanwar94@gmail.com: https://github.com/mozilla-firefox/firefox/commit/31481cf5b084 https://hg.mozilla.org/integration/autoland/rev/b3d4cb524af6 Update random-computed.tentative.html WPT to fix percentage simplification cases. r=firefox-style-system-reviewers,emilio

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/64287 for changes under testing/web-platform/tests

Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 161 Branch

Upstream PR merged by moz-wptsync-bot

QA Whiteboard: [qa-triage-done-c162/b161]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: