aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webidls
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/webidls')
-rw-r--r--components/script/dom/webidls/CanvasRenderingContext2D.webidl3
-rw-r--r--components/script/dom/webidls/TextMetrics.webidl23
2 files changed, 25 insertions, 1 deletions
diff --git a/components/script/dom/webidls/CanvasRenderingContext2D.webidl b/components/script/dom/webidls/CanvasRenderingContext2D.webidl
index 92e8b80d5ef..2da0372a9ba 100644
--- a/components/script/dom/webidls/CanvasRenderingContext2D.webidl
+++ b/components/script/dom/webidls/CanvasRenderingContext2D.webidl
@@ -153,7 +153,8 @@ interface CanvasText {
optional unrestricted double maxWidth);
//void strokeText(DOMString text, unrestricted double x, unrestricted double y,
// optional unrestricted double maxWidth);
- //TextMetrics measureText(DOMString text);
+ [Pref="dom.canvas-text.enabled"]
+ TextMetrics measureText(DOMString text);
};
[Exposed=(PaintWorklet, Window, Worker), NoInterfaceObject]
diff --git a/components/script/dom/webidls/TextMetrics.webidl b/components/script/dom/webidls/TextMetrics.webidl
new file mode 100644
index 00000000000..f3d90450824
--- /dev/null
+++ b/components/script/dom/webidls/TextMetrics.webidl
@@ -0,0 +1,23 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+
+// https://html.spec.whatwg.org/multipage/#textmetrics
+[Exposed=(PaintWorklet, Window, Worker), Pref="dom.canvas-text.enabled"]
+interface TextMetrics {
+ // x-direction
+ readonly attribute double width; // advance width
+ readonly attribute double actualBoundingBoxLeft;
+ readonly attribute double actualBoundingBoxRight;
+
+ // y-direction
+ readonly attribute double fontBoundingBoxAscent;
+ readonly attribute double fontBoundingBoxDescent;
+ readonly attribute double actualBoundingBoxAscent;
+ readonly attribute double actualBoundingBoxDescent;
+ readonly attribute double emHeightAscent;
+ readonly attribute double emHeightDescent;
+ readonly attribute double hangingBaseline;
+ readonly attribute double alphabeticBaseline;
+ readonly attribute double ideographicBaseline;
+};