W3C home > Mailing lists > Public > whatwg@whatwg.org > November 2012

Re: [whatwg] Canvas in Workers

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 30 Nov 2012 17:44:59 +0000 (UTC)
To: Gregg Tavares (社用) <gman@google.com>
Message-ID: <Pine.LNX.4.64.1211301743080.12469@ps20323.dreamhostps.com>
Cc: Rick Waldron <waldron.rick@gmail.com>, Elliott Sprehn <esprehn@chromium.org>, WHAT Working Group <whatwg@whatwg.org>
On Fri, 30 Nov 2012, Gregg Tavares (社~T) wrote:
> on ImageBitmap should zero size canvases just work (and create a 0 sized
> ImageBitmap)?
> My personal preference is for APIs that just work with zero sizes so I
> don't have to write lots of special cases for handling zero.
> For example [1,2,3].slice(0,0) returns []. It doesn't throw.
> "abc".substring(0,0) returns "" it doesn't throw. fillRect(x, y, 0, 0)
> doesn't throw. etc...
> It just makes life a lot easier

The main reason 0-sized canvases have always thrown in drawImage() is that 
I couldn't work out what you would paint, nor why you'd have a zero-sized 
canvas, and throwing seemed like it'd be the best way to help the author 
figure out where the problem was, rather than just ignoring the call and 
having the author scratch their head about why nothing was happening.

If there's cases where you would legitimately end up with zero-sized 
canvases that you'd try to draw from, though, I'm happy to change it.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 30 November 2012 18:12:47 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:48 UTC