Closed Bug 1734472 Opened 3 years ago Closed 3 years ago

[css-transforms] WPT test rotate-parsing-valid.html and rotate-interpolation.html fail in Firefox, due to serialization issues

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED
95 Branch
Tracking Status
firefox95 --- fixed

People

(Reporter: dholbert, Assigned: boris)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This WPT test has 4 failures in Firefox:
https://wpt.fyi/results/css/css-transforms/parsing/rotate-parsing-valid.html?label=master&label=experimental&aligned&q=firefox%3Afail

The first failure looks like a real bug (albeit an edge case) -- we serialize rotate: 0 0 0 <angle> as rotate: x <angle>, which is wrong. The 0 0 0 values there represent a three-dimensional direction vector, which is used to determine the direction of the rotation. And if this direction vector is 0 0 0, then we're in a degenerate case and the rotation doesn't occur. So, this is not equivalent to an "x" rotation, despite us serializing it as such.

Reduced testcase for this specific issue -- this is expected to alert 0 0 0 400grad, but in Firefox, it instead alerts x 400grad:

data:text/html,<div id="me" style="rotate:0 0 0 400grad"></div><script>alert(me.style.rotate)</script>

The other 3 failures are more trivial; it looks like the test is expecting us to omit the z and just use single-value syntax in our serialization, when it's implied. Reduced testcase for this:

data:text/html,<div id="me" style="rotate:z 400grad"></div><script>alert(me.style.rotate)</script>

I'm not sure if this is strictly required anywhere, but it's in line with the shortest serialization principle, and it seems easy enough, unless we feel strongly that the test is wrong and that it's better to preserve the z in this case.

Severity: -- → S3

Note, the second issue (including z in the serialization of z <angle>) is the reason for our failures in this test, too:
https://wpt.fyi/results/css/css-transforms/animation/rotate-interpolation.html?label=master&label=experimental&aligned&q=firefox%3Afail

Both tests are in the compat2021 test set, for what it's worth, so it would be nice to get them passing if possible.

Assignee: nobody → boris.chiou
Summary: [css-transforms] WPT test rotate-parsing-valid.html fails in Firefox → [css-transforms] WPT test rotate-parsing-valid.html and rotate-interpolation.html fail in Firefox, due to serialization issues

The serialization of rotate should be updated to match the current spec.

  1. If a rotation about the z axis (that is, in 2D) is specified, the property
    must serialize as just an <angle>.

  2. If any other rotation is specified, the property must serialize with an axis
    specified. If the axis is parallel with the x or y axes, it must serialize
    as the appropriate keyword.

Also, zero length vector is parallel to every other vector, but the
serialization should be "0 0 0", instead of using x or y keyword.

Pushed by bchiou@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9564f8418cc2 Tweak the serialization of rotate property. r=emilio
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: