Most interfaces in the Geometry spec have a dictionary type so you can use a direct JS object as an argument instead of requiring the object to implement the relevant interface. DOMMatrix doesn't have a dictionary though. It seems to me that it should.

Since DOMMatrix has both a-f and m11-m44 attributes, the dictionary will have to support members for all those as well and accept objects where all are set.

It probably makes sense to have a dictionary member for is2D, to preserve it being false even though the members indicate a 2d matrix. The constructor could throw TypeError if it was set to true but the other members indicate a 3d matrix.

I don't see any reason to have a dictionary member for isIdentity.

The a-f members and the corresponding mXX members can't have default values in the IDL, but can be defaulted in prose in the algorithm. If e.g. a and m11 are set to different values we could throw TypeError.

dictionary DOMMatrixInit {
    unrestricted double a; // 1
    unrestricted double b; // 0
    unrestricted double c; // 0
    unrestricted double d; // 1
    unrestricted double e; // 0
    unrestricted double f; // 0
    unrestricted double m11; // 1
    unrestricted double m12; // 0
    unrestricted double m13 = 0;
    unrestricted double m14 = 0;
    unrestricted double m21; // 0
    unrestricted double m22; // 1
    unrestricted double m23 = 0;
    unrestricted double m24 = 0;
    unrestricted double m31 = 0;
    unrestricted double m32 = 0;
    unrestricted double m33 = 1;
    unrestricted double m34 = 0;
    unrestricted double m41; // 0
    unrestricted double m42; // 0
    unrestricted double m43 = 0;
    unrestricted double m44 = 1;
    boolean is2D;
};

Does this seem reasonable?
--
Simon Pieters
Opera Software

Reply via email to