[whatwg] Need clarification on DOM exceptions thrown by canvas 2D drawImage

Hi,

This inquiry is regarding this page of the specification:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
In section 4.8.11.1.10 Images, about drawImage(), it is stated that
"If one of the sw or sh arguments is zero, the implementation must
raise an INDEX_SIZE_ERR exception"  There are no other references to
other circumstances under which INDEX_SIZE_ERR should be thrown, and
there is no indication of what the correct behavior is when the source
rectangle is completely or partially outside the bounds of the source
image.

Right now there are discrepancies in how different browsers handle
this situation.
 -WebKit throws INDEX_SIZE_ERR when the source rectangle is completely
out of bounds
 -Internet Explorer 9 does not throw an exception (which I believe is
the correct behavior, given the current wording of the spec)
 -Firefox 5 throws an INDEX_SIZE_ERR if the source rectangle is out of
bounds to the top or left (negative sx or sy)

Also, this test agrees with (or perhaps influenced) the WebKit
interpretation of the specification:
http://w3c-test.org/html/tests/submission/PhilipTaylor/canvas/2d.drawImage.outsidesource.html

This matter is currently under investigation in WebKit:
https://bugs.webkit.org/show_bug.cgi?id=65709

On the Firefox side, a patch was recently submitted to remove the
exception (be like IE)
https://bugzilla.mozilla.org/show_bug.cgi?id=664107

Thanks providing clarification,

   Justin

Received on Monday, 8 August 2011 13:55:26 UTC