-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Comments
Looking for implementer interest:
|
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? |
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 |
I'll defer to @grorg on this. |
The proposal for adding color space support re-introduces this API. The proposal thread is here: 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. |
With this intent to ship this issue should be getting renovated attention since it's in the idl file. |
aligning it with WebGLRenderingContext and addressing whatwg#2563.
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. |
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
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}
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}
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}
getContextAttributes() here behaves the same as it does for WebGLRenderingContext; see https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.2. This was previously discussed in https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md#feature-detection. Closes whatwg#2563.
…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
…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
…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
…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
getContextAttributes() here behaves the same as it does for WebGLRenderingContext; see https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.2. This was previously discussed in https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md#feature-detection. Closes whatwg#2563.
getContextAttributes() here behaves the same as it does for WebGLRenderingContext; see https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.2. This was previously discussed in https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md#feature-detection. Closes whatwg#2563.
…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
…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
…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
…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
…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
…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
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)
The text was updated successfully, but these errors were encountered: