createImageBitmap fails with SVG input |
|||
Issue descriptionhttp://jsbin.com/qazewu/edit?js,console Rejects with null.
,
Mar 22 2016
The spec compliant behavior is to reject the promise with an InvalidStateError, rather than null. For reference: https://html.spec.whatwg.org/multipage/webappapis.html#dom-createimagebitmap To make it possible to go directly from an SVG image to an ImageBitmap, we'd need a new API to specify the scale at which the SVG is to be rasterized. Currently there is no default sizing algorithm defined in the spec.
,
Mar 22 2016
junov@: I am not sure which category of "reject the promise" should this case belong to. In my opinion, the following case seems to fit here: Read the Blob object's data. If an error occurs during reading of the object, then reject the promise with null, and abort these steps.
,
Mar 22 2016
It is point 3: "If the img element's media data is not a bitmap (e.g. it's a vector graphic), then return a promise rejected with an InvalidStateError exception and abort these steps."
,
Mar 22 2016
Oh I see, the example uses a blob, not an img... Hmmm... seems the spec needs to be clarified. What applies is point 6: "If the image data is not in a supported file format (e.g. it's not actually an image at all), or if the image data is corrupted in some fatal way such that the image dimensions cannot be obtained, then reject the promise with null, and abort these steps." So it appears the current behavior is correct.
,
Mar 22 2016
The spec has been updated https://github.com/whatwg/html/issues/864 Promises should never reject with null for the same reasons sync code shouldn't throw null.
,
Mar 22 2016
To clarify, the solution I was hoping for this ticket was for createImageBitmap to successfully create a bitmap from SVG.
,
Mar 22 2016
I've created https://github.com/whatwg/html/issues/923 to get feedback on vector formats and createImageBitmap.
,
Mar 30 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/672ae7a2037e92b305054849f31a7bb4fb873823 commit 672ae7a2037e92b305054849f31a7bb4fb873823 Author: xidachen <xidachen@chromium.org> Date: Wed Mar 30 19:12:14 2016 Reject promise with InvalidStateError instead of null in createImageBitmap(Blob) Right now, the createImageBitmap(Blob) reject promise with null when the input image cannot be decoded, for example, the input image is a SVG image. A recently change is made to the specs here: https://github.com/whatwg/html/pull/884 which states that we should reject the promise with InvalidStateError insetad of null. This CL changes it such that it will reject the promise with a InvalidStateError. BUG= 596251 Review URL: https://codereview.chromium.org/1841313003 Cr-Commit-Position: refs/heads/master@{#384045} [modify] https://crrev.com/672ae7a2037e92b305054849f31a7bb4fb873823/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-invalid-args-expected.txt [modify] https://crrev.com/672ae7a2037e92b305054849f31a7bb4fb873823/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-invalid-blob-in-workers-expected.txt [modify] https://crrev.com/672ae7a2037e92b305054849f31a7bb4fb873823/third_party/WebKit/LayoutTests/fast/canvas/resources/canvas-createImageBitmap-invalid-blob-in-workers.js [modify] https://crrev.com/672ae7a2037e92b305054849f31a7bb4fb873823/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
,
Mar 30 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/672ae7a2037e92b305054849f31a7bb4fb873823 commit 672ae7a2037e92b305054849f31a7bb4fb873823 Author: xidachen <xidachen@chromium.org> Date: Wed Mar 30 19:12:14 2016 Reject promise with InvalidStateError instead of null in createImageBitmap(Blob) Right now, the createImageBitmap(Blob) reject promise with null when the input image cannot be decoded, for example, the input image is a SVG image. A recently change is made to the specs here: https://github.com/whatwg/html/pull/884 which states that we should reject the promise with InvalidStateError insetad of null. This CL changes it such that it will reject the promise with a InvalidStateError. BUG= 596251 Review URL: https://codereview.chromium.org/1841313003 Cr-Commit-Position: refs/heads/master@{#384045} [modify] https://crrev.com/672ae7a2037e92b305054849f31a7bb4fb873823/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-invalid-args-expected.txt [modify] https://crrev.com/672ae7a2037e92b305054849f31a7bb4fb873823/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-invalid-blob-in-workers-expected.txt [modify] https://crrev.com/672ae7a2037e92b305054849f31a7bb4fb873823/third_party/WebKit/LayoutTests/fast/canvas/resources/canvas-createImageBitmap-invalid-blob-in-workers.js [modify] https://crrev.com/672ae7a2037e92b305054849f31a7bb4fb873823/third_party/WebKit/Source/core/imagebitmap/ImageBitmapFactories.cpp
,
Mar 30 2016
Change this from bug-->feature, awaiting for feedback from here: https://github.com/whatwg/html/issues/923
,
Mar 30 2016
Xida, in the interest of clarity, could you close this and create a new fresh crbug that is just about the feature request?
,
Mar 30 2016
Closing this bug, a new crbug is filed here: https://bugs.chromium.org/p/chromium/issues/detail?id=599228
,
Mar 30 2016
|
|||
►
Sign in to add a comment |
|||
Comment 1 by xidac...@chromium.org
, Mar 21 2016Status: Assigned (was: Untriaged)