[whatwg] CanvasRenderingContext2D.lineTo compatibility problem

Okay the behaviour for lineTo, quadraticCurveTo and bezierCurveTo  
without an existing subpath (unsure about arcTo any "sane" response to  
arcTo with an empty path results in one of those edge cases where  
webkit, gecko, and presto all disagree) should probably be changed to  
(worded better of course :D ):

* lineTo(x, y) is equivalent to moveTo(x, y) if the context has no  
subpaths.
* The quadraticCurveTo(cpx, cpy, x, y) method is equivalent to  
"moveTo(cpx, cpy); quadraticCurveTo(cpx, cpy, x, y);"  if the context  
has no subpaths
* The bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) method is equivalent  
to "moveTo(cp1x, cp1y); bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);"   
if the context has no subpaths

My rational for this change is that it is a relaxation of existing API  
-- in the specified API these cases would become no-ops that feed into  
subsequent calls, eg. lineTo(..);lineTo(..);lineTo(..) will draw  
nothing as the path never becomes non-empty so none of the calls can  
ever have an effect, whereas this re-specification would result in  
subsequent operations drawing something.

--Oliver

On Jul 11, 2009, at 3:41 PM, Oliver Hunt wrote:

> While investigating a compatibility issue with http://www.blahbleh.com/clock.php 
>  I found that the spec behaviour on CanvasRenderingContext2D.lineTo  
> conflicts with what Gecko implements.
>
> The current spec language is
> "The lineTo(x, y) method must do nothing if the context has no  
> subpaths. Otherwise, it must connect the last point in the subpath  
> to the given point (x, y) using a straight line, and must then add  
> the given point (x, y) to the subpath."
>
> Gecko appears to treat the empty path case as moveTo(x,y).  I'm  
> going to do a bit more investigation into the behaviour of this and  
> the other path manipulation functions to see whether lineTo is  
> "special" or this logic effects every function (of course any Gecko  
> devs may be able to answer more quickly than i can manually  
> verify).  On the *assumption* that my initial analysis is correct i  
> propose that the language be updated to something akin to:
> The lineTo(x, y) method is equivalent to moveTo(x, y) if the context  
> has no subpaths. Otherwise, it must connect the last point in the  
> subpath to the given point (x, y) using a straight line, and must  
> then add the given point (x, y) to the subpath.
>
> --Oliver
>
>
>

Received on Saturday, 11 July 2009 21:02:36 UTC