#1036: [HTML] Fix divergence of CanvasRenderingContext2D and Offscreen with CanvasSettings

Visit on Github.

Opened Jan 8, 2025

こんにちは TAG-さん!

I'm requesting a TAG review of CanvasSettings.

There is a lot of duplicated spec text for CanvasRenderingContext2D and OffscreenCanvasRenderingContext2D, especially related to how CanvasRenderingContext2DSettings is handled. As with all things that are duplicated, there are accidental divergences.

This creates a new mixin interface CanvasSettings. This will unify the accidentally diverged paths, and also prevent this from happening in the future. It will introduce some features accidentally left out of OffscreenCanvasRenderingContext2D.

This is being pursued so that things like floating-point and HDR canvas do not need to add duplicate text when they are added to the specification.

Further details:

  • I have reviewed the TAG's Web Platform Design Principles
  • Relevant time constraints or deadlines:
  • The group where the work on this specification is currently being done: ColorWeb-CG (because of floating-point and HDR canvas)
  • The group where standardization of this work is intended to be done (if different from the current group):
  • Major unresolved issues with or opposition to this specification:
  • This work is being funded by:

Discussions

Log in to see TAG-private discussions.

Discussed Apr 1, 2025 (See Github)

Hadley: Who is interested in reviewing this? Xiaocheng: Can take a look

Discussed Apr 1, 2025 (See Github)
  • @xiaochengh

Xiaocheng: This is a spec refactoring. 2 interfaces that share a lot of commonalities, but specified separately, so there's duplicate text and incidental and incorrect divergence. They're introducing a mixin for the common settings to let both interfaces and other Canvas variants (if any) use the same mixin. In general, this is a good direction. Only complaint is that the names are a little confusing. I left a comment in the brainstorming repo. Mixin called CanvasBitmap, and has 1 method called getContextAttributes(), which returns a dictionary called ???Settings. Should try to unify the terms.

Jeffrey: Is it the method that's exposed to authors?

Xiaocheng: Yes. And dictionary members.

Jeffrey: I think you should post that comment.

Xiaocheng: satisfied with concerns

Jeffrey: SGTM

Comment by @xiaochengh Apr 22, 2025 (See Github)

Hi @ccameron-chromium, we discussed this at a TAG Breakout and are happy with spec cleanup efforts like this.

The only complaint is about naming: the new CanvasBitmap mixin has a getContextAttributes() method that returns a ...Settings dictionary, which seems a bit confusing. Hope the terms can be more consistent.