summaryrefslogtreecommitdiff
path: root/dom/webidl
diff options
context:
space:
mode:
authorJob Bautista <jobbautista9@aol.com>2023-05-12 11:35:18 +0800
committerJob Bautista <jobbautista9@aol.com>2023-05-12 16:26:05 +0800
commit4c2a1920b821645f1766dec320d83f1ffb97ce35 (patch)
tree2e3ad720b5cac156c8cf55558d737b1ca61d2d6a /dom/webidl
parent29bdffbb54691ce31245c921dd07850fb6478d4c (diff)
downloaduxp-4c2a1920b821645f1766dec320d83f1ffb97ce35.tar.gz
Issue #2241 - Part 4.1: Get DOMPoint, DOMQuad, DOMRect, DOMMatrix a bit closer to spec.
Backported from Mozilla bug 1186265's part 1.
Diffstat (limited to 'dom/webidl')
-rw-r--r--dom/webidl/DOMMatrix.webidl4
-rw-r--r--dom/webidl/DOMPoint.webidl15
-rw-r--r--dom/webidl/DOMQuad.webidl6
-rw-r--r--dom/webidl/DOMRect.webidl9
4 files changed, 24 insertions, 10 deletions
diff --git a/dom/webidl/DOMMatrix.webidl b/dom/webidl/DOMMatrix.webidl
index 6b236ae666..97dc16616c 100644
--- a/dom/webidl/DOMMatrix.webidl
+++ b/dom/webidl/DOMMatrix.webidl
@@ -10,7 +10,8 @@
* liability, trademark and document use rules apply.
*/
-[Pref="layout.css.DOMMatrix.enabled"]
+[Pref="layout.css.DOMMatrix.enabled",
+ Constructor(optional (DOMString or sequence<unrestricted double>) init)]
interface DOMMatrixReadOnly {
// These attributes are simple aliases for certain elements of the 4x4 matrix
readonly attribute unrestricted double a;
@@ -77,6 +78,7 @@ interface DOMMatrixReadOnly {
[Throws] Float32Array toFloat32Array();
[Throws] Float64Array toFloat64Array();
stringifier;
+ [Default] object toJSON();
};
[Pref="layout.css.DOMMatrix.enabled",
diff --git a/dom/webidl/DOMPoint.webidl b/dom/webidl/DOMPoint.webidl
index d092d900f5..2ebba958e4 100644
--- a/dom/webidl/DOMPoint.webidl
+++ b/dom/webidl/DOMPoint.webidl
@@ -10,19 +10,26 @@
* liability, trademark and document use rules apply.
*/
-[Pref="layout.css.DOMPoint.enabled"]
+[Pref="layout.css.DOMPoint.enabled",
+ Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
+ optional unrestricted double z = 0, optional unrestricted double w = 1)]
interface DOMPointReadOnly {
+ [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;
+
+ [Default] object toJSON();
};
[Pref="layout.css.DOMPoint.enabled",
- Constructor(optional DOMPointInit point),
- Constructor(unrestricted double x, unrestricted double y,
+ Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
optional unrestricted double z = 0, optional unrestricted double w = 1)]
interface DOMPoint : DOMPointReadOnly {
+ [NewObject] static DOMPoint fromPoint(optional DOMPointInit other);
+
inherit attribute unrestricted double x;
inherit attribute unrestricted double y;
inherit attribute unrestricted double z;
@@ -34,4 +41,4 @@ dictionary DOMPointInit {
unrestricted double y = 0;
unrestricted double z = 0;
unrestricted double w = 1;
-}; \ No newline at end of file
+};
diff --git a/dom/webidl/DOMQuad.webidl b/dom/webidl/DOMQuad.webidl
index b933987d59..f3674e9ad7 100644
--- a/dom/webidl/DOMQuad.webidl
+++ b/dom/webidl/DOMQuad.webidl
@@ -19,5 +19,7 @@ interface DOMQuad {
[SameObject] readonly attribute DOMPoint p2;
[SameObject] readonly attribute DOMPoint p3;
[SameObject] readonly attribute DOMPoint p4;
- [SameObject] readonly attribute DOMRectReadOnly bounds;
-}; \ No newline at end of file
+ [NewObject] DOMRectReadOnly getBounds();
+
+ [Default] object toJSON();
+};
diff --git a/dom/webidl/DOMRect.webidl b/dom/webidl/DOMRect.webidl
index 24a07900c5..4a4f3e4eda 100644
--- a/dom/webidl/DOMRect.webidl
+++ b/dom/webidl/DOMRect.webidl
@@ -10,9 +10,8 @@
* liability, trademark and document use rules apply.
*/
-[Constructor,
- Constructor(unrestricted double x, unrestricted double y,
- unrestricted double width, unrestricted double height)]
+[Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
+ optional unrestricted double width = 0, optional unrestricted double height = 0)]
interface DOMRect : DOMRectReadOnly {
inherit attribute unrestricted double x;
inherit attribute unrestricted double y;
@@ -20,6 +19,8 @@ interface DOMRect : DOMRectReadOnly {
inherit attribute unrestricted double height;
};
+[Constructor(optional unrestricted double x = 0, optional unrestricted double y = 0,
+ optional unrestricted double width = 0, optional unrestricted double height = 0)]
interface DOMRectReadOnly {
readonly attribute unrestricted double x;
readonly attribute unrestricted double y;
@@ -29,6 +30,8 @@ interface DOMRectReadOnly {
readonly attribute unrestricted double right;
readonly attribute unrestricted double bottom;
readonly attribute unrestricted double left;
+
+ [Default] object toJSON();
};
dictionary DOMRectInit {