New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 599228 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Feature



Sign in to add a comment

support SVG as input for createImageBitmap

Project Member Reported by xidac...@chromium.org, Mar 30 2016

Issue description

A pull request is here:
https://github.com/whatwg/html/issues/923
to get feedback about whether we should support SVG as input for createImageBitmap or not.
 

Comment 1 by junov@chromium.org, Apr 1 2016

Spec change landed: https://github.com/whatwg/html/pull/972

Comment 2 by junov@chromium.org, Apr 1 2016

Cc: jakearchibald@chromium.org
It'd be amazing if the crop params could be used to optimise this too. As in, use the crop information to avoid painting stuff that would be out of view.

Comment 4 by junov@chromium.org, Apr 1 2016

Labels: -Pri-3 Pri-2
Let's definitely keep that in mind.  If that optimization is too involved to put in the initial CL, we should file a separate issue for it.
Project Member

Comment 5 by bugdroid1@chromium.org, Apr 15 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/04c55bfcb5eeb705f7d29a16c72fea6e9737a5b1

commit 04c55bfcb5eeb705f7d29a16c72fea6e9737a5b1
Author: xidachen <xidachen@chromium.org>
Date: Fri Apr 15 16:09:10 2016

Support createImageBitmap from a SVG image

Right now when call createImageBitmap from a SVG image, it will throw a
InvalidStateError. This CL changes such that creating an ImageBitmap from
a SVG image is supported.

This CL includes two layout tests for the case of an SVG image with
and without intrinsic size. The spec here:
https://html.spec.whatwg.org/#imagebitmapfactories
states that createImageBitmap should throw an InvalidStateError
when the SVG image doesn't have an intrinsic size.

BUG= 599228 

Review URL: https://codereview.chromium.org/1890613002

Cr-Commit-Position: refs/heads/master@{#387612}

[add] https://crrev.com/04c55bfcb5eeb705f7d29a16c72fea6e9737a5b1/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg-expected.txt
[add] https://crrev.com/04c55bfcb5eeb705f7d29a16c72fea6e9737a5b1/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg-no-intrinsic-size-expected.txt
[add] https://crrev.com/04c55bfcb5eeb705f7d29a16c72fea6e9737a5b1/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg-no-intrinsic-size.html
[add] https://crrev.com/04c55bfcb5eeb705f7d29a16c72fea6e9737a5b1/third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-svg.html
[modify] https://crrev.com/04c55bfcb5eeb705f7d29a16c72fea6e9737a5b1/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
[modify] https://crrev.com/04c55bfcb5eeb705f7d29a16c72fea6e9737a5b1/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
[modify] https://crrev.com/04c55bfcb5eeb705f7d29a16c72fea6e9737a5b1/third_party/WebKit/Source/core/svg/graphics/SVGImage.h

Status: Fixed (was: Assigned)
Whoa! Quick work! Does this work from workers? Does it optimise for cropping? (See #3)

Looking forward to playing with this.
jaffathecake@: Not yet from a worker. You can do things like this:

var img = new Image();
img.onload = function() {
    createImageBitmap(img);
}
img.src = 'xxx.svg';

Sign in to add a comment