W3C home > Mailing lists > Public > public-canvas-api@w3.org > April to June 2010

Re: drawImage() shouldn't throw INVALID_STATE_ERR

From: Jatinder Mann <jmann@microsoft.com>
Date: Fri, 23 Apr 2010 02:39:28 +0000
To: "public-canvas-api@w3.org" <public-canvas-api@w3.org>
CC: "ian@hixie.ch" <ian@hixie.ch>, "simonp@opera.com" <simonp@opera.com>
Message-ID: <EAACC9DF6817544486F0D0ADA05CA4281A458550@TK5EX14MBXC120.redmond.corp.microsoft.com>
On Mon, 31 Aug 2009 16:02:01 +0200, Simon Pieters <simonp@opera.com> wrote:

>On Fri, 28 Aug 2009 03:03:19 +0200, Ian Hickson <ian@hixie.ch> wrote:

>> On Mon, 17 Aug 2009, Simon Pieters wrote:
>>> On Fri, 14 Aug 2009 03:54:08 +0200, Ian Hickson <ian@hixie.ch> wrote:
>>> > 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?
>>>
>>> It should return null, which will be ignored when set on fillStyle and
>>> strokeStyle.
>>
>> Done. (It still doesn't return false, though, since you can detect this
>> case yourself if you really care.)
>>
>
>It looks like you missed two instances of INVALID_STATE_ERR, in the green  
>boxes for context.drawImage and context.createPattern. I can't tell if  
>these boxes are normative spec text or just a summary of the information  
>below, but that's not the point here... 
>
>-- 
>Philip Jägenstedt
>Core Developer
>Opera Software

Looks like this was missed. I opened http://lists.w3.org/Archives/Public/public-html/2009Aug/1458.html. 

Thank you,
Jatinder

Jatinder Mann | Microsoft Program Manager | jmann@microsoft.com
Received on Friday, 23 April 2010 02:41:16 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:10:26 UTC