Re: [whatwg] A question about the drawimage() canvas function

On Fri, Mar 1, 2013 at 1:59 PM, Glenn Maynard <glenn@zewt.org> wrote:

> On Fri, Mar 1, 2013 at 11:34 AM, Rik Cabanier <cabanier@gmail.com> wrote:
>
>> This behavior seems to match the spec [1] except for step 2:
>>
>> If the image argument is an HTMLCanvasElement object with either a
>> horizontal dimension or a vertical dimension equal to zero, then the
>> implementation throw an InvalidStateError exception and return aborted.
>>
>>
>> I think that should be:
>>
>> If the image argument is a  *CanvasImageSource *object with either a
>> horizontal dimension or a vertical dimension equal to zero, then the
>> implementation throw an InvalidStateError exception and return aborted.
>>
>>
> Step 2 would have to come before step 1.  A "broken" image is also not
> fully decodable, so step 1 would still return without throwing an exception
> before step 2 happens.
>

That's a bit of a conundrum. An image that is downloading might not have a
size so that would change behavior,
Maybe step 1 should say:

If the image argument is an HTMLImageElement object that is not fully
decodable *and whose state is not broken [1]*,...

1:
http://www.whatwg.org/specs/web-apps/current-work/multipage/embedded-content-1.html#img-error


>
> I recommend leaving Firefox alone and changing WebKit (and the spec) to
> match Firefox, because we already have interop (at least in the cases I
> tested) between Firefox and IE, and we already have interop during loads in
> all three.  Changing WebKit to throw after loading will get everyone doing
> the same thing--changing Firefox will still leave IE out.
>
> (I haven't tested with IE10, FWIW, only IE9.)
>
> --
> Glenn Maynard
>
>

Received on Friday, 1 March 2013 22:10:34 UTC