enhance: Implement CanvasRenderingContext2D.measureText (#32704)

Signed-off-by: Chocolate Pie <106949016+chocolate-pie@users.noreply.github.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Chocolate Pie 2024-07-18 04:20:18 +09:00 committed by GitHub
parent d82232d549
commit 1223335547
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 325 additions and 51 deletions

View file

@ -292,7 +292,8 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
// https://html.spec.whatwg.org/multipage/#textmetrics
fn MeasureText(&self, text: DOMString) -> DomRoot<TextMetrics> {
self.canvas_state.measure_text(&self.global(), text)
self.canvas_state
.measure_text(&self.global(), self.canvas.as_deref(), text)
}
// https://html.spec.whatwg.org/multipage/#dom-context-2d-font