servo: DOMMatrix rotate() gives wrong value

new DOMMatrix().rotate(90, 0, 0);
// Gives
// [ 1,  0,  0,  0,
//   0,  0, -1,  0,
//   0,  1,  0,  0,
//   0,  0,  0,  1]
// ... while the expected value is:
// [ 1,  0,  0,  0,
//   0,  0,  1,  0,
//   0, -1,  0,  0,
//   0,  0,  0,  1]

Relevant code:

https://github.com/servo/servo/blob/7a1db0e8eaef9f615bedc08e23254bd79510de08/components/script/dom/dommatrixreadonly.rs#L302-L308

Could this be a euclid bug, as it seems it internally uses 3D rotation matrix designed for column-major matrices while being row-major?

https://drafts.csswg.org/css-transforms-2/#Rotate3dDefined

https://github.com/servo/euclid/blob/ee39c3c7ee3da9b61386f98f3f955d2b43855873/src/transform3d.rs#L591

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Yeah, looking closely it looks like that function in euclid was written with column vectors in mind.

What a mess.

Temporary fix would be to transpose the output of euclid.