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:
Sam 2025-09-06 20:01:21 +02:00 committed by GitHub
parent bd3231847e
commit 643ac08cf0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 300 additions and 64 deletions

View file

@ -119,6 +119,33 @@ impl<DrawTarget: GenericDrawTarget> CanvasData<DrawTarget> {
);
}
pub(crate) fn stroke_text(
&mut self,
text_bounds: Rect<f64>,
text_runs: Vec<TextRun>,
fill_or_stroke_style: FillOrStrokeStyle,
line_options: LineOptions,
_shadow_options: ShadowOptions,
composition_options: CompositionOptions,
transform: Transform2D<f64>,
) {
self.maybe_bound_shape_with_pattern(
fill_or_stroke_style,
composition_options,
&text_bounds,
transform,
|self_, style| {
self_.drawtarget.stroke_text(
text_runs,
style,
line_options,
composition_options,
transform,
);
},
);
}
pub(crate) fn fill_rect(
&mut self,
rect: &Rect<f32>,