Closed Bug 1500768 Opened Last year Closed Last year

Implement SVG image support for createImageBitmap


(Core :: DOM: Core & HTML, enhancement, P3)




Tracking Status
firefox65 --- fixed


(Reporter: baku, Assigned: baku)


(Keywords: dev-doc-complete)


(2 files)

CanvasImageSource should compose, together with Blob and ImageData, the ImageBitmapSource typedef:

But we don't support SVGImageElement as input for CreateImageBitmap yet.
Priority: -- → P3
Attached patch svg.patchSplinter Review
Assignee: nobody → amarchesini
Attachment #9019952 - Flags: review?(jwatt)
Attached patch svg2.patchSplinter Review
Attachment #9019958 - Flags: review?(jwatt)
Comment on attachment 9019952 [details] [diff] [review]

Review of attachment 9019952 [details] [diff] [review]:

::: dom/canvas/ImageBitmap.cpp
@@ +500,2 @@
>  static bool
> +HasRasterImage(ElementType& aImageEl)

As noted on IRC, this should go away.

@@ +892,5 @@
>    return ret.forget();
>  }
>  /* static */ already_AddRefed<ImageBitmap>
> +ImageBitmap::CreateInternal(nsIGlobalObject* aGlobal, SVGImageElement& aImageEl,

It would be nice to share some of this code, but I guess it's likely to diverge as you fix more of the web-platform-tests.
Attachment #9019952 - Flags: review?(jwatt) → review+
Comment on attachment 9019958 [details] [diff] [review]

Review of attachment 9019958 [details] [diff] [review]:

::: dom/canvas/ImageBitmap.cpp
@@ -497,5 @@
> - * raster image.
> - */
> -template<class ElementType>
> -static bool
> -HasRasterImage(ElementType& aImageEl)

Ah, good. :)
Attachment #9019958 - Flags: review?(jwatt) → review+
I'm guessing that there aren't WPT tests for the steps under 'SVG image' in items 6 at:

Could you look into that, and perhaps add them? I expect we have some failures there.
Yes we have tests. And "SVG image" section is shared with "img" aka HTMLImageElement.
The reason why I moved the origin check is because it should be executed after 1, 2 and 3.
Pushed by
Implement SVGImageElement support for createImageBitmap, r=jwatt
Support SVG images in HTMLImageElements, r=jwatt
Keywords: dev-doc-needed
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
I've added a note to the Fx65 rel notes:

Apart from that, I just needed to update the compat data. I've submitted a PR to do that:

Let me know if this all looks ok!
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.