Imagine an SVG file displayed in an img: <img id="i" src="my.svg" ... >

The SVG file can have an explicit size (height and width attributes, in a 
variety of CSS units), or it can have no size (defaulting to "100%"). Whether 
or not the SVG file has explicit units, it may have an intrinsic aspect ratio 
(via the viewBox attribute).

The img can have an explicit size (height and width attributes) or no size. 
Separate from these, it may or may not have a separate display size (CSS units).

Now imagine that the user draws this img to a canvas:

    myCanvasContext.drawImage( document.querySelector('#i'), 0, 0 );

In each of the eight combinations of (img heightwidth/CSS heightwidth/SVG 
heightwidth) being present or not, what are the intrinsic dimensions of the 
"image" drawn to the canvas?
(Should it always use the raster bitmap created for the img? Should it 
re-rasterize the sourced SVG at the specified height/width?)

I have a test page showing current behavior here: 
http://phrogz.net/SVG/svg_to_img_to_canvas.html

Note: Firefox has bug 700533 that currently prevents it from drawing the image 
to the canvas when the SVG has no height/width.
https://bugzilla.mozilla.org/show_bug.cgi?id=700533

Note: Chrome v16 on Win7 produces non-deterministic results when the SVG has no 
height/width; each reload can result in different appearance of the SVG-in-img. 
This may be bug 16167.
https://bugs.webkit.org/show_bug.cgi?id=16167

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

Reply via email to