Title: Geometry Interfaces Module Level 1 Shortname: geometry Level: 1 Status: CRD Prepare for TR: yes Date: 2025-12-04 Work Status: Refining ED: https://drafts.csswg.org/geometry-1/ TR: https://www.w3.org/TR/geometry-1/ Previous Version: https://www.w3.org/TR/2018/CR-geometry-1-20181204/ Previous Version: https://www.w3.org/TR/2014/CR-geometry-1-20141125/ Previous Version: https://www.w3.org/TR/2014/WD-geometry-1-20140918/ Previous Version: https://www.w3.org/TR/2014/WD-geometry-1-20140626/ Previous Version: https://www.w3.org/TR/2014/WD-geometry-1-20140522/ Previous Version: https://www.w3.org/TR/2013/WD-matrix-20130919/ Group: csswg Editor: Yehonatan Daniv, Wix.com, yehonatand@wix.com, w3cid 136300 Editor: Sebastian Zartner, Invited Expert, sebastianzartner@gmail.com, w3cid 64937 Former Editor: Dirk Schulze, Adobe Inc., dschulze@adobe.com, w3cid 51803 Former Editor: Chris Harrelson, Google, chrishtr@chromium.org, w3cid 90243 Former Editor: Simon Pieters, Opera Software AS, simonp@opera.com Former Editor: Rik Cabanier, Magic Leap, rcabanier@magicleap.com, w3cid 106988 Abstract: This specification provides basic geometric interfaces to represent points, rectangles, quadrilaterals and transformation matrices that can be used by other modules or specifications. Test Suite: http://test.csswg.org/suites/geometry-1_dev/nightly-unstable/ Implementation Report: https://wpt.fyi/results/css/geometry Use Autolinks: no Include Can I Use Panels: true Can I Use URL: https://drafts.csswg.org/geometry/ Can I Use URL: https://www.w3.org/TR/geometry-1/ Ignore Can I Use URL Failure: https://drafts.csswg.org/geometry/ Ignore Can I Use URL Failure: https://www.w3.org/TR/geometry-1/ WPT Path Prefix: css/geometry/ WPT Display: open Complain About: accidental-2119 true
urlPrefix: https://tc39.github.io/ecma262/; spec: ECMA-262
type: dfn
text: SameValueZero; url: sec-samevaluezero
text: ToString; url: sec-tostring
text: !; url: sec-algorithm-conventions
Introduction {#intro}
=====================
This section is non-normative.
This specification describes several geometry interfaces for the representation of points,
rectangles, quadrilaterals and transformation matrices with the dimension of 3x2 and 4x4.
The SVG interfaces {{SVGPoint}}, {{SVGRect}} and {{SVGMatrix}} are aliasing the here defined
interfaces in favor for common interfaces used by SVG, Canvas 2D Context and CSS
Transforms. [[SVG11]] [[HTML]] [[CSS3-TRANSFORMS]]
[Exposed=(Window,Worker),
Serializable]
interface DOMPointReadOnly {
constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double z = 0, optional unrestricted double w = 1);
[NewObject] static DOMPointReadOnly fromPoint(optional DOMPointInit other = {});
readonly attribute unrestricted double x;
readonly attribute unrestricted double y;
readonly attribute unrestricted double z;
readonly attribute unrestricted double w;
[NewObject] DOMPoint matrixTransform(optional DOMMatrixInit matrix = {});
[Default] object toJSON();
};
[Exposed=(Window,Worker),
Serializable,
LegacyWindowAlias=SVGPoint]
interface DOMPoint : DOMPointReadOnly {
constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double z = 0, optional unrestricted double w = 1);
[NewObject] static DOMPoint fromPoint(optional DOMPointInit other = {});
inherit attribute unrestricted double x;
inherit attribute unrestricted double y;
inherit attribute unrestricted double z;
inherit attribute unrestricted double w;
};
dictionary DOMPointInit {
unrestricted double x = 0;
unrestricted double y = 0;
unrestricted double z = 0;
unrestricted double w = 1;
};
The following algorithms assume that {{DOMPointReadOnly}} objects have the internal member
variables x coordinate, y coordinate, z
coordinate and w perspective.
{{DOMPointReadOnly}} as well as the inheriting interface {{DOMPoint}} must be able to access and set
the value of these variables.
An interface returning an {{DOMPointReadOnly}} object by an attribute or function may be able to
modify internal member variable values. Such an interface must specify this ability explicitly in
prose.
Internal member variables must not be exposed in any way.
The DOMPointReadOnly(x,
y, z, w) and DOMPoint(x, y, z, w)
constructors, when invoked, must run the following steps:
1. Let point be a new {{DOMPointReadOnly}} or {{DOMPoint}} object as appropriate.
2. Set point's variables x coordinate to x, y coordinate to y, z coordinate to z and w perspective to w.
3. Return point.
fromPoint(other) static method on
{{DOMPointReadOnly}} must create a DOMPointReadOnly from the dictionary
other.
The fromPoint(other) static method on
{{DOMPoint}} must create a DOMPoint from the dictionary other.
To create a DOMPointReadOnly
from a dictionary other, or to create a DOMPoint from a dictionary other, follow these
steps:
1. Let point be a new {{DOMPointReadOnly}} or {{DOMPoint}} as appropriate.
2. Set point's variables x coordinate to other's {{DOMPointInit/x}} dictionary member, y coordinate to other's {{DOMPointInit/y}} dictionary member, z coordinate to other's {{DOMPointInit/z}} dictionary member and w perspective to other's {{DOMPointInit/w}} dictionary member. 3. Return point.
x attribute, on getting, must return the x
coordinate value. For the {{DOMPoint}} interface, setting the
{{DOMPoint/x}} attribute must set the x coordinate to the new value.
The y attribute, on getting, must return the y
coordinate value. For the {{DOMPoint}} interface, setting the
{{DOMPoint/y}} attribute must set the y coordinate to the new value.
The z attribute, on getting, must return the z
coordinate value. For the {{DOMPoint}} interface, setting the
{{DOMPoint/z}} attribute must set the z coordinate to the new value.
The w attribute, on getting, must return the w
perspective value. For the {{DOMPoint}} interface, setting the
{{DOMPoint/w}} attribute must set the w perspective to the new value.
DOMMatrix
from the dictionary matrix.
2. Return the result of invoking transform a point with a matrix, given the current
point and matrixObject. The current point does not get modified.
var point = new DOMPoint(5, 4);
var matrix = new DOMMatrix([2, 0, 0, 2, 10, 10]);
var transformedPoint = point.matrixTransform(matrix);
The point variable is set to a new {{DOMPoint}} object with x
coordinate initialized to 5 and y coordinate initialized to 4. This new
{{DOMPoint}} is now scaled and the translated by matrix. This resulting transformedPoint has the x coordinate 20 and y
coordinate 18.
[Exposed=(Window,Worker),
Serializable]
interface DOMRectReadOnly {
constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double width = 0, optional unrestricted double height = 0);
[NewObject] static DOMRectReadOnly fromRect(optional DOMRectInit other = {});
readonly attribute unrestricted double x;
readonly attribute unrestricted double y;
readonly attribute unrestricted double width;
readonly attribute unrestricted double height;
readonly attribute unrestricted double top;
readonly attribute unrestricted double right;
readonly attribute unrestricted double bottom;
readonly attribute unrestricted double left;
[Default] object toJSON();
};
[Exposed=(Window,Worker),
Serializable,
LegacyWindowAlias=SVGRect]
interface DOMRect : DOMRectReadOnly {
constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double width = 0, optional unrestricted double height = 0);
[NewObject] static DOMRect fromRect(optional DOMRectInit other = {});
inherit attribute unrestricted double x;
inherit attribute unrestricted double y;
inherit attribute unrestricted double width;
inherit attribute unrestricted double height;
};
dictionary DOMRectInit {
unrestricted double x = 0;
unrestricted double y = 0;
unrestricted double width = 0;
unrestricted double height = 0;
};
The following algorithms assume that {{DOMRectReadOnly}} objects have the internal member
variables x coordinate, y coordinate, width dimension and height dimension. {{DOMRectReadOnly}} as
well as the inheriting interface {{DOMRect}} must be able to access and set the value of these
variables.
An interface returning an {{DOMRectReadOnly}} object by an attribute or function may be able to
modify internal member variable values. Such an interface must specify this ability explicitly in
prose.
Internal member variables must not be exposed in any way.
The DOMRectReadOnly(x,
y, width, height) and DOMRect(x, y, width,
height) constructors, when invoked, must run the following steps:
1. Let rect be a new {{DOMRectReadOnly}} or {{DOMRect}} object as appropriate.
2. Set rect's variables x coordinate to x, y coordinate to y, width dimension to
width and height dimension to height.
3. Return rect.
The fromRect(other) static method on
{{DOMRectReadOnly}} must create a DOMRectReadOnly from the dictionary
other.
The fromRect(other) static method on {{DOMRect}}
must create a DOMRect from the dictionary other.
To create a DOMRectReadOnly
from a dictionary other, or to create a DOMRect from a dictionary other, follow these
steps:
1. Let rect be a new {{DOMRectReadOnly}} or {{DOMRect}} as appropriate.
2. Set rect's variables x coordinate to other's
{{DOMRectInit/x}} dictionary member, y coordinate to other's
{{DOMRectInit/y}} dictionary member, width dimension to other's
{{DOMRectInit/width}} dictionary member and height dimension to
other's {{DOMRectInit/height}} dictionary member.
3. Return rect.
x attribute, on getting, must return the x
coordinate value. For the {{DOMRect}} interface, setting the
{{DOMRect/x}} attribute must set the x coordinate to the new value.
The y attribute, on getting, it must return the y
coordinate value. For the {{DOMRect}} interface, setting the
{{DOMRect/y}} attribute must set the y coordinate to the new value.
The width attribute, on getting, must return the width
dimension value. For the {{DOMRect}} interface, setting the
{{DOMRect/width}} attribute must set the width dimension to the new value.
The height attribute, on getting, must return the height dimension value. For the {{DOMRect}} interface, setting the
{{DOMRect/height}} attribute must set the height dimension value to the new
value.
The top attribute, on getting, must return the NaN-safe minimum of
the y coordinate and the sum of the y coordinate and the
height dimension.
The right attribute, on getting, must return the NaN-safe maximum of
the x coordinate and the sum of the x coordinate and the
width dimension.
The bottom attribute, on getting, must return the NaN-safe maximum
of the y coordinate and the sum of the y coordinate and
the height dimension.
The left attribute, on getting, must return the NaN-safe minimum of
the x coordinate and the sum of the x coordinate and the
width dimension.
[Exposed=Window]
interface DOMRectList {
readonly attribute unsigned long length;
getter DOMRect? item(unsigned long index);
};
The length attribute must return the total
number of {{DOMRect}} objects associated with the object.
The item(index) method, when invoked, must
return ''null'' when index is greater than or equal to the number of {{DOMRect}} objects
associated with the {{DOMRectList}}. Otherwise, the {{DOMRect}} object at index must be
returned. Indices are zero-based.
ADVISEMENT: {{DOMRectList}} only exists for compatibility with legacy Web content. When specifying a
new API, {{DOMRectList}} must not be used. Use sequence<DOMRect> instead. [[WEBIDL]]
[Exposed=(Window,Worker),
Serializable]
interface DOMQuad {
constructor(optional DOMPointInit p1 = {}, optional DOMPointInit p2 = {},
optional DOMPointInit p3 = {}, optional DOMPointInit p4 = {});
[NewObject] static DOMQuad fromRect(optional DOMRectInit other = {});
[NewObject] static DOMQuad fromQuad(optional DOMQuadInit other = {});
[SameObject] readonly attribute DOMPoint p1;
[SameObject] readonly attribute DOMPoint p2;
[SameObject] readonly attribute DOMPoint p3;
[SameObject] readonly attribute DOMPoint p4;
[NewObject] DOMRect getBounds();
[Default] object toJSON();
};
dictionary DOMQuadInit {
DOMPointInit p1;
DOMPointInit p2;
DOMPointInit p3;
DOMPointInit p4;
};
The following algorithms assume that {{DOMQuad}} objects have the internal member variables point 1, point 2, point
3, and point 4, which are
{{DOMPoint}} objects. {{DOMQuad}} must be able to access and set the value of these variables. The
author can modify these {{DOMPoint}} objects, which directly affects the quadrilateral.
An interface returning a {{DOMQuad}} object by an attribute or function may be able to modify
internal member variable values. Such an interface must specify this ability explicitly in prose.
Internal member variables must not be exposed in any way.
The DOMQuad(p1, p2,
p3, p4) constructor, when invoked, must run the following steps:
1. Let point1 be a new {{DOMPoint}} object with its attributes set to the values of
the namesake dictionary members in p1.
2. Let point2 be a new {{DOMPoint}} object with its attributes set to the values of
the namesake dictionary members in p2.
3. Let point3 be a new {{DOMPoint}} object with its attributes set to the values of
the namesake dictionary members in p3.
4. Let point4 be a new {{DOMPoint}} object with its attributes set to the values of
the namesake dictionary members in p4.
5. Return a new {{DOMQuad}} with point 1 set to point1, point 2 set to point2, point 3 set to
point3 and point 4 set to point4.
Note: It is possible to pass {{DOMPoint}}/{{DOMPointReadOnly}} arguments as well. The passed
arguments will be transformed to the correct object type internally following the WebIDL rules.
[[!WEBIDL]]
The fromRect(other)
static method on {{DOMQuad}} must create a DOMQuad from the DOMRectInit
dictionary other.
To create a DOMQuad from
a DOMRectInit dictionary other, follow these steps:
1. Let x, y, width and height be the value of
other's {{DOMRectInit/x}}, {{DOMRectInit/y}}, {{DOMRectInit/width}} and
{{DOMRectInit/height}} dictionary members, respectively.
2. Let point1 be a new {{DOMPoint}} object with x coordinate set to
x, y coordinate set to y, z coordinate set
to ''0'' and w perspective set to ''1''.
3. Let point2 be a new {{DOMPoint}} object with x coordinate set to
x + width, y coordinate set to y, z
coordinate set to ''0'' and w perspective set to ''1''.
4. Let point3 be a new {{DOMPoint}} object with x coordinate set to
x + width, y coordinate set to y +
height, z coordinate set to ''0'' and w perspective
set to ''1''.
5. Let point4 be a new {{DOMPoint}} object with x coordinate set to
x, y coordinate set to y + height, z
coordinate set to ''0'' and w perspective set to ''1''.
6. Return a new {{DOMQuad}} with point 1 set to point1, point 2 set to point2, point 3 set to
point3 and point 4 set to point4.
The fromQuad(other)
static method on {{DOMQuad}} must create a DOMQuad from the DOMQuadInit
dictionary other.
To create a DOMQuad from
a DOMQuadInit dictionary other, follow these steps:
1. Let point1 be the result of invoking create a DOMPoint from the
dictionary {{DOMQuadInit/p1}} dictionary member of other, if it exists.
2. Let point2 be the result of invoking create a DOMPoint from the
dictionary {{DOMQuadInit/p2}} dictionary member of other, if it exists.
3. Let point3 be the result of invoking create a DOMPoint from the
dictionary {{DOMQuadInit/p3}} dictionary member of other, if it exists.
4. Let point4 be the result of invoking create a DOMPoint from the
dictionary {{DOMQuadInit/p4}} dictionary member of other, if it exists.
5. Return a new {{DOMQuad}} with point 1 set to point1, point 2 set to point2, point 3 set to
point3 and point 4 set to point4.
p1 attribute must return point 1.
The p2 attribute must return point 2.
The p3 attribute must return point 3.
The p4 attribute must return point 4.
var point = new DOMPoint(2, 0);
var quad1 = new DOMQuad(point, {x: 12, y: 0}, {x: 12, y: 10}, {x: 2, y: 10});
The attribute values of the resulting {{DOMQuad}} quad1 above are also
equivalent to the attribute values of the following {{DOMQuad}} quad2:
var rect = new DOMRect(2, 0, 10, 10);
var quad2 = DOMQuad.fromRect(rect);
new DOMQuad({x: 40, y: 25}, {x: 180, y: 8}, {x: 210, y: 150}, {x: 10, y: 180});
Term A post-multiplied by term B is equal to A · B. : pre-multiply :: Term A pre-multiplied by term B is equal to B · A. : multiply :: Multiply term A by term B is equal to A · B.
[Exposed=(Window,Worker),
Serializable]
interface DOMMatrixReadOnly {
constructor(optional (DOMString or sequence<unrestricted double>) init);
[NewObject] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other = {});
[NewObject] static DOMMatrixReadOnly fromFloat32Array(Float32Array array32);
[NewObject] static DOMMatrixReadOnly fromFloat64Array(Float64Array array64);
// These attributes are simple aliases for certain elements of the 4x4 matrix
readonly attribute unrestricted double a;
readonly attribute unrestricted double b;
readonly attribute unrestricted double c;
readonly attribute unrestricted double d;
readonly attribute unrestricted double e;
readonly attribute unrestricted double f;
readonly attribute unrestricted double m11;
readonly attribute unrestricted double m12;
readonly attribute unrestricted double m13;
readonly attribute unrestricted double m14;
readonly attribute unrestricted double m21;
readonly attribute unrestricted double m22;
readonly attribute unrestricted double m23;
readonly attribute unrestricted double m24;
readonly attribute unrestricted double m31;
readonly attribute unrestricted double m32;
readonly attribute unrestricted double m33;
readonly attribute unrestricted double m34;
readonly attribute unrestricted double m41;
readonly attribute unrestricted double m42;
readonly attribute unrestricted double m43;
readonly attribute unrestricted double m44;
readonly attribute boolean is2D;
readonly attribute boolean isIdentity;
// Immutable transform methods
[NewObject] DOMMatrix translate(optional unrestricted double tx = 0,
optional unrestricted double ty = 0,
optional unrestricted double tz = 0);
[NewObject] DOMMatrix scale(optional unrestricted double scaleX = 1,
optional unrestricted double scaleY,
optional unrestricted double scaleZ = 1,
optional unrestricted double originX = 0,
optional unrestricted double originY = 0,
optional unrestricted double originZ = 0);
[NewObject] DOMMatrix scaleNonUniform(optional unrestricted double scaleX = 1,
optional unrestricted double scaleY = 1);
[NewObject] DOMMatrix scale3d(optional unrestricted double scale = 1,
optional unrestricted double originX = 0,
optional unrestricted double originY = 0,
optional unrestricted double originZ = 0);
[NewObject] DOMMatrix rotate(optional unrestricted double rotX = 0,
optional unrestricted double rotY,
optional unrestricted double rotZ);
[NewObject] DOMMatrix rotateFromVector(optional unrestricted double x = 0,
optional unrestricted double y = 0);
[NewObject] DOMMatrix rotateAxisAngle(optional unrestricted double x = 0,
optional unrestricted double y = 0,
optional unrestricted double z = 0,
optional unrestricted double angle = 0);
[NewObject] DOMMatrix skewX(optional unrestricted double sx = 0);
[NewObject] DOMMatrix skewY(optional unrestricted double sy = 0);
[NewObject] DOMMatrix multiply(optional DOMMatrixInit other = {});
[NewObject] DOMMatrix flipX();
[NewObject] DOMMatrix flipY();
[NewObject] DOMMatrix inverse();
[NewObject] DOMPoint transformPoint(optional DOMPointInit point = {});
[NewObject] Float32Array toFloat32Array();
[NewObject] Float64Array toFloat64Array();
[Exposed=Window] stringifier;
[Default] object toJSON();
};
[Exposed=(Window,Worker),
Serializable,
LegacyWindowAlias=(SVGMatrix,WebKitCSSMatrix)]
interface DOMMatrix : DOMMatrixReadOnly {
constructor(optional (DOMString or sequence<unrestricted double>) init);
[NewObject] static DOMMatrix fromMatrix(optional DOMMatrixInit other = {});
[NewObject] static DOMMatrix fromFloat32Array(Float32Array array32);
[NewObject] static DOMMatrix fromFloat64Array(Float64Array array64);
// These attributes are simple aliases for certain elements of the 4x4 matrix
inherit attribute unrestricted double a;
inherit attribute unrestricted double b;
inherit attribute unrestricted double c;
inherit attribute unrestricted double d;
inherit attribute unrestricted double e;
inherit attribute unrestricted double f;
inherit attribute unrestricted double m11;
inherit attribute unrestricted double m12;
inherit attribute unrestricted double m13;
inherit attribute unrestricted double m14;
inherit attribute unrestricted double m21;
inherit attribute unrestricted double m22;
inherit attribute unrestricted double m23;
inherit attribute unrestricted double m24;
inherit attribute unrestricted double m31;
inherit attribute unrestricted double m32;
inherit attribute unrestricted double m33;
inherit attribute unrestricted double m34;
inherit attribute unrestricted double m41;
inherit attribute unrestricted double m42;
inherit attribute unrestricted double m43;
inherit attribute unrestricted double m44;
// Mutable transform methods
DOMMatrix multiplySelf(optional DOMMatrixInit other = {});
DOMMatrix preMultiplySelf(optional DOMMatrixInit other = {});
DOMMatrix translateSelf(optional unrestricted double tx = 0,
optional unrestricted double ty = 0,
optional unrestricted double tz = 0);
DOMMatrix scaleSelf(optional unrestricted double scaleX = 1,
optional unrestricted double scaleY,
optional unrestricted double scaleZ = 1,
optional unrestricted double originX = 0,
optional unrestricted double originY = 0,
optional unrestricted double originZ = 0);
DOMMatrix scale3dSelf(optional unrestricted double scale = 1,
optional unrestricted double originX = 0,
optional unrestricted double originY = 0,
optional unrestricted double originZ = 0);
DOMMatrix rotateSelf(optional unrestricted double rotX = 0,
optional unrestricted double rotY,
optional unrestricted double rotZ);
DOMMatrix rotateFromVectorSelf(optional unrestricted double x = 0,
optional unrestricted double y = 0);
DOMMatrix rotateAxisAngleSelf(optional unrestricted double x = 0,
optional unrestricted double y = 0,
optional unrestricted double z = 0,
optional unrestricted double angle = 0);
DOMMatrix skewXSelf(optional unrestricted double sx = 0);
DOMMatrix skewYSelf(optional unrestricted double sy = 0);
DOMMatrix invertSelf();
[Exposed=Window] DOMMatrix setMatrixValue(DOMString transformList);
};
dictionary DOMMatrix2DInit {
unrestricted double a;
unrestricted double b;
unrestricted double c;
unrestricted double d;
unrestricted double e;
unrestricted double f;
unrestricted double m11;
unrestricted double m12;
unrestricted double m21;
unrestricted double m22;
unrestricted double m41;
unrestricted double m42;
};
dictionary DOMMatrixInit : DOMMatrix2DInit {
unrestricted double m13 = 0;
unrestricted double m14 = 0;
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 m43 = 0;
unrestricted double m44 = 1;
boolean is2D;
};
The following algorithms assume that {{DOMMatrixReadOnly}} objects have the internal member
variables m11 element, m12 element, m13 element, m14 element, m21
element, m22 element, m23 element, m24 element, m31 element, m32
element, m33 element, m34 element, m41 element, m42 element, m43
element, m44 element and is 2D.
{{DOMMatrixReadOnly}} as well as the inheriting interface {{DOMMatrix}} must be able to access and
set the value of these variables.
An interface returning an {{DOMMatrixReadOnly}} object by an attribute or function may be able to
modify internal member variable values. Such an interface must specify this ability explicitly in
prose.
Internal member variables must not be exposed in any way.
The {{DOMMatrix}} and {{DOMMatrixReadOnly}} interfaces replace the SVGMatrix
interface from SVG. [[SVG11]]
false.
* {{DOMMatrix2DInit/b}} and {{DOMMatrix2DInit/m12}} are both present and
[=SameValueZero=]({{DOMMatrix2DInit/b}}, {{DOMMatrix2DInit/m12}}) is false.
* {{DOMMatrix2DInit/c}} and {{DOMMatrix2DInit/m21}} are both present and
[=SameValueZero=]({{DOMMatrix2DInit/c}}, {{DOMMatrix2DInit/m21}}) is false.
* {{DOMMatrix2DInit/d}} and {{DOMMatrix2DInit/m22}} are both present and
[=SameValueZero=]({{DOMMatrix2DInit/d}}, {{DOMMatrix2DInit/m22}}) is false.
* {{DOMMatrix2DInit/e}} and {{DOMMatrix2DInit/m41}} are both present and
[=SameValueZero=]({{DOMMatrix2DInit/e}}, {{DOMMatrix2DInit/m41}}) is false.
* {{DOMMatrix2DInit/f}} and {{DOMMatrix2DInit/m42}} are both present and
[=SameValueZero=]({{DOMMatrix2DInit/f}}, {{DOMMatrix2DInit/m42}}) is false.
2. If {{DOMMatrix2DInit/m11}} is not present then set it to the value of member
{{DOMMatrix2DInit/a}}, or value ''1'' if {{DOMMatrix2DInit/a}} is also not present.
3. If {{DOMMatrix2DInit/m12}} is not present then set it to the value of member
{{DOMMatrix2DInit/b}}, or value ''0'' if {{DOMMatrix2DInit/b}} is also not present.
4. If {{DOMMatrix2DInit/m21}} is not present then set it to the value of member
{{DOMMatrix2DInit/c}}, or value ''0'' if {{DOMMatrix2DInit/c}} is also not present.
5. If {{DOMMatrix2DInit/m22}} is not present then set it to the value of member
{{DOMMatrix2DInit/d}}, or value ''1'' if {{DOMMatrix2DInit/d}} is also not present.
6. If {{DOMMatrix2DInit/m41}} is not present then set it to the value of member
{{DOMMatrix2DInit/e}}, or value ''0'' if {{DOMMatrix2DInit/e}} is also not present.
7. If {{DOMMatrix2DInit/m42}} is not present then set it to the value of member
{{DOMMatrix2DInit/f}}, or value ''0'' if {{DOMMatrix2DInit/f}} is also not present.
Note: The [=SameValueZero=] comparison algorithm returns true for two ''NaN''
values, and also for ''0'' and ''-0''. [[!ECMA-262]]
To validate and fixup a {{DOMMatrixInit}} dictionary dict,
run the following steps:
1. Validate and fixup (2D) dict.
2. If {{DOMMatrixInit/is2D}} is true and: at least one of {{DOMMatrixInit/m13}},
{{DOMMatrixInit/m14}}, {{DOMMatrixInit/m23}}, {{DOMMatrixInit/m24}}, {{DOMMatrixInit/m31}},
{{DOMMatrixInit/m32}}, {{DOMMatrixInit/m34}}, {{DOMMatrixInit/m43}} are present with a value other
than ''0'' or ''-0'', or at least one of {{DOMMatrixInit/m33}}, {{DOMMatrixInit/m44}} are present
with a value other than ''1'', then throw a {{TypeError}} exception and abort these steps.
3. If {{DOMMatrixInit/is2D}} is not present and at least one of {{DOMMatrixInit/m13}},
{{DOMMatrixInit/m14}}, {{DOMMatrixInit/m23}}, {{DOMMatrixInit/m24}}, {{DOMMatrixInit/m31}},
{{DOMMatrixInit/m32}}, {{DOMMatrixInit/m34}}, {{DOMMatrixInit/m43}} are present with a value other
than ''0'' or ''-0'', or at least one of {{DOMMatrixInit/m33}}, {{DOMMatrixInit/m44}} are present
with a value other than ''1'', set {{DOMMatrixInit/is2D}} to false.
4. If {{DOMMatrixInit/is2D}} is still not present, set it to true.
matrix(1, 0, 0,
1, 0, 0)".
2. Parse transformList into parsedValue given the grammar
for the CSS 'transform' property. The result will be a <false.
: Otherwise
::
Set 2dTransform to true.
true.
6. Return matrix
To create a 3d matrix with type being either {{DOMMatrixReadOnly}} or
{{DOMMatrix}}, with a sequence init of 16 elements, follow these steps:
1. Let matrix be a new instance of type.
2. Set m11 element to m44 element to the values of
init in column-major order.
3. Set is 2D to false.
4. Return matrix
The DOMMatrixReadOnly(init) and the DOMMatrix(init) constructors
must follow these steps:
true
::
Return the result of invoking create a 2d matrix of type {{DOMMatrixReadOnly}} or
{{DOMMatrix}} as appropriate, with a sequence of numbers, the values being the elements m11, m12, m21, m22, m41 and m42 of matrix.
: Otherwise
::
Return the result of invoking create a 3d matrix of type {{DOMMatrixReadOnly}} or
{{DOMMatrix}} as appropriate, with a sequence of numbers, the values being the 16 elements of
matrix.
fromMatrix(other) static method on
{{DOMMatrixReadOnly}} must create a DOMMatrixReadOnly from the dictionary
other.
The fromMatrix(other) static method on
{{DOMMatrix}} must create a DOMMatrix from the dictionary other.
To create a
DOMMatrixReadOnly from a 2D dictionary other or to create a DOMMatrix from a 2D dictionary
other, follow these steps:
1. Validate and fixup (2D) other.
2. Return the result of invoking create a 2d matrix of type {{DOMMatrixReadOnly}} or
{{DOMMatrix}} as appropriate, with a sequence of numbers, the values being the 6 elements
{{DOMMatrix2DInit/m11}}, {{DOMMatrix2DInit/m12}}, {{DOMMatrix2DInit/m21}}, {{DOMMatrix2DInit/m22}},
{{DOMMatrix2DInit/m41}} and {{DOMMatrix2DInit/m42}} of other in the given order.
To create a
DOMMatrixReadOnly from a dictionary other or to create a DOMMatrix from a dictionary
other, follow these steps:
1. Validate and fixup other.
2. true
::
Return the result of invoking create a 2d matrix of type {{DOMMatrixReadOnly}} or
{{DOMMatrix}} as appropriate, with a sequence of numbers, the values being the 6 elements
{{DOMMatrix2DInit/m11}}, {{DOMMatrix2DInit/m12}}, {{DOMMatrix2DInit/m21}}, {{DOMMatrix2DInit/m22}},
{{DOMMatrix2DInit/m41}} and {{DOMMatrix2DInit/m42}} of other in the given order.
: Otherwise
::
Return the result of invoking create a 3d matrix of type {{DOMMatrixReadOnly}} or
{{DOMMatrix}} as appropriate, with a sequence of numbers, the values being the 16 elements
{{DOMMatrix2DInit/m11}}, {{DOMMatrix2DInit/m12}}, {{DOMMatrixInit/m13}}, ..., {{DOMMatrixInit/m44}}
of other in the given order.
fromFloat32Array(array32)
static method on {{DOMMatrixReadOnly}} and the fromFloat32Array(array32) static
method on {{DOMMatrix}} must follow these steps:
fromFloat64Array(array64)
static method on {{DOMMatrixReadOnly}} and the fromFloat64Array(array64) static
method on {{DOMMatrix}} must follow these steps:
m11 and a attributes, on getting, must
return the m11 element value. For the {{DOMMatrix}} interface, setting the
{{DOMMatrix/m11}} or the {{DOMMatrix/a}} attribute must set the m11 element to
the new value.
The m12 and b attributes, on getting, must
return the m12 element value. For the {{DOMMatrix}} interface, setting the
{{DOMMatrix/m12}} or the {{DOMMatrix/b}} attribute must set the m12 element to
the new value.
The m13 attribute, on getting, must return the m13
element value. For the {{DOMMatrix}} interface, setting the {{DOMMatrix/m13}} attribute must
set the m13 element to the new value and, if the new value is not ''0'' or
''-0'', set is 2D to false.
The m14 attribute, on getting, must return the m14
element value. For the {{DOMMatrix}} interface, setting the {{DOMMatrix/m14}} attribute must
set the m14 element to the new value and, if the new value is not ''0'' or
''-0'', set is 2D to false.
The m21 and c attributes, on getting, must
return the m21 element value. For the {{DOMMatrix}} interface, setting the
{{DOMMatrix/m21}} or the {{DOMMatrix/c}} attribute must set the m21 element to
the new value.
The m22 and d attributes, on getting, must
return the m22 element value. For the {{DOMMatrix}} interface, setting the
{{DOMMatrix/m22}} or the {{DOMMatrix/d}} attribute must set the m22 element to
the new value.
The m23 attribute, on getting, must return the m23
element value. For the {{DOMMatrix}} interface, setting the {{DOMMatrix/m23}} attribute must
set the m23 element to the new value and, if the new value is not ''0'' or
''-0'', set is 2D to false.
The m24 attribute, on getting, must return the m24
element value. For the {{DOMMatrix}} interface, setting the {{DOMMatrix/m24}} attribute must
set the m24 element to the new value and, if the new value is not ''0'' or
''-0'', set is 2D to false.
The m31 attribute, on getting, must return the m31
element value. For the {{DOMMatrix}} interface, setting the {{DOMMatrix/m31}} attribute must
set the m31 element to the new value and, if the new value is not ''0'' or
''-0'', set is 2D to false.
The m32 attribute, on getting, must return the m32
element value. For the {{DOMMatrix}} interface, setting the {{DOMMatrix/m32}} attribute must
set the m32 element to the new value and, if the new value is not ''0'' or
''-0'', set is 2D to false.
The m33 attribute, on getting, must return the m33
element value. For the {{DOMMatrix}} interface, setting the {{DOMMatrix/m33}} attribute must
set the m33 element to the new value and, if the new value is not ''1'', set is 2D to false.
The m34 attribute, on getting, must return the m34
element value. For the {{DOMMatrix}} interface, setting the {{DOMMatrix/m34}} attribute must
set the m34 element to the new value and, if the new value is not ''0'' or
''-0'', set is 2D to false.
The m41 and e attributes, on getting, must
return the m41 element value. For the {{DOMMatrix}} interface, setting the
{{DOMMatrix/m41}} or the {{DOMMatrix/e}} attribute must set the m41 element to
the new value.
The m42 and f attributes, on getting, must
return the m42 element value. For the {{DOMMatrix}} interface, setting the
{{DOMMatrix/m42}} or the {{DOMMatrix/f}} attribute must set the m42 element to
the new value.
The m43 attribute, on getting, must return the m43
element value. For the {{DOMMatrix}} interface, setting the {{DOMMatrix/m43}} attribute must
set the m43 element to the new value and, if the new value is not ''0'' or
''-0'', set is 2D to false.
The m44 attribute, on getting, must return the m44
element value. For the {{DOMMatrix}} interface, setting the {{DOMMatrix/m44}} attribute must
set the m44 element to the new value and, if the new value is not ''1'', set is 2D to false.
is2D attribute must return the value of is 2D.
The isIdentity attribute must return true if m12 element, m13 element, m14 element, m21 element, m23 element, m24 element, m31 element, m32 element, m34 element, m41 element, m42 element, m43 element are ''0''
or ''-0'' and m11 element, m22 element, m33
element, m44 element are ''1''. Otherwise it must return false.
false.
Note: Is 2D can never be set to true when it was set to
false before on a {{DOMMatrix}} object with the exception of calling the
{{DOMMatrix/setMatrixValue()}} method.
Immutable transformation methods {#immutable-transformation-methods}
--------------------------------------------------------------------
The following methods do not modify the current matrix and return a new {{DOMMatrix}} object.
new DOMMatrix([-1, 0, 0, 1, 0,
0]).
3. Return result.
The current matrix is not modified.
: flipY()
::
1. Let result be the resulting matrix initialized to the values of the current
matrix.
2. Post-multiply result with new DOMMatrix([1, 0, 0, -1, 0,
0]).
3. Return result.
The current matrix is not modified.
: inverse()
::
1. Let result be the resulting matrix initialized to the values of the current
matrix.
2. Perform a {{DOMMatrix/invertSelf()}} transformation on result.
3. Return result.
The current matrix is not modified.
DOMPoint from the
dictionary point. Return the result of invoking transform a point with a
matrix, given pointObject and the current matrix. The passed argument does not get
modified.
: toFloat32Array()
::
Returns the serialized 16 elements {{DOMMatrixReadOnly/m11}} to {{DOMMatrixReadOnly/m44}} of
the current matrix in column-major order as {{Float32Array}}.
: toFloat64Array()
::
Returns the serialized 16 elements {{DOMMatrixReadOnly/m11}} to {{DOMMatrixReadOnly/m44}} of
the current matrix in column-major order as {{Float64Array}}.
: stringification behavior
::
1. If one or more of m11 element through m44 element are a
non-finite value, then throw an "{{InvalidStateError}}" {{DOMException}}.
Note: The CSS syntax cannot represent ''NaN'' or ''Infinity'' values.
2. Let string be the empty string.
3. If is 2D is true, then:
1. Append "matrix(" to string.
2. Append [=!=] [=ToString=](m11 element) to string.
3. Append ", " to string.
4. Append [=!=] [=ToString=](m12 element) to string.
5. Append ", " to string.
6. Append [=!=] [=ToString=](m21 element) to string.
7. Append ", " to string.
8. Append [=!=] [=ToString=](m22 element) to string.
9. Append ", " to string.
10. Append [=!=] [=ToString=](m41 element) to string.
11. Append ", " to string.
12. Append [=!=] [=ToString=](m42 element) to string.
13. Append ")" to string.
Note: The string will be in the form of a a CSS Transforms <matrix3d(" to string.
2. Append [=!=] [=ToString=](m11 element) to string.
3. Append ", " to string.
4. Append [=!=] [=ToString=](m12 element) to string.
5. Append ", " to string.
6. Append [=!=] [=ToString=](m13 element) to string.
7. Append ", " to string.
8. Append [=!=] [=ToString=](m14 element) to string.
9. Append ", " to string.
10. Append [=!=] [=ToString=](m21 element) to string.
11. Append ", " to string.
12. Append [=!=] [=ToString=](m22 element) to string.
13. Append ", " to string.
14. Append [=!=] [=ToString=](m23 element) to string.
15. Append ", " to string.
16. Append [=!=] [=ToString=](m24 element) to string.
17. Append ", " to string.
18. Append [=!=] [=ToString=](m41 element) to string.
19. Append ", " to string.
20. Append [=!=] [=ToString=](m42 element) to string.
21. Append ", " to string.
22. Append [=!=] [=ToString=](m43 element) to string.
23. Append ", " to string.
24. Append [=!=] [=ToString=](m44 element) to string.
25. Append ")" to string.
Note: The string will be in the form of a a CSS Transforms <
var matrix = new DOMMatrix();
matrix.scaleSelf(2);
matrix.translateSelf(20,20);
console.assert(matrix.toString() ===
"matrix(2, 0, 0, 2, 40, 40)");
var matrix = new DOMMatrix();
matrix.scale3dSelf(2);
console.assert(matrix.toString() ===
"matrix3d(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1)");
For 3D operations, the stringifier returns a string representing a 3D matrix.
var matrix = new DOMMatrix([NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]);
var string = matrix + " Batman!";
var matrix = new DOMMatrix();
matrix.translateSelf(20, 20);
matrix.scaleSelf(2);
matrix.translateSelf(-20, -20);
is equivalent to:
var matrix = new DOMMatrix();
matrix.translateSelf(20, 20).scaleSelf(2).translateSelf(-20, -20);
DOMMatrix
from the dictionary other.
2. The otherObject matrix gets post-multiplied to the current matrix.
3. If is 2D of otherObject is false, set is 2D of the current matrix to false.
4. Return the current matrix.
: preMultiplySelf(other)
::
1. Let otherObject be the result of invoking create a DOMMatrix
from the dictionary other.
2. The otherObject matrix gets pre-multiplied to the current matrix.
3. If is 2D of otherObject is false, set is 2D of the current matrix to false.
4. Return the current matrix.
: translateSelf(tx, ty, tz)
::
1. Post-multiply a translation transformation on the current matrix. The 3D
translation matrix is described in CSS
Transforms. [[!CSS3-TRANSFORMS]]
2. If tz is specified and not ''0'' or ''-0'', set is 2D of the
current matrix to false.
3. Return the current matrix.
:
scaleSelf(scaleX, scaleY, scaleZ, originX,
originY, originZ)
::
1. Perform a {{DOMMatrix/translateSelf()}} transformation on the current matrix with the
arguments originX, originY, originZ.
2. If scaleY is missing, set scaleY to the value of scaleX.
3. Post-multiply a non-uniform scale transformation on the current matrix. The 3D
scale matrix is described
in CSS Transforms with sx = scaleX, sy = scaleY and
sz = scaleZ. [[!CSS3-TRANSFORMS]]
4. Negate originX, originY and originZ.
5. Perform a {{DOMMatrix/translateSelf()}} transformation on the current matrix with the
arguments originX, originY, originZ.
6. If scaleZ is not ''1'', set is 2D of the current matrix to false.
7. Return the current matrix.
:
scale3dSelf(scale, originX, originY,
originZ)
::
1. Apply a {{DOMMatrix/translateSelf()}} transformation to the current matrix with the
arguments originX, originY, originZ.
2. Post-multiply a uniform 3D scale transformation ({{DOMMatrixReadOnly/m11}} =
{{DOMMatrixReadOnly/m22}} = {{DOMMatrixReadOnly/m33}} = scale) on the current matrix.
The 3D scale matrix is described in CSS Transforms
with sx = sy = sz = scale. [[!CSS3-TRANSFORMS]]
3. Apply a {{DOMMatrix/translateSelf()}} transformation to the current matrix with the
arguments -originX, -originY, -originZ.
4. If scale is not ''1'', set is 2D of the current matrix to
false.
5. Return the current matrix.
: rotateSelf(rotX, rotY, rotZ)
::
1. If rotY and rotZ are both missing, set rotZ to the value
of rotX and set rotX and rotY to ''0''.
2. If rotY is still missing, set rotY to ''0''.
3. If rotZ is still missing, set rotZ to ''0''.
4. If rotX or rotY are not ''0'' or ''-0'', set is 2D
of the current matrix to false.
5. Post-multiply a rotation transformation on the current matrix around the vector 0,
0, 1 by the specified rotation rotZ in degrees. The 3D rotation matrix is described in CSS Transforms
with alpha = rotZ in degrees. [[!CSS3-TRANSFORMS]]
6. Post-multiply a rotation transformation on the current matrix around the vector 0,
1, 0 by the specified rotation rotY in degrees. The 3D rotation matrix is described in CSS Transforms
with alpha = rotY in degrees. [[!CSS3-TRANSFORMS]]
7. Post-multiply a rotation transformation on the current matrix around the vector 1,
0, 0 by the specified rotation rotX in degrees. The 3D rotation matrix is described in CSS Transforms
with alpha = rotX in degrees. [[!CSS3-TRANSFORMS]]
8. Return the current matrix.
: rotateFromVectorSelf(x, y)
::
1. Post-multiply a rotation transformation on the current matrix. The rotation angle
is determined by the angle between the vector (1,0)T and
(x,y)T in the clockwise direction. If x and
y should both be ''0'' or ''-0'', the angle is specified as ''0''. The 2D rotation
matrix is described in CSS
Transforms where alpha is the angle between the vector (1,0)T and
(x,y)T in degrees. [[!CSS3-TRANSFORMS]]
2. Return the current matrix.
: rotateAxisAngleSelf(x, y, z, angle)
::
1. Post-multiply a rotation transformation on the current matrix around the specified
vector x, y, z by the specified rotation angle in
degrees. The 3D rotation matrix is described in CSS Transforms
with alpha = angle in degrees. [[!CSS3-TRANSFORMS]]
2. If x or y are not ''0'' or ''-0'', set is 2D of
the current matrix to false.
3. Return the current matrix.
: skewXSelf(sx)
::
1. Post-multiply a skewX transformation on the current matrix by the specified angle
sx in degrees. The 2D skewX matrix is described in CSS Transforms
with alpha = sx in degrees. [[!CSS3-TRANSFORMS]]
2. Return the current matrix.
: skewYSelf(sy)
::
1. Post-multiply a skewX transformation on the current matrix by the specified angle
sy in degrees. The 2D skewY matrix is described in CSS Transforms
with beta = sy in degrees. [[!CSS3-TRANSFORMS]]
2. Return the current matrix.
: invertSelf()
::
1. Invert the current matrix.
2. If the current matrix is not invertible set all attributes to ''NaN'' and set is 2D to false.
3. Return the current matrix.
true:
1. Set |serialized|.\[[M11]] to |value|'s m11 element.
2. Set |serialized|.\[[M12]] to |value|'s m12 element.
3. Set |serialized|.\[[M21]] to |value|'s m21 element.
4. Set |serialized|.\[[M22]] to |value|'s m22 element.
5. Set |serialized|.\[[M41]] to |value|'s m41 element.
6. Set |serialized|.\[[M42]] to |value|'s m42 element.
7. Set |serialized|.\[[Is2D]] to true.
Note: It is possible for a 2D {{DOMMatrix}} or {{DOMMatrixReadOnly}} to have ''-0'' for
some of the other elements, e.g., the m13 element, which will not be
roundtripped by this algorithm.
2. Otherwise:
1. Set |serialized|.\[[M11]] to |value|'s m11 element.
2. Set |serialized|.\[[M12]] to |value|'s m12 element.
3. Set |serialized|.\[[M13]] to |value|'s m13 element.
4. Set |serialized|.\[[M14]] to |value|'s m14 element.
5. Set |serialized|.\[[M21]] to |value|'s m21 element.
6. Set |serialized|.\[[M22]] to |value|'s m22 element.
7. Set |serialized|.\[[M23]] to |value|'s m23 element.
8. Set |serialized|.\[[M24]] to |value|'s m24 element.
9. Set |serialized|.\[[M31]] to |value|'s m31 element.
10. Set |serialized|.\[[M32]] to |value|'s m32 element.
11. Set |serialized|.\[[M33]] to |value|'s m33 element.
12. Set |serialized|.\[[M34]] to |value|'s m34 element.
13. Set |serialized|.\[[M41]] to |value|'s m41 element.
14. Set |serialized|.\[[M42]] to |value|'s m42 element.
15. Set |serialized|.\[[M43]] to |value|'s m43 element.
16. Set |serialized|.\[[M44]] to |value|'s m44 element.
17. Set |serialized|.\[[Is2D]] to false.
Their deserialization steps, given |serialized| and |value|, are:
1. If |serialized|.\[[Is2D]] is true:
1. Set |value|'s m11 element to |serialized|.\[[M11]].
2. Set |value|'s m12 element to |serialized|.\[[M12]].
3. Set |value|'s m13 element to ''0''.
4. Set |value|'s m14 element to ''0''.
5. Set |value|'s m21 element to |serialized|.\[[M21]].
6. Set |value|'s m22 element to |serialized|.\[[M22]].
7. Set |value|'s m23 element to ''0''.
8. Set |value|'s m24 element to ''0''.
9. Set |value|'s m31 element to ''0''.
10. Set |value|'s m32 element to ''0''.
11. Set |value|'s m33 element to ''1''.
12. Set |value|'s m34 element to ''0''.
13. Set |value|'s m41 element to |serialized|.\[[M41]].
14. Set |value|'s m42 element to |serialized|.\[[M42]].
15. Set |value|'s m43 element to ''0''.
16. Set |value|'s m44 element to ''1''.
17. Set |value|'s is 2D to true.
2. Otherwise:
1. Set |value|'s m11 element to |serialized|.\[[M11]].
2. Set |value|'s m12 element to |serialized|.\[[M12]].
3. Set |value|'s m13 element to |serialized|.\[[M13]].
4. Set |value|'s m14 element to |serialized|.\[[M14]].
5. Set |value|'s m21 element to |serialized|.\[[M21]].
6. Set |value|'s m22 element to |serialized|.\[[M22]].
7. Set |value|'s m23 element to |serialized|.\[[M23]].
8. Set |value|'s m24 element to |serialized|.\[[M24]].
9. Set |value|'s m31 element to |serialized|.\[[M31]].
10. Set |value|'s m32 element to |serialized|.\[[M32]].
11. Set |value|'s m33 element to |serialized|.\[[M33]].
12. Set |value|'s m34 element to |serialized|.\[[M34]].
13. Set |value|'s m41 element to |serialized|.\[[M41]].
14. Set |value|'s m42 element to |serialized|.\[[M42]].
15. Set |value|'s m43 element to |serialized|.\[[M43]].
16. Set |value|'s m44 element to |serialized|.\[[M44]].
17. Set |value|'s is 2D to false.
ClientRect interface, which is replaced by
{{DOMRect}}. Implementations conforming to this specification will not support
ClientRect. [[CSSOM-VIEW]]
SVG {#historical-svg}
---------------------
Earlier revisions of SVG defined {{SVGPoint}}, {{SVGRect}}, {{SVGMatrix}}, which are defined in
this specifications as aliases to {{DOMPoint}}, {{DOMRect}}, {{DOMMatrix}}, respectively. [[SVG11]]
Non-standard {#historical-non-standard}
---------------------------------------
Some user agents supported a WebKitPoint interface. Implementations conforming to
this specification will not support WebKitPoint.
Several user agents supported a {{WebKitCSSMatrix}} interface, which is also widely used on the
Web. It is defined in this specification as an alias to {{DOMMatrix}}.
Some user agents supported a MSCSSMatrix interface. Implementations conforming to
this specification will not support MSCSSMatrix.
(angle, originX, originY) to (rotX, rotY, rotZ).
* Changed the {{DOMMatrixReadOnly/scale()}} and {{DOMMatrix/scaleSelf()}} methods to be more
like the previous scaleNonUniform()/scaleNonUniformSelf() methods,
and dropped the scaleNonUniformSelf() method. Keep support for scaleNonUniform()
for legacy reasons.
* Made all arguments optional for {{DOMMatrix}}/{{DOMMatrixReadOnly}} methods, except for
{{DOMMatrix/setMatrixValue()}}.
* Added no-argument constructor.
* Defined {{WebKitCSSMatrix}} to be a legacy window alias for {{DOMMatrix}}.
* In workers, {{DOMMatrix}} and {{DOMMatrixReadOnly}} do not support parsing or stringifying with CSS syntax.
* Defined structured serialization of the interfaces.
* The live bounds attribute on {{DOMQuad}} was replaced with a non-live
{{DOMQuad/getBounds()}} method. The "associated bounding rectangle" concept was also removed.
* Changed the string parser for {{DOMMatrix}} and {{DOMMatrixReadOnly}} to use CSS rules
instead of SVG rules.
* The stringifier for {{DOMMatrix}} and {{DOMMatrixReadOnly}} now throws if there are
non-finite values, and otherwise uses the [=ToString=] algorithm. [[ECMA-262]]
* Made comparisons treat ''0'' and ''-0'' as equal throughout.
* Added [[#priv-sec]] and [[#historical]] sections.
The following changes were made since the 18 September 2014 Working Draft.
* Exposed {{DOMPointReadOnly}}, {{DOMPoint}}, {{DOMRectReadOnly}}, {{DOMRect}}, {{DOMQuad}},
{{DOMMatrixReadOnly}} and {{DOMMatrix}} to {{Window}} and {{Worker}}. Defined cloning of
the interface.
The following changes were made since the 26 June 2014 Last Call Public Working
Draft.
* {{DOMPointReadOnly}} got a constructor taking 4 arguments.
* {{DOMRectReadOnly}} got a constructor taking 4 arguments.
* {{DOMMatrixReadOnly}} got a constructor taking a sequence of numbers as argument.
* {{DOMRectList}} turned to an ArrayClass. The interfaces can just be used for legacy
interfaces.
* Put {{DOMRectList}} on at-Risk awaiting browser feedback.
* All interfaces are described in the sense of internal elements to describe the
read-only/writable and inheriting behavior.
* Replace {{IndexSizeError}} exception with {{TypeError}}.
The following changes were made since the 22 May 2014 First Public Working Draft.
* Renamed mutable transformation methods *By to *Self. (E.g. translateBy() got
renamed to {{DOMMatrix/translateSelf()}}.)
* Renamed invert() to {{DOMMatrix/invertSelf()}}.
* Added {{DOMMatrix/setMatrixValue()}} which takes a transformation list as {{DOMString}}.
* {{DOMMatrixReadOnly/is2D}} and {{DOMMatrixReadOnly/isIdentity}} are read-only attributes now.
* {{DOMMatrixReadOnly}} gets flagged to track 3D transformation and attribute settings for
{{DOMMatrixReadOnly/is2D}}.
* {{DOMMatrix/invertSelf()}} and {{DOMMatrixReadOnly/inverse()}} do not throw exceptions anymore.