Closed Bug 1517786 Opened 6 years ago Closed 1 year ago

Implement and ship CanvasRenderingContext2D.getContextAttributes()

Categories

(Core :: Graphics: Canvas2D, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
117 Branch
Tracking Status
firefox117 --- fixed

People

(Reporter: mcasas, Assigned: jfkthame)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36 Steps to reproduce: CanvasRenderingContext2D.getContextAttributes() is not implemented Actual results: CanvasRenderingContext2D.getContextAttributes() is not implemented/present in the idl file [1] as an experiment, but is being standarised anyway, see: https://github.com/whatwg/html/issues/2563 and its associated PR https://github.com/whatwg/html/pull/4253. [1] https://github.com/mozilla/gecko-dev/blob/master/dom/webidl/CanvasRenderingContext2D.webidl
(Ignore "as an experiment" before)
Component: Untriaged → Canvas: 2D
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → All
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(jmuizelaar)
:bz what would you like to know here?
Flags: needinfo?(jmuizelaar) → needinfo?(bzbarsky)
Mostly whether we're generally on board with the proposal. The Blink intent to ship claims we are.
Flags: needinfo?(bzbarsky) → needinfo?(jmuizelaar)
Ah. Yep. I'm on board with the proposal. I believe the Blink intent to ship claims are based on this: https://github.com/whatwg/html/pull/4253#issuecomment-451190882
Flags: needinfo?(jmuizelaar)

Should this be implemented?

Severity: normal → S3

This has been in the HTML spec for a while now (see https://html.spec.whatwg.org/multipage/canvas.html#2dcontext),
so we should probably go ahead and implement it.

Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9ee735b99363 Implement the getContextAttributes() method for CanvasRenderingContext2D. r=gfx-reviewers,lsalzman,emilio

I personally don't think we should be adding dummy properties to the dictionary that we don't actually support. Safari also only ships a subset of properties.

Backed out for causing wpt failures related to CanvasRenderingContext2D.

[task 2023-07-26T00:20:11.580Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: existence and properties of interface prototype object's @@unscopables property 
[task 2023-07-26T00:20:11.580Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: attribute canvas 
[task 2023-07-26T00:20:11.580Z] 00:20:11     INFO - TEST-UNEXPECTED-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: operation getContextAttributes() - expected FAIL
[task 2023-07-26T00:20:11.581Z] 00:20:11     INFO - TEST-INFO | expected FAIL
[task 2023-07-26T00:20:11.611Z] 00:20:11     INFO - ............................................................................
[task 2023-07-26T00:20:11.611Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: operation quadraticCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double) 
[task 2023-07-26T00:20:11.611Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: operation bezierCurveTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) 
[task 2023-07-26T00:20:11.611Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: operation arcTo(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) 
[task 2023-07-26T00:20:11.611Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: operation rect(unrestricted double, unrestricted double, unrestricted double, unrestricted double) 
[task 2023-07-26T00:20:11.611Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: operation roundRect(unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional (unrestricted double or DOMPointInit or sequence<(unrestricted double or DOMPointInit)>)) 
[task 2023-07-26T00:20:11.611Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: operation arc(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) 
[task 2023-07-26T00:20:11.611Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: operation ellipse(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, optional boolean) 
[task 2023-07-26T00:20:11.611Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D must be primary interface of document.createElement("canvas").getContext("2d") 
[task 2023-07-26T00:20:11.612Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | Stringification of document.createElement("canvas").getContext("2d") 
[task 2023-07-26T00:20:11.612Z] 00:20:11     INFO - TEST-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "canvas" with the proper type 
[task 2023-07-26T00:20:11.612Z] 00:20:11     INFO - TEST-UNEXPECTED-PASS | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "getContextAttributes()" with the proper type - expected FAIL
[task 2023-07-26T00:20:11.612Z] 00:20:11     INFO - TEST-INFO | expected FAIL
[task 2023-07-26T00:20:11.918Z] 00:20:11     INFO - ..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
[task 2023-07-26T00:20:11.918Z] 00:20:11     INFO - TEST-OK | /html/dom/idlharness.https.html?exclude=(Document|Window|HTML.*) | took 4467ms
Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c632111f2a2c Implement the getContextAttributes() method for CanvasRenderingContext2D. r=gfx-reviewers,lsalzman,emilio

(In reply to Tom S [:evilpie] from comment #8)

I personally don't think we should be adding dummy properties to the dictionary that we don't actually support. Safari also only ships a subset of properties.

I wondered about that, but this seems to parallel how Chrome is behaving with respect to desynchronized, which it always includes in the returned dictionary, even though it doesn't appear to be supported. (Trying to set it to true at context-creation time doesn't make any difference; it remains false in the returned attributes.)

Flags: needinfo?(jfkthame)

I think desynchronized is a bit of a special case considering that HTML spec doesn't actually require anything to happen when it's enabled and it's more of a hint:

When a CanvasRenderingContext2D object's desynchronized is true, then the user agent may optimize the rendering of the canvas to reduce the latency

https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-desynchronized

That seems quite different to something like colorSpace, which I presume would actually change how the canvas looks to the user.

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 117 Branch

Should we add this to the Fx117 relnotes? Please nominate by setting relnote-firefox? if so.

Flags: needinfo?(jfkthame)

It seems minor enough that I'm not sure it's relnote-worthy, IMO.

Flags: needinfo?(jfkthame)

FYI FF117 docs work for this can be tracked in https://github.com/mdn/content/issues/28283

I personally don't think we should be adding dummy properties to the dictionary that we don't actually support. Safari also only ships a subset of properties.

FWIW Does it matter in this case because even though FF doesn't support the attributes being set, the result returned by this method is correct - i.e. colorSpace defaults to srgb, which is what the color space will be, desynchronized is false if you don't support this attribute, and so on?

emphasis mine, mdn doc says

Depending on the attributes supported by the browser, the log below should display a string that looks something like: {alpha: false, colorSpace: 'srgb', desynchronized: false, willReadFrequently: false}

RFP (resistFingerprinting), in Bug 1422237, always returns srgb for color-gamut. So my question is, is the colorSpace here always srgb or does it depend on the device's color-gamut, i.e do we need to take RFP into consideration ?

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: