[whatwg] A question about the drawimage() canvas function

Rik Cabanier cabanier at gmail.com
Fri Mar 22 19:08:03 PDT 2013

On Sun, Mar 3, 2013 at 12:39 PM, Robert O'Callahan <robert at ocallahan.org>wrote:

> On Mon, Mar 4, 2013 at 3:03 AM, Glenn Maynard <glenn at zewt.org> wrote:
>> On Sun, Mar 3, 2013 at 3:32 AM, Robert O'Callahan <robert at ocallahan.org>wrote:
>>> It would be really simple if we never throw and just paint nothing when
>>> we don't have a valid image or the source has no pixels. Changing cases
>>> from throwing to not throwing is very unlikely to cause compatibility risk.
>>> Why not just do it?
>> It's still going to change something we nearly have interop on.  I'd at
>> least wait for Ian's input before changing behavior, especially since
>> nobody seems to know what the zero-size exception is there for.
> Sure, I'm not going to do this unilaterally.

Kenny found a couple of instances where changing this in webkit will break
the application:
- https://github.com/Animatron/player/pull/70
- https://github.com/aduros/flambe/issues/55
- http://groups.google.com/group/melonjs/msg/571b36150fd2760b
I think this means that we should not add exceptions to the WK
implementation of Canvas.

In light of this, I think we should proceed with changing the W3C canvas
spec (and the implementations) so drawImage doesn't throw anymore on zero
sized image sources.
Being more forgiving could potentially cause other problems but it's not
very likely.

More information about the whatwg mailing list