mirror of
https://github.com/servo/servo.git
synced 2025-10-01 00:59:15 +01:00
canvas: Implement strokeText
(#39183)
Mostly it's just reusing/copy&edit fillText stuff. Testing: Existing WPT tests Fixes: #29973 Try run: https://github.com/sagudev/servo/actions/runs/17511337550 --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
bd3231847e
commit
643ac08cf0
28 changed files with 300 additions and 64 deletions
|
@ -350,6 +350,19 @@ impl CanvasRenderingContext2DMethods<crate::DomTypeHolder> for CanvasRenderingCo
|
|||
self.mark_as_dirty();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-stroketext
|
||||
fn StrokeText(&self, text: DOMString, x: f64, y: f64, max_width: Option<f64>) {
|
||||
self.canvas_state.stroke_text(
|
||||
&self.global(),
|
||||
self.canvas.canvas().as_deref(),
|
||||
text,
|
||||
x,
|
||||
y,
|
||||
max_width,
|
||||
);
|
||||
self.mark_as_dirty();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#textmetrics
|
||||
fn MeasureText(&self, text: DOMString, can_gc: CanGc) -> DomRoot<TextMetrics> {
|
||||
self.canvas_state.measure_text(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue