Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tabatkins opened this issue Mar 6, 2020 · 2 comments
Open

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

tabatkins opened this issue Mar 6, 2020 · 2 comments
Labels
css-transforms-1 Current Work

Comments

@tabatkins
Copy link
Member

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?

@tabatkins tabatkins added the css-transforms-1 Current Work label Mar 6, 2020
@fantasai
Copy link
Collaborator

fantasai commented Mar 6, 2020

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.

@tabatkins
Copy link
Member Author

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
Labels
css-transforms-1 Current Work
Projects
None yet
Development

No branches or pull requests

2 participants