W3C home > Mailing lists > Public > public-html@w3.org > August 2009

Re: drawImage() shouldn't throw INVALID_STATE_ERR

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 14 Aug 2009 01:54:08 +0000 (UTC)
To: Simon Pieters <simonp@opera.com>
Cc: "public-html@w3.org" <public-html@w3.org>
Message-ID: <Pine.LNX.4.62.0908140153470.6420@hixie.dreamhostps.com>
On Thu, 6 Aug 2009, Simon Pieters wrote:
> The spec says that canvas drawImage() should throw INVALID_STATE_ERR 
> when the image isn't loaded yet or video isn't enough loaded. I think 
> this is a bad idea.
> I expect authors to just draw a video on a canvas when they see fit, 
> test locally or on a stable network, see that it works fine. Then the 
> script will stop working completely for some users because of the 
> uncaught exception when the script tries to drawImage() a video that's 
> not ready yet.
> Moreover, Opera has lazy loading of images (only loading images that are 
> rendered or have some event handlers or were created with new Image() 
> etc), so we'd probably want to just load the image when the script tries 
> to draw it instead of throwing.
> Therefore I suggest that the spec be changed to not throw 
> INVALID_STATE_ERR for drawImage() (and createPattern()).
> The method could be changed from void to return a boolean, indicating 
> whether the image was successfully drawn, so scripts can detect it 
> easily.

What should createPattern() return in this situation?

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 14 August 2009 01:54:43 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:49 UTC