Skip to content

[css-transforms-1] How precise can we be about serialization? #4841

Open

Description

@tabatkins

So as part of some tests I'm writing, I'm using transform: rotate(90deg); and testing the serialization. As specified, at computed/used time this becomes a matrix(); no problem.

However! In Firefox, a 90deg rotation like that produces the nice, simple serialization of matrix(0, 1, -1, 0, 0, 0). In Chrome, it instead gives matrix(6.12323e-17, 1, -1, 6.12323e-17, 0, 0), aka two of the zeros are instead incredibly small non-zero values.

These two matrixes don't produce a rendering difference, but it sure makes it difficult to test serialization. How precisely do we want to specify this kind of thing? How do browsers test their own serialization in the face of issues like this?

Activity

  1. fantasai commented on Mar 6, 2020

    @fantasai
    Collaborator

    Question: does matrix(0, 1, -1, 0, 0, 0) round-trip in Chrome? If not, seems like a clear bug. If so, not equating it with rotate(90deg) seems like a rounding issue, maybe should be filed as QoI against Chrome.

  2. tabatkins commented on Mar 6, 2020

    @tabatkins
    MemberAuthor

    No, it doesn't round-trip; it serializes the same as above, with the epsilons in place of two of the zeros. I presume we're doing some math in radians and thus getting rounding errors.

    (For now I think I'll just generate the computed serialization for a rotate(90deg) and then expect that in the test, so as long as they match the test will pass. I'm not trying to test rotate() serialization, after all, but rather ensuring that math functions work on angles, and rotate() is the only reliable thing I can do that with.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions