RESOLVED FIXED 148845
An SVG inherits the container size of the previously drawn HTMLImageElement when drawing it on a canvas
https://bugs.webkit.org/show_bug.cgi?id=148845
Summary An SVG inherits the container size of the previously drawn HTMLImageElement w...
Said Abou-Hallawa
Reported 2015-09-04 16:27:32 PDT
Created attachment 260645 [details] test case Open the attached test case. Result: Two rectangles are drawn. The first one is 10x10 and the second one is 100x100. Expected: The two rectangles should have size of 100x100. Notes: 1. The first rectangle is an <img> tag. Its size is 100x100 and its src is set to a a data uri SVG. 3. The second rectangle is a canvas which loads the same data uri SVG and draws it to a rectangle of 100x100. 2. The SVG does not have an intrinsic size. But it has a viewBox of "0 0 1000 1000". The bug does not happen with the same test case if any of the following happens: 1. The <img> tag is removed (so the canvas does not get the image resource from the cache). 2. The data uri SVG has an intrinsic size. 3. The viewBox is "0 0 100 100".
Attachments
test case (1.72 KB, text/html)
2015-09-04 16:27 PDT, Said Abou-Hallawa
no flags
Patch (17.61 KB, patch)
2015-09-25 22:54 PDT, Said Abou-Hallawa
no flags
Archive of layout-test-results from ews100 for mac-mavericks (609.57 KB, application/zip)
2015-09-25 23:27 PDT, Build Bot
no flags
Patch (17.63 KB, patch)
2015-09-27 18:19 PDT, Said Abou-Hallawa
no flags
Archive of layout-test-results from ews103 for mac-mavericks (611.42 KB, application/zip)
2015-09-27 18:51 PDT, Build Bot
no flags
Patch (8.61 KB, patch)
2015-09-27 21:44 PDT, Said Abou-Hallawa
no flags
Archive of layout-test-results from ews101 for mac-mavericks (609.97 KB, application/zip)
2015-09-27 22:33 PDT, Build Bot
no flags
Patch (8.46 KB, patch)
2015-09-27 23:15 PDT, Said Abou-Hallawa
no flags
test case (3.66 KB, text/html)
2015-09-28 00:02 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2015-09-04 16:28:23 PDT
Said Abou-Hallawa
Comment 2 2015-09-25 22:54:59 PDT
Build Bot
Comment 3 2015-09-25 23:27:36 PDT
Comment on attachment 261962 [details] Patch Attachment 261962 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/213121 New failing tests: svg/as-image/svg-cached-draw-canvas.html
Build Bot
Comment 4 2015-09-25 23:27:40 PDT
Created attachment 261965 [details] Archive of layout-test-results from ews100 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-mavericks Platform: Mac OS X 10.9.5
Darin Adler
Comment 5 2015-09-26 18:57:22 PDT
Comment on attachment 261962 [details] Patch All the name changes from image to imageElement obscure the substance of the code change. Might be nicer as two separate patches. Looks like this changes the result of the svg/as-image/svg-cached-draw-canvas.html test.
Said Abou-Hallawa
Comment 6 2015-09-27 18:17:24 PDT
(In reply to comment #5) > Comment on attachment 261962 [details] > Patch > > All the name changes from image to imageElement obscure the substance of the > code change. Might be nicer as two separate patches. I will submit two patches as suggested. > > Looks like this changes the result of the > svg/as-image/svg-cached-draw-canvas.html test. The test fails only on the bots; it passes locally. It happens because of the image smoothing which happens when drawing two colors on the canvas. The pixels on the boundaries get a mixed color. Actually drawing an SVG with a single color on the canvas is sufficient. I was trying to make sure the SVG is scaled down and not clipped. With a single color, there is no difference between scaling and non-clipping. I will try fixing this by setting the context flag imageSmoothingEnabled to false and see if the test passes on the bots.
Said Abou-Hallawa
Comment 7 2015-09-27 18:19:09 PDT
Build Bot
Comment 8 2015-09-27 18:51:36 PDT
Comment on attachment 261995 [details] Patch Attachment 261995 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/218768 New failing tests: svg/as-image/svg-cached-draw-canvas.html
Build Bot
Comment 9 2015-09-27 18:51:41 PDT
Created attachment 261996 [details] Archive of layout-test-results from ews103 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-mavericks Platform: Mac OS X 10.9.5
Said Abou-Hallawa
Comment 10 2015-09-27 21:24:00 PDT
The renaming patch is: Committed r190273: <http://trac.webkit.org/changeset/190273>.
Said Abou-Hallawa
Comment 11 2015-09-27 21:44:54 PDT
Build Bot
Comment 12 2015-09-27 22:33:24 PDT
Comment on attachment 261998 [details] Patch Attachment 261998 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/219247 New failing tests: svg/as-image/svg-cached-draw-canvas.html
Build Bot
Comment 13 2015-09-27 22:33:27 PDT
Created attachment 261999 [details] Archive of layout-test-results from ews101 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-mavericks Platform: Mac OS X 10.9.5
Said Abou-Hallawa
Comment 14 2015-09-27 23:15:26 PDT
Said Abou-Hallawa
Comment 15 2015-09-28 00:02:47 PDT
Created attachment 262002 [details] test case
WebKit Commit Bot
Comment 16 2015-09-28 00:43:58 PDT
Comment on attachment 262000 [details] Patch Clearing flags on attachment: 262000 Committed r190274: <http://trac.webkit.org/changeset/190274>
WebKit Commit Bot
Comment 17 2015-09-28 00:44:03 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.