W3C home > Mailing lists > Public > public-html@w3.org > April 2011

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

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 28 Apr 2011 18:33:16 -0700
Message-ID: <BANLkTikC7S9d18Jk_J-vk0WTLJOzP=JTSA@mail.gmail.com>
To: Boris Zbarsky <bzbarsky@mit.edu>
Cc: "Dailey, David P." <david.dailey@sru.edu>, "public-html@w3.org" <public-html@w3.org>
On Thu, Apr 28, 2011 at 6:18 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 4/28/11 7:53 PM, Dailey, David P. wrote:
>> See for example:
>>
>> http://srufaculty.sru.edu/david.dailey/svg/recent/htmlsvgcanvas7b.htm
>>
>> 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
<http://dev.w3.org/csswg/css3-images/#default-sizing>, 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.)

~TJ
Received on Friday, 29 April 2011 01:34:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:17:28 GMT