[whatwg] CanvasRenderingContext2D.lineTo compatibility problem

Oliver Hunt oliver at apple.com
Sat Jul 11 15:41:38 PDT 2009


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






More information about the whatwg mailing list