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

Give CanvasRenderingContext2D a getContextAttributes method #2563

Closed
foolip opened this issue Apr 20, 2017 · 8 comments
Closed

Give CanvasRenderingContext2D a getContextAttributes method #2563

foolip opened this issue Apr 20, 2017 · 8 comments

Comments

@foolip
Copy link
Member

foolip commented Apr 20, 2017

WebGLRenderingContextBase has this:
https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.2

For CanvasRenderingContext2D, it would return a CanvasRenderingContext2DSettings dictionary, which currently has only an alpha member.

This was shipped in Chrome in 2013 based on https://wiki.whatwg.org/wiki/CanvasOpaque but in commit 14d9138 only the getContext('2d', {alpha:false}) bit was added.

There is now an Intent to Remove: CanvasRenderingContext2D#getContextAttributes but it will probably be needed again.

Tests: https://jsbin.com/zabifor/edit?html,output (the last test fails in Chrome, but passes if it's the only test, which seems like a bug)

@foolip
Copy link
Member Author

foolip commented Apr 20, 2017

@fserb
Copy link
Contributor

fserb commented Apr 20, 2017

Yeah, Blink talked about this while implementing color space stuff. I think it would make sense to have it as a proper standard.

Apart from color space and alpha, do you see other attributes that could go here?

@foolip
Copy link
Member Author

foolip commented Apr 20, 2017

I imagine it would return a CanvasRenderingContext2DSettings dictionary reflecting what was passed to getContext, or possibly exposing if some settings were ignored/coerced if there are combinations of things that don't make sense and yet do not throw exceptions when used.

For the color space stuff, do you plan to us a partial dictionary CanvasRenderingContext2DSettings, and how will it integrate with https://html.spec.whatwg.org/multipage/scripting.html#2d-context-creation-algorithm? If you need a hook there to avoid monkey patching, we should add that.

@cdumez
Copy link

cdumez commented Apr 24, 2017

I'll defer to @grorg on this.

@junov
Copy link
Member

junov commented Apr 24, 2017

The proposal for adding color space support re-introduces this API. The proposal thread is here:
https://discourse.wicg.io/t/canvas-color-spaces-wide-gamut-and-high-bit-depth-rendering/1505
And the current version of the proposal is here:
https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md

TL;DR: The canvas color space feature has special feature detection requirement. For example, a UA may not support all possible bit depths. When user code requests 10 bits per component, the browser may fall back to 8 bits if it does not support the requested bit depth. getContextAttributes() provides a nice way to detect the actual (as opposed to requested) canvas parameters.

@yell0wd0g
Copy link
Contributor

With this intent to ship this issue should be getting renovated attention since it's in the idl file.

@yell0wd0g
Copy link
Contributor

I filed crbug.com/919118 for implementing this feature, blocked on WPT tests for it in crbug.com/919116. Other browsers issues/bugs should follow shortly.

@yell0wd0g
Copy link
Contributor

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jan 4, 2019
This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
@domenic domenic closed this as completed in 206873a Jan 5, 2019
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jan 7, 2019
This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620426}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Jan 7, 2019
This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620426}
aarongable pushed a commit to chromium/chromium that referenced this issue Jan 7, 2019
This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620426}
alice pushed a commit to alice/html that referenced this issue Jan 7, 2019
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Feb 5, 2019
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727
mykmelez pushed a commit to mykmelez/gecko that referenced this issue Feb 6, 2019
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Feb 7, 2019
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727
mykmelez pushed a commit to mykmelez/gecko that referenced this issue Feb 8, 2019
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727
mustaqahmed pushed a commit to mustaqahmed/html that referenced this issue Feb 15, 2019
mustaqahmed pushed a commit to mustaqahmed/html that referenced this issue Feb 15, 2019
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 3, 2019
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserbchromium.org>
Commit-Queue: Miguel Casas <mcasaschromium.org>
Cr-Commit-Position: refs/heads/master{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727

UltraBlame original commit: 3b729c724dd747dd80a4eb985f9f7f7a6dbabc38
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 3, 2019
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserbchromium.org>
Commit-Queue: Miguel Casas <mcasaschromium.org>
Cr-Commit-Position: refs/heads/master{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727

UltraBlame original commit: 08e997fb760131c426d41f3b3f3af9446ed559e0
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 3, 2019
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserbchromium.org>
Commit-Queue: Miguel Casas <mcasaschromium.org>
Cr-Commit-Position: refs/heads/master{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727

UltraBlame original commit: 3b729c724dd747dd80a4eb985f9f7f7a6dbabc38
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 3, 2019
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserbchromium.org>
Commit-Queue: Miguel Casas <mcasaschromium.org>
Cr-Commit-Position: refs/heads/master{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727

UltraBlame original commit: 08e997fb760131c426d41f3b3f3af9446ed559e0
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 4, 2019
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserbchromium.org>
Commit-Queue: Miguel Casas <mcasaschromium.org>
Cr-Commit-Position: refs/heads/master{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727

UltraBlame original commit: 3b729c724dd747dd80a4eb985f9f7f7a6dbabc38
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 4, 2019
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserbchromium.org>
Commit-Queue: Miguel Casas <mcasaschromium.org>
Cr-Commit-Position: refs/heads/master{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727

UltraBlame original commit: 08e997fb760131c426d41f3b3f3af9446ed559e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants