[svgwg] SVG 2 restores the `SVGMatrix` name (#1143) but never defines the interface (#1156)

karlcow has just created a new issue for https://github.com/w3c/svgwg:

== SVG 2 restores the `SVGMatrix` name (#1143) but never defines the interface ==
After https://github.com/w3c/svgwg/pull/1143 (merged), [`createSVGMatrix()`](https://w3c.github.io/svgwg/svg2-draft/struct.html#__svg__SVGSVGElement__createSVGMatrix) returns `SVGMatrix` again instead of `DOMMatrix`. But SVG 2 has **no `interface SVGMatrix { … }` IDL block anywhere**. 

The source [`definitions.xml`](https://github.com/w3c/svgwg/blob/main/master/definitions.xml) still autolinks the `SVGMatrix` name to CSS Geometry 1's [`DOMMatrix`](https://drafts.csswg.org/geometry-1/#dommatrix)

The spec says pages can use `SVGMatrix` again, but never says what it actually is.

1. What properties does it have, and what kind of numbers do they hold. For example, can `matrix.a` be set to `Infinity` or `NaN`, or should that be rejected?
2. If you call one of its methods (like `translate()`) without giving it every argument, is that allowed (missing ones default to zero), or does it throw an error?
3. Which method calls are supposed to raise an error in the first place, and which ones aren't?

Right now, each engine has picked its own answer, and all three disagree with each other on at least one of these:

| | WebKit [`SVGMatrix.idl`](https://github.com/WebKit/WebKit/blob/main/Source/WebCore/svg/SVGMatrix.idl) | Gecko [`SVGMatrix.webidl`](https://github.com/mozilla-firefox/firefox/blob/main/dom/webidl/SVGMatrix.webidl) | Blink [`svg_matrix.idl`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/svg/svg_matrix.idl) | Geometry 1 [`DOMMatrix`](https://drafts.csswg.org/geometry-1/#dommatrix) |
|---|---|---|---|---|
| `a`–`f` type | `double` | `float` | `double` | `unrestricted double` |
| `translate`/`scale`/`rotate` args | required | required | required | `optional … = 0` |
| `rotateFromVector` throws? | no | yes (`[Throws]`) | yes (`[RaisesException]`) | no (defines `(0,0)` → `NaN` rotation) |
| `skewX`/`skewY` throw? | no | yes | no | no |

Four questions, we could address.

1. **Should SVG 2 define `SVGMatrix` at all**, even just by pointing to Geometry 1's `DOMMatrix` and adding any SVG-specific rules on top? Right now there's nothing to test against: the `SVGMatrix` entry in [`idlharness.window.js`](https://github.com/web-platform-tests/wpt/blob/master/svg/idlharness.window.js) exists, but has no definition to check. Answering this would help settle the next three questions too, and is a natural follow-on to #1143.
2. If yes: should `a`–`f` be `unrestricted double`, like `DOMMatrix` (so `NaN`/`Infinity` are allowed), or more restricted, like all three engines already do (each with a comment in its source admitting the choice isn't settled)?
3. Should the transform methods' arguments be optional with defaults, like `DOMMatrix`, or required, like all three engines currently implement?
4. Which methods should throw, and when? `rotateFromVector`, `skewX`, and `skewY` currently behave differently in each of the three engines, and nothing says which one is right.

---

Two related but separate issues, #1154 and #1155 (split out of #326):

* Should `multiply()`, `setMatrix()`, and `createSVGTransformFromMatrix()` should reject non-finite values when given a `DOMMatrix2DInit`?
* `SVGMatrix` itself has no definition, regardless of how 
  * #1154
  * #1155  
 are resolved.

---

Should we file an issue on `w3c/csswg-drafts`, because CSS Geometry 1 still says `SVGMatrix` is the same thing as `DOMMatrix`, via `LegacyWindowAlias=(SVGMatrix,WebKitCSSMatrix)` on [`DOMMatrix`](https://drafts.csswg.org/geometry-1/#dommatrix)? 

As long as that's true, `window.SVGMatrix` and `window.DOMMatrix` are literally the same object in JavaScript, no matter what SVG 2 says here. The two issues need to be resolved together.

Please view or discuss this issue at https://github.com/w3c/svgwg/issues/1156 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 29 July 2026 09:42:43 UTC