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

It's unclear how shadows should be drawn across various compositing operators #10338

Closed
Scony opened this issue May 9, 2024 · 2 comments
Closed

Comments

@Scony
Copy link

Scony commented May 9, 2024

What is the issue with the HTML Standard?

It looks like https://html.spec.whatwg.org/multipage/canvas.html#drawing-model is not clear enough on how shadows relate to compositing operators and therefore browser implementations are somewhat random thus making a fiddle such as https://jsfiddle.net/np1e0uxd/ yielding different results in browsers I tried (no two browsers yield the same results):

  • chromium
  • firefox
  • safari
  • epiphany
@Kaiido
Copy link
Member

Kaiido commented May 10, 2024

The specs themselves seem particularly clear though: https://html.spec.whatwg.org/multipage/canvas.html#drawing-model and https://html.spec.whatwg.org/multipage/canvas.html#when-shadows-are-drawn

Firefox has an open bug for 10 years, and they have a special handling of a few composite modes which I'm not sure where it's coming from. I suppose WebKit has something like that too.

There seems to be 3 tests in WPT for shadow + composite, but they only use "xor" and "destination-out", which are not problematic in any browser. So I guess a first step would be to write more tests or extend these ones to use more (all?) composite modes.

cc @whatwg/canvas

@Scony
Copy link
Author

Scony commented May 10, 2024

Looks like I missed https://html.spec.whatwg.org/multipage/canvas.html#when-shadows-are-drawn - with that and https://html.spec.whatwg.org/multipage/canvas.html#drawing-model it all actually makes sense.

Looks like we need more WPT tests indeed!

Thank you for help.

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

No branches or pull requests

3 participants
@Scony @Kaiido and others