RE: Clarification on Canvas Section 3.10

Philip Taylor wrote:
>  [...]
> So the statement about SYNTAX_ERR seems to be incorrect based on 
> the normative requirements. Looks like it's just a copy-paste error from 
> the equivalent text for createPattern, where the second argument is a 
> keyword string, and it isn't relevant to drawImage.
>
> Filed as http://www.w3.org/Bugs/Public/show_bug.cgi?id=9114 to make 
> sure it gets fixed.

Looks like the original issue here has been fixed. However, I feel that the new text seems a bit ambiguous [1]:

"If the numeric arguments don't make sense (e.g. the destination is a 0×0 rectangle), throws an INDEX_SIZE_ERR exception."

Can we update this text to something like so:

"If the value of the numeric arguments are infinite or NaN, or if the source rectangle is not entirely within the source image, or if one of the sw or sh arguments is zero, or if one of the dw or dh arguments is zero, the implementation must raise an INDEX_SIZE_ERR exception."

Thanks,
Jatinder

[1] http://www.w3.org/TR/2dcontext/#images

Jatinder Mann | Internet Explorer Program Manager 


-----Original Message-----
From: Philip Taylor [mailto:pjt47@cam.ac.uk] 
Sent: Monday, February 22, 2010 3:49 AM
To: Jatinder Mann
Cc: public-canvas-api@w3.org
Subject: Re: Clarification on Canvas Section 3.10

Jatinder Mann wrote:
> Hi,
> 
> As we continue to review the Canvas 2D API Specification [1] we came 
> across an issue in Section 3.10 Images. In the spec, the following 
> text appears:
> 
> "If the second argument is not one of the allowed values, throws a 
> SYNTAX_ERR exception."
> 
> If you take a look at the function definitions for drawImage in this 
> section, the second argument, dx, is the x coordinate of the 
> destination Canvas where the image is to be drawn. This is a number.
> Does the SYNTAX_ERR exception occur when a non-number is given as an 
> argument? Or was this statement intended for the first argument?

The text occurs in the green box which is "a note to authors describing the usage of an interface" (per the "Typographic conventions"), and those notes never define any normative requirements (and don't use any normative keywords), so they ought to be just repeating (in a simplified
form) the real implementation requirements that are described later.

For drawImage, there are no requirements that involve throwing SYNTAX_ERR - the only requirements I see ("the implementation must raise
...") are TYPE_MISMATCH_ERR and INVALID_STATE_ERR for the first argument, and INDEX_SIZE_ERR for the source rectangle arguments, and NOT_SUPPORTED_ERR for non-finite float arguments (specified in the "Web IDL" section in http://dev.w3.org/html5/spec/#dependencies).

So the statement about SYNTAX_ERR seems to be incorrect based on the normative requirements. Looks like it's just a copy-paste error from the equivalent text for createPattern, where the second argument is a keyword string, and it isn't relevant to drawImage.

Filed as http://www.w3.org/Bugs/Public/show_bug.cgi?id=9114 to make sure it gets fixed.

--
Philip Taylor
pjt47@cam.ac.uk

Received on Saturday, 17 July 2010 01:20:22 UTC