[whatwg] Need clarification on DOM exceptions thrown by canvas 2D drawImage
jmuizelaar at mozilla.com
Mon Aug 8 14:08:20 PDT 2011
On 2011-08-08, at 4:58 PM, Ian Hickson wrote:
> On Mon, 8 Aug 2011, Justin Novosad wrote:
>> This inquiry is regarding this page of the specification:
>> In section 188.8.131.52.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.
> A bit lower down in the same section, the spec says: "When the filtering
> algorithm requires a pixel value from outside the original image data, it
> must instead use the value from the nearest edge pixel. (That is, the
> filter uses 'clamp-to-edge' behavior.)"
The clamp-to-edge behavior doesn't really work well with Coregraphics' drawImage call. This means that this behaviour is not implemented in Firefox on OS X and I expect WebKit doesn't implement it for a similar reason. I was actually hoping the spec could be changed to the simpler behaviour of just clamping the source rectangle to the bounds of the image. This behaviour is easy to implement on all platforms and is still quite reasonable.
More information about the whatwg