mirror of
https://github.com/servo/servo.git
synced 2025-06-13 02:44:29 +00:00
canvas: Implement line dash setters and getters (#36257)
Implement `setLineDash`, `getLineDash`, and `lineDashOffset` from `CanvasPathDrawingStyles` mixin, according to the spec https://html.spec.whatwg.org/multipage/canvas.html#canvaspathdrawingstyles. Testing: Existing WPT. --------- Signed-off-by: stevennovaryo <steven.novaryo@gmail.com>
This commit is contained in:
parent
bc6926d1fe
commit
a77592e281
21 changed files with 144 additions and 92 deletions
|
@ -298,6 +298,16 @@ impl StrokeOptions {
|
|||
StrokeOptions::Raqote(options) => options.cap = val.to_raqote_style(),
|
||||
}
|
||||
}
|
||||
pub fn set_line_dash(&mut self, items: Vec<f32>) {
|
||||
match self {
|
||||
StrokeOptions::Raqote(options) => options.dash_array = items,
|
||||
}
|
||||
}
|
||||
pub fn set_line_dash_offset(&mut self, offset: f32) {
|
||||
match self {
|
||||
StrokeOptions::Raqote(options) => options.dash_offset = offset,
|
||||
}
|
||||
}
|
||||
pub fn as_raqote(&self) -> &raqote::StrokeStyle {
|
||||
match self {
|
||||
StrokeOptions::Raqote(options) => options,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue