Closed Bug 1807613 Opened 2 years ago Closed 2 years ago

canvas drawImage doesn't work with some svg HTMLImageElement

Categories

(Core :: Graphics: Canvas2D, defect)

Firefox 108
defect

Tracking

()

RESOLVED DUPLICATE of bug 700533

People

(Reporter: felipealexandref, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

Steps to reproduce:

I try to draw a valid HTMLImageElement in a canvas (canvas.context("2d").drawImage method), whose src is a svg with no width and height properties.

http://jsfiddle.net/gjqc95f2/ (please open http version to see a valid example)

Actual results:

The same HTMLImageElement works in the page, but drawImage doesn't can draw this svg. However, If the svg has width and height attributes, then it works.

Workaround: dataurl as base64 seems to work.

Expected results:

The image should be drawn as in google chrome, and as the same image outside of canvas (as a dom element in the document)

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: Canvas2D' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: Canvas2D
Product: Firefox → Core
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Duplicate of bug: 700533
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.