Allow currentColor in canvas context's shadowColor (#30754)

This allows unifying the parse_color function and method, aligns Servo
with other browsers, and obeys the HTML spec:
 - https://html.spec.whatwg.org/multipage/canvas.html#shadows
 - https://html.spec.whatwg.org/multipage/infrastructure.html#parsed-as-a-css-color-value
This commit is contained in:
Oriol Brufau 2023-11-20 12:03:18 +01:00 committed by GitHub
parent 334c67a3cc
commit 3543a87592
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 186 additions and 56 deletions

View file

@ -647,7 +647,8 @@ impl CanvasRenderingContext2DMethods for CanvasRenderingContext2D {
// https://html.spec.whatwg.org/multipage/#dom-context-2d-shadowcolor
fn SetShadowColor(&self, value: DOMString) {
self.canvas_state.set_shadow_color(value)
self.canvas_state
.set_shadow_color(self.canvas.as_ref().map(|c| &**c), value)
}
}