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

OffscreenCanvasRenderingContext2D does not have getContextAttributes #10872

Open
ccameron-chromium opened this issue Dec 18, 2024 · 5 comments
Open

Comments

@ccameron-chromium
Copy link
Contributor

What is the issue with the HTML Standard?

The getContextAttributes method allows for querying properties of a CanvasRenderingContext2D, such as its color space, alpha state, etc.

This method is not present on OffscreenCanvasRenderingContext.

This doesn't seem right, especially considering that the offscreen canvas 2D context is created using CanvasRenderingContext2DSettings`. Is that just an oversight?

@annevk
Copy link
Member

annevk commented Dec 18, 2024

Seems worth looking at git blame (see README) to see if there was a reason. Might just be MVP.

cc @whatwg/canvas

@schenney-chromium
Copy link
Contributor

Interestingly there is no discussion of what the options are for OffscreenCanvas.getContext.

@ccameron-chromium
Copy link
Contributor Author

It dates back to this issue (sorry, forgot to mention it). It has a funny history where the API was accidentally shipped, then a Blink "Intent to Remove" caused people to realized that maybe we need it. It was committed here.

Do you think adding this would count as a clarification, or should it have a full review? Would it be best to fix this by:

  • Option A: Creating a new mixin common to CanvasRenderingContext2D and OffscreenCanvasRenderingContext2D
  • Option B: Adding a new method on OffscreenCanvasRenderingContext2D

I'm leaning towards Option B (since most related functionality, like 2d context creation, is separate).

@ccameron-chromium
Copy link
Contributor Author

To fully link things:

  • The 2D context creation algorithm for HTMLCanvasElement is here
  • The offscreen 2D context creation algorithm is here

They share alpha and colorSpace. They do not share desynchronized or willReadFrequently.

@annevk
Copy link
Member

annevk commented Dec 18, 2024

All normative changes go through this process: https://whatwg.org/working-mode#changes

I.e., PR + tests + implementer interest.

B seems fine. We should also split the dictionary if we don't actually support the same options, to enable feature testing going forward.

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