aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webidls/TextMetrics.webidl
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-09-25 11:38:36 -0400
committerGitHub <noreply@github.com>2019-09-25 11:38:36 -0400
commitcf725fc3f59bc1b94e3b35ab4cfe60b3d41559cc (patch)
treee6725a85455c6b9cbebbab1074937f34c5f8723a /components/script/dom/webidls/TextMetrics.webidl
parentcfc05e1d27016f8eeccf1ca0e9b74be844b3535a (diff)
parent3695fb1eb4182b47b80ed31983a5651c8148aef6 (diff)
downloadservo-cf725fc3f59bc1b94e3b35ab4cfe60b3d41559cc.tar.gz
servo-cf725fc3f59bc1b94e3b35ab4cfe60b3d41559cc.zip
Auto merge of #24261 - paulrouget:fakeMeasureTExt, r=jdm
Temporary implementation of Canvas.MeasureText @jdm: that will help with the babylonjs demos. Another approach is to implement that in JS and add it to the demos. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24261) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/webidls/TextMetrics.webidl')
-rw-r--r--components/script/dom/webidls/TextMetrics.webidl23
1 files changed, 23 insertions, 0 deletions
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;
+};