mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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 -->
This commit is contained in:
commit
cf725fc3f5
11 changed files with 207 additions and 122 deletions
|
@ -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]
|
||||
|
|
23
components/script/dom/webidls/TextMetrics.webidl
Normal file
23
components/script/dom/webidls/TextMetrics.webidl
Normal file
|
@ -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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue