Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS colors parsed for canvas use should explicitly state the element to resolve currentcolor against #10398

Closed
heycam opened this issue Jun 5, 2024 · 2 comments · Fixed by #10399
Assignees

Comments

@heycam
Copy link
Contributor

heycam commented Jun 5, 2024

What is the issue with the HTML Standard?

Various sections that define how 2D canvas context APIs parse CSS color values link to the "parse a CSS <color> value" algorithm in the CSS Color spec. That algorithm expects to be passed in the specific element to resolve currentcolor against, and if no element is passed in, currentcolor resolves to the initial value of 'color'.

The uses of "parse a CSS '' value" (e.g. in the fillStyle setter) do not pass in an element, but there are WPTs that assume it resolves against the <canvas> element (e.g. html/canvas/element/fill-and-stroke-styles/2d.fillStyle.parse.current.basic).

@annevk
Copy link
Member

annevk commented Jun 6, 2024

Ah, I messed this up in #10175. I will take this.

@annevk annevk self-assigned this Jun 6, 2024
@annevk
Copy link
Member

annevk commented Jun 6, 2024

The current text reads:

Let parsedValue be the result of parsing the given value with this's canvas attribute's value.

The canvas attribute returns the element.

We shouldn't pass anything though when that is not a canvas element as is the case for OffscreenCanvas. That's a bug.

For reference: https://drafts.csswg.org/css-color-4/#parse-a-css-color-value

annevk added a commit that referenced this issue Jun 6, 2024
Also modernize the way we handle shadowColor.

Closes #10398.
annevk added a commit that referenced this issue Jun 8, 2024
Also modernize the way we handle shadowColor.

Closes #10398.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants