Intent to implement & ship: canvas2d getContextAttributes method

29 views
Skip to first unread message

Jonathan Kew

unread,
Jul 25, 2023, 2:36:18 PM7/25/23
to dev-pl...@mozilla.org
As of Firefox 117, I intend to implement the getContextAttributes()
method of the CanvasRenderingContext2D interface.

getContextAttributes allows content to query the attributes that were
set when creating a CanvasRenderingContext2D; this may be needed because
just calling getContext("2d", [options]) on a <canvas> will return a
pre-existing context for the canvas element, if there is one, even if it
was created with different options. So a script that cares about the
options may want to verify what it got back from getContext().

Supported in both Blink and WebKit.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1517786

Standard: https://html.spec.whatwg.org/multipage/canvas.html#2dcontext

Testing:
https://wpt.fyi/results/html/canvas/element/manual/context-attributes/getContextAttributes.html

Platform coverage: All

Restricted to secure contexts: No; the entire CanvasRenderingContext2D
interface is not restricted.

Target Release: 117

Preferences behind which this will be implemented: none
Reply all
Reply to author
Forward
0 new messages