Re: HTMLImageElement -- use of SVG within <canvas>

On Thu, Apr 28, 2011 at 6:18 PM, Boris Zbarsky <> wrote:
> On 4/28/11 7:53 PM, Dailey, David P. wrote:
>> See for example:
>> It runs "properly" in no extant browser, that I'm aware of.
> In Gecko, this testcase fails because the <svg> has no intrinsic size
> specified, so we have no idea how to actually go about drawing it into the
> canvas.
> What the spec says about this case for drawImage is:
>  If the sx, sy, sw, and sh arguments are omitted, they must default
>  to 0, 0, the image's intrinsic width in image pixels, and the image's
>  intrinsic height in image pixels, respectively.
> But this image has no intrinsic size, so this step can't really be
> performed, and we throw instead.
> For the particular case of unspecified source rectangle, it seems like this
> could be made to work for images with no intrinsic size in the spec.
> None of this has to do with the fact that the SVG contains a <script>.

I believe there's a pending bug against the spec to specify that
images should resolve their sizes using the algorithm specified in
<>, using the size
of the canvas as the "specified size".

(This has no effect on bitmap images, but handily fixes all the cases
where an SVG doesn't have a definite size.)


Received on Friday, 29 April 2011 01:34:03 UTC