Bug 134503 - Canvas drawImage from SVG fails, even sans foreignObject
Summary: Canvas drawImage from SVG fails, even sans foreignObject
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://codepen.io/brianblakely/full/C...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-01 11:54 PDT by BrianMB
Modified: 2014-11-30 10:27 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description BrianMB 2014-07-01 11:54:12 PDT
When SVG images do not contain the foreignObject element, the Canvas API should treat them like any other image type.  At current, they appear to fail no matter what.

Live test:
http://codepen.io/brianblakely/full/Ccoda

Chrome/Firefox output (correct):
http://i.imgur.com/irvfNUj.png

WebKit/IE output (incorrect):
http://i.imgur.com/7o1L3SP.png
Comment 1 BrianMB 2014-07-01 11:58:39 PDT
Naturally, since drawImage never happens, getImageData fails as well.

The test includes an indicator for both method calls.
Comment 2 BrianMB 2014-07-04 16:23:44 PDT
WebKit screenshot is from r170805

OS X 10.9.3
Comment 3 Dirk Schulze 2014-07-04 23:05:53 PDT
It would be great if you could upload examples to Bugzilla directly in the future.

It seems hat you are using Blobs in your example. Blobs with data (at least SVG data but I think in general) are not supported in WebKit yet. There should be open bugs for that.

Thanks for reporting.
Comment 4 Timothy Hatcher 2014-07-04 23:16:17 PDT
I fixed this with bug 119492 with tests. Web Inspector uses it. So you might be doing something else WebKit does not like (as Dirk said, using blobs.)
Comment 5 BrianMB 2014-07-07 09:03:36 PDT
@Dirk:

I will upload directly in the future.  Is there any documentation on best pracs for live bug demos?  Help section is not very helpful in that regard.

I checked Blob support on Can I Use and MDN before incorporating into the demo.  Unfortunately they didn't note any gaps in support!

@Timothy:

I will update my demo to not use blobs and check again.  Last time I ran a round of testing on SVG+Canvas was over a year ago, prior to your commit, so it made sense to see it still broken.  Annoying if that blob usage is definitely the problem, but at least I'm aware of the issue now.
Comment 6 BrianMB 2014-07-17 14:17:45 PDT
http://codepen.io/brianblakely/full/Ccoda

I have modified my test case, and confirmed the feedback.  Thank you!
Comment 7 Daniel Trebbien 2014-11-28 10:17:44 PST
So this bug is fixed?  In Safari 8.0 (10600.1.25.1) I see the crab image twice on the test case:  http://codepen.io/brianblakely/full/Ccoda
Comment 8 BrianMB 2014-11-30 10:27:42 PST
This ticket can be closed.  The problem was with Blob.