W3C home > Mailing lists > Public > public-html@w3.org > June 2008

Re: Canvas ImageData comments

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 13 Jun 2008 03:00:32 +0000 (UTC)
To: Philip Taylor <pjt47@cam.ac.uk>
Cc: HTML WG <public-html@w3.org>
Message-ID: <Pine.LNX.4.62.0806130258240.8559@hixie.dreamhostps.com>

On Sun, 4 May 2008, Philip Taylor wrote:
> 
> Philip Taylor wrote:
> > "If any of the arguments to createImageData() or getImageData() are infinite
> > or NaN, or if either the sw or sh arguments are zero, the method must
> > instead raise an INDEX_SIZE_ERR exception.", and "If any of the arguments to
> > the method are infinite or NaN, the method must raise an INDEX_SIZE_ERR
> > exception." - shouldn't infinite/NaN be handled with NOT_SUPPORTED_ERR, for
> > consistency with every other method? If so, that case shouldn't need
> > mentioning here, since it's implicitly handled by "Common conformance
> > requirements for APIs exposed to JavaScript".
> 
> Oops, I forgot about the part that says "Unless otherwise stated, for 
> the 2D context interface, any method call with a numeric argument whose 
> value is infinite or a NaN value must be ignored", so the "common 
> conformance requirements" section is not relevant, and the exception 
> behaviour does indeed need to be explicit for (get|create)ImageData.
> 
> But why does putImageData throw an exception? It doesn't have a return 
> value, so the call could just be ignored (to be consistent with almost 
> all other void canvas methods).

It throws an exception because there's no reason to ever get an Infinity 
or NaN value in there. It's not like you'll be doing 3D maths and end up 
dividing by zero or anything with this method call.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 13 June 2008 03:01:16 GMT

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