aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/offscreencanvasrenderingcontext2d.rs
diff options
context:
space:
mode:
authorSteven Novaryo <65610990+stevennovaryo@users.noreply.github.com>2025-04-01 19:22:00 +0800
committerGitHub <noreply@github.com>2025-04-01 11:22:00 +0000
commita77592e281aad3df23e38fcc574059a31c37f30c (patch)
tree29864dca24b1e8f699400b0264a4a7d199fa1d0e /components/script/dom/offscreencanvasrenderingcontext2d.rs
parentbc6926d1feea04b41879d43507509636db29b377 (diff)
downloadservo-a77592e281aad3df23e38fcc574059a31c37f30c.tar.gz
servo-a77592e281aad3df23e38fcc574059a31c37f30c.zip
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>
Diffstat (limited to 'components/script/dom/offscreencanvasrenderingcontext2d.rs')
-rw-r--r--components/script/dom/offscreencanvasrenderingcontext2d.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/components/script/dom/offscreencanvasrenderingcontext2d.rs b/components/script/dom/offscreencanvasrenderingcontext2d.rs
index 731ef6d008a..69a1d41af2e 100644
--- a/components/script/dom/offscreencanvasrenderingcontext2d.rs
+++ b/components/script/dom/offscreencanvasrenderingcontext2d.rs
@@ -340,6 +340,26 @@ impl OffscreenCanvasRenderingContext2DMethods<crate::DomTypeHolder>
self.context.SetMiterLimit(limit)
}
+ /// <https://html.spec.whatwg.org/multipage/#dom-context-2d-setlinedash>
+ fn SetLineDash(&self, segments: Vec<f64>) {
+ self.context.SetLineDash(segments)
+ }
+
+ /// <https://html.spec.whatwg.org/multipage/#dom-context-2d-getlinedash>
+ fn GetLineDash(&self) -> Vec<f64> {
+ self.context.GetLineDash()
+ }
+
+ /// <https://html.spec.whatwg.org/multipage/#dom-context-2d-linedashoffset>
+ fn LineDashOffset(&self) -> f64 {
+ self.context.LineDashOffset()
+ }
+
+ /// <https://html.spec.whatwg.org/multipage/#dom-context-2d-linedashoffset>
+ fn SetLineDashOffset(&self, offset: f64) {
+ self.context.SetLineDashOffset(offset)
+ }
+
// https://html.spec.whatwg.org/multipage/#dom-context-2d-createimagedata
fn CreateImageData(&self, sw: i32, sh: i32, can_gc: CanGc) -> Fallible<DomRoot<ImageData>> {
self.context.CreateImageData(sw, sh, can_gc)