mirror of
https://github.com/servo/servo.git
synced 2025-07-22 06:43:40 +01:00
Temporary implementation of Canvas.MeasureText
This commit is contained in:
parent
748fa72320
commit
3695fb1eb4
11 changed files with 207 additions and 125 deletions
|
@ -23,6 +23,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::dom::htmlcanvaselement::HTMLCanvasElement;
|
||||
use crate::dom::imagedata::ImageData;
|
||||
use crate::dom::offscreencanvas::OffscreenCanvas;
|
||||
use crate::dom::textmetrics::TextMetrics;
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::default::Size2D;
|
||||
|
||||
|
@ -244,6 +245,11 @@ impl OffscreenCanvasRenderingContext2DMethods for OffscreenCanvasRenderingContex
|
|||
self.canvas_state.borrow().FillText(text, x, y, max_width)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#textmetrics
|
||||
fn MeasureText(&self, text: DOMString) -> DomRoot<TextMetrics> {
|
||||
self.canvas_state.borrow().MeasureText(&self.global(), text)
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-linewidth
|
||||
fn LineWidth(&self) -> f64 {
|
||||
self.canvas_state.borrow().LineWidth()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue