WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
39059
canvas drawImage does not render SVG with embedded images correctly
https://bugs.webkit.org/show_bug.cgi?id=39059
Summary
canvas drawImage does not render SVG with embedded images correctly
Justin Cormack
Reported
2010-05-13 06:31:54 PDT
Created
attachment 55968
[details]
simple svg file with embedded image If you load an SVG image into a canvas using drawImage(), it does not draw any <image> items that are in the SVG file. Example included - 2 files, 1 SVG file which renders correctly (3 circles and a red bitmap blob), plus Javascript that loads that image into canvas and does not show the bitmap.
Attachments
simple svg file with embedded image
(960 bytes, image/svg+xml)
2010-05-13 06:31 PDT
,
Justin Cormack
no flags
Details
file that loads the svg file into canvas, renders without bitmap
(410 bytes, text/html)
2010-05-13 06:32 PDT
,
Justin Cormack
no flags
Details
Test case
(447 bytes, text/html)
2014-05-12 05:42 PDT
,
Dirk Schulze
no flags
Details
test case (working) - wait for sub-resources
(730 bytes, text/html)
2016-10-12 10:14 PDT
,
Said Abou-Hallawa
no flags
Details
Safari 15.5 vs STP 148
(1.26 MB, image/png)
2022-06-29 17:41 PDT
,
Ahmad Saleem
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Justin Cormack
Comment 1
2010-05-13 06:32:42 PDT
Created
attachment 55969
[details]
file that loads the svg file into canvas, renders without bitmap
Dirk Schulze
Comment 2
2014-05-12 05:42:31 PDT
Created
attachment 231289
[details]
Test case I think this might be a duplicate of other bugs where an SVG image doesn't load embedded images.
Dirk Schulze
Comment 3
2016-10-12 05:51:27 PDT
The embedded image gets rendered on reloading the document. I am not sure if the embedded image might not be encoded in time for the onload event. I also don't know if onload requires images to be encoded and ready for rendering. But how else would the user know if the SVG is ready to render?
Said Abou-Hallawa
Comment 4
2016-10-12 10:14:44 PDT
Created
attachment 291366
[details]
test case (working) - wait for sub-resources
Said Abou-Hallawa
Comment 5
2016-10-12 10:41:47 PDT
(In reply to
comment #3
)
> The embedded image gets rendered on reloading the document. I am not sure if > the embedded image might not be encoded in time for the onload event. I also > don't know if onload requires images to be encoded and ready for rendering. > But how else would the user know if the SVG is ready to render?
I added a new test case where it waits for 100ms after onLoad() event to ensure the sub-resources are loaded/decoded before drawing the image to the canvas. Of course this will not be a reliable way to fix the issue if the data url sub-resource is big or the hardware is slow. The data url image is the only exception to be allowed as a sub-resource in an SVG. No loading from network is involved since all the data are loaded with the SVG itself. The only overhead is decoding the the data url to an image. The sub-resources can also be nested if the data url image is an SVG image which has a data url image.
Ahmad Saleem
Comment 6
2022-06-29 15:51:09 PDT
If I use the attached test case [test case(working) - wait for sub-resources], it renders "red" fog pixelated in Safari 15.5 on macOS 12.4 but when using Safari Technical Preview 148, it renders it similar to other browsers (Chrome Canary 105 and Firefox Nightly 104). I think it is fixed along the lines. Can this be marked as "RESOLVED CONFIGURATION CHANGED" considering it is fixed in future versions? If someone knows exact bug, where it is fixed or likely fixed as knock-off effect then it can be marked as Duplicate of XYZ. Thanks!
Alexey Proskuryakov
Comment 7
2022-06-29 16:46:19 PDT
I think that the bug will be fixed once Dirk's "Test case" passes, and that still doesn't, at least not in a clean browsing session.
Ahmad Saleem
Comment 8
2022-06-29 17:41:17 PDT
Created
attachment 460563
[details]
Safari 15.5 vs STP 148 @ap - I tested it in "Private Browse" where cookies and cache does not impact and this attached is screenshot of STP 148 behavior compared to Safari 15.5. STP behavior matches with Chrome Canary 105 and Firefox Nightly 104. If I am testing it incorrectly, please educate, so in future I don't make those mistakes. Thanks!
Alexey Proskuryakov
Comment 9
2022-07-01 10:51:04 PDT
I think that you tested with "test case (working) - wait for sub-resources", but not with "Test case"? As Said explained when posting it, that was a demonstration meant to help isolate what the bug is - it always passed, in contrast to the actual test case for the bug. When loading the actual test case in a clean session, there are only the three overlapping circles displayed.
Brent Fulgham
Comment 10
2022-07-15 14:49:59 PDT
Safari, Chrome, and Firefox all agree on rendering for this test case. I don't believe there is any remaining compatibility issue.
Brent Fulgham
Comment 11
2022-07-15 14:50:51 PDT
Actually -- I see the issue: There is a race condition. If you reload the SVG test case it works. The first load lacks the background image.
Radar WebKit Bug Importer
Comment 12
2022-07-15 14:51:04 PDT
<
rdar://problem/97095682
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug