A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

The name of DOMMatrix is out of place?

trusktr
2015-10-29

So, DOMMatrix (and the other geometry classes) are intended to be generic. So, then DOM seems out of place when, for example, using DOMMatrix in a WebGL application because there is no DOM inside a WebGL context.

I think better names would be TransformationMatrix, AffineMatrix, Matrix3D, or similar.

Calling it a DOMMatrix is like calling it a WebGLMatrix then using that to manipulate CSS transforms, which isn’t WebGL.

Tigt
2015-10-29

It might be a technicality similar to DOMString; implementation details specify it must be UTF-16, so runtimes that don’t internally represent strings that way must convert their strings to a DOMString first before interacting with DOM interfaces.

And for the matrix:

interface DOMMatrix : DOMMatrixReadOnly {
    [NewObject] static DOMMatrix fromMatrix(optional DOMMatrixInit other);
    [NewObject] static DOMMatrix fromString(DOMString transformList);
    [NewObject] static DOMMatrix fromFloat32Array(Float32Array array32);
    [NewObject] static DOMMatrix fromFloat64Array(Float64Array array64);
/* And so on... */

Additionally, it looks like SVG2 will also use DOMMatrix, which might be another reason for the generic name.

trusktr
2015-10-30

@Tigt But I feel that DOMMatrix simply isn’t generic enough. It makes sense if you’re working with DOM, but not if it is being used inside Canvas 2D or WebGL contexts.