summaryrefslogtreecommitdiff
path: root/dom/webidl
diff options
context:
space:
mode:
authorJob Bautista <jobbautista9@aol.com>2023-05-12 15:42:46 +0800
committerJob Bautista <jobbautista9@aol.com>2023-05-12 16:26:06 +0800
commitb2889d844f8c2f826100588b23b741f73e96cbbc (patch)
treee14cb0225f044641194ce5f09839af9aba2a434e /dom/webidl
parentfdfe7a8245eb33db252f2a9a3474ac931f15a7d8 (diff)
downloaduxp-b2889d844f8c2f826100588b23b741f73e96cbbc.tar.gz
Issue #2241 - Part 6: Implement DOMMatrix.fromMatrix.
Also fixes .multiply() to use DOMMatrixInit. Backported from Mozilla bug 1560462.
Diffstat (limited to 'dom/webidl')
-rw-r--r--dom/webidl/DOMMatrix.webidl38
-rw-r--r--dom/webidl/WebKitCSSMatrix.webidl3
2 files changed, 37 insertions, 4 deletions
diff --git a/dom/webidl/DOMMatrix.webidl b/dom/webidl/DOMMatrix.webidl
index 68c70507b7..bf65da35a9 100644
--- a/dom/webidl/DOMMatrix.webidl
+++ b/dom/webidl/DOMMatrix.webidl
@@ -13,6 +13,8 @@
[Constructor(optional (DOMString or sequence<unrestricted double>) init),
Exposed=(Window,Worker)]
interface DOMMatrixReadOnly {
+ [NewObject, Throws] static DOMMatrixReadOnly fromMatrix(optional DOMMatrixInit other);
+
// These attributes are simple aliases for certain elements of the 4x4 matrix
readonly attribute unrestricted double a;
readonly attribute unrestricted double b;
@@ -66,7 +68,7 @@ interface DOMMatrixReadOnly {
unrestricted double angle);
DOMMatrix skewX(unrestricted double sx);
DOMMatrix skewY(unrestricted double sy);
- DOMMatrix multiply(DOMMatrix other);
+ [NewObject, Throws] DOMMatrix multiply(optional DOMMatrixInit other);
DOMMatrix flipX();
DOMMatrix flipY();
DOMMatrix inverse();
@@ -88,6 +90,8 @@ interface DOMMatrixReadOnly {
Constructor(sequence<unrestricted double> numberSequence),
Exposed=(Window,Worker)]
interface DOMMatrix : DOMMatrixReadOnly {
+ [NewObject, Throws] static DOMMatrix fromMatrix(optional DOMMatrixInit other);
+
// These attributes are simple aliases for certain elements of the 4x4 matrix
inherit attribute unrestricted double a;
inherit attribute unrestricted double b;
@@ -114,8 +118,8 @@ interface DOMMatrix : DOMMatrixReadOnly {
inherit attribute unrestricted double m44;
// Mutable transform methods
- DOMMatrix multiplySelf(DOMMatrix other);
- DOMMatrix preMultiplySelf(DOMMatrix other);
+ [Throws] DOMMatrix multiplySelf(optional DOMMatrixInit other);
+ [Throws] DOMMatrix preMultiplySelf(optional DOMMatrixInit other);
DOMMatrix translateSelf(unrestricted double tx,
unrestricted double ty,
optional unrestricted double tz = 0);
@@ -147,3 +151,31 @@ interface DOMMatrix : DOMMatrixReadOnly {
[Exposed=Window, Throws] 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;
+};
diff --git a/dom/webidl/WebKitCSSMatrix.webidl b/dom/webidl/WebKitCSSMatrix.webidl
index 8115711a33..e939d37acf 100644
--- a/dom/webidl/WebKitCSSMatrix.webidl
+++ b/dom/webidl/WebKitCSSMatrix.webidl
@@ -18,7 +18,8 @@ interface WebKitCSSMatrix : DOMMatrix {
WebKitCSSMatrix setMatrixValue(DOMString transformList);
// Immutable transform methods
- WebKitCSSMatrix multiply(WebKitCSSMatrix other);
+ [Throws]
+ WebKitCSSMatrix multiply(optional DOMMatrixInit other);
[Throws]
WebKitCSSMatrix inverse();
WebKitCSSMatrix translate(optional unrestricted double tx = 0,