[whatwg] Canvas methods and exceptions

Ian Hickson ian at hixie.ch
Fri Feb 1 15:30:25 PST 2008


On Mon, 14 Jan 2008, Oliver Hunt wrote:
> 
> In a recent foray into the world of canvas compatibility I've noticed that a
> number of canvas methods are defined as throwing exceptions on "invalid" input
> which aren't really insane, for example
>  * clear/fill/drawRect with negative width/height
>  * drawImage with negative sx/sw
>  * putImageData with pixel data outside of the 0-255 range

Already fixed.


> Following the idea of doing the least surprising action, i think we 
> should go through the Canvas spec and remove "surprising" exceptions.  
> For instance a negative width for a rectangle should not terminate 
> execution (although whether it should fail silently, or just draw the 
> rect as though it were positioned differently is a question that would 
> need to be answered), ditto for the other cases that i mentioned.

I did this yesterday; if you see any that I missed, please let me know.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list