W3C home > Mailing lists > Public > public-fxtf-archive@w3.org > May 2017

Re: [fxtf-drafts] [geometry] DOMMatrix stringifier behavior doesn't seem to match implementations

From: Amelia Bellamy-Royds via GitHub <sysbot+gh@w3.org>
Date: Wed, 10 May 2017 20:58:52 +0000
To: public-fxtf-archive@w3.org
Message-ID: <issue_comment.created-300610585-1494449930-sysbot+gh@w3.org>
Since it came up in the discussion, one practical case where a DOMMatrix would have infinite values is `skewX(90deg)` or `skewY(90deg)`.  That's a non-invertable operation, and in the `transform` property it causes the element to not be drawn (similar to `scale(0)`).  But it is still a valid transform function, and could reasonably occur as a start or end point in an animation.

Note: I just tested, and neither Chrome nor Firefox currently actually use `Infinity` in the matrix `new DOMMatrix().skewX(90)`, instead they use `1.63312e+16`.   But _if_ the trigonometric functions were mathematically precise, it would be `Infinity`.  (The `c` component of the `skewX(90)` matrix is equal to `Math.tan(Math.PI/2)`.)

The other cases where you you'd get non-finite values in a matrix are where you tried to invert a non-invertable matrix (like `scale(1,0)`): [as currently spec'd](https://drafts.fxtf.org/geometry/#dom-dommatrix-invertself), this does not throw an error, but instead sets all values in the matrix to `NaN`.  (In contrast [SVG 1.1](https://www.w3.org/TR/SVG11/coords.html#__svg__SVGMatrix__inverse) threw an error when trying to invert a non-invertable matrix.)  And of course, the author could be setting individual matrix or transform parameters using calculations that return `Infinity` (1/0) or `NaN` (0/0).  

You wouldn't expect these matrices to have CSS-parse-able equivalents, though.  Skews are a special case because the non-finite matrix representation has a finite transform-function representation.

GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/120#issuecomment-300610585 using your GitHub account
Received on Wednesday, 10 May 2017 20:58:59 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:50:21 UTC