HTML5 Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/3476

SVNBugCommentTime (UTC)
3476[Gecko] [Opera] [Webkit] Change how lineTo(), arcTo(), quadraticCurveTo(), and bezierCurveTo() behave when there's not been a moveTo() call before them.2009-07-27 23:47
Index: source
===================================================================
--- source	(revision 3475)
+++ source	(revision 3476)
@@ -26511,52 +26511,68 @@
   create a new subpath with the specified point as its first (and
   only) point.</p>
 
+  <p>When the user agent is to <dfn>ensure there is a subpath</dfn>
+  for a coordinate (<var title="">x</var>, <var title="">y</var>), the
+  user agent must check to see if the context has any subpaths, and if
+  it does not, then the user agent must create a new subpath with the
+  point (<var title="">x</var>, <var title="">y</var>) as its first
+  (and only) point, as if the <code
+  title="dom-context-2d-moveTo">moveTo()</code> method had been
+  called.</p>
 
+
   <p>The <dfn
   title="dom-context-2d-closePath"><code>closePath()</code></dfn>
   method must do nothing if the context has no subpaths. Otherwise, it
   must mark the last subpath as closed, create a new subpath whose
   first point is the same as the previous subpath's first point, and
-  finally add this new subpath to the path. (If the last subpath had
-  more than one point in its list of points, then this is equivalent
-  to adding a straight line connecting the last point back to the
-  first point, thus "closing" the shape, and then repeating the last
-  <code title="dom-context-2d-moveTo">moveTo()</code> call.)</p>
+  finally add this new subpath to the path.</p>
 
+  <p class="note">If the last subpath had more than one point in its
+  list of points, then this is equivalent to adding a straight line
+  connecting the last point back to the first point, thus "closing"
+  the shape, and then repeating the last (possibly implied) <code
+  title="dom-context-2d-moveTo">moveTo()</code> call.</p>
 
+
   <p>New points and the lines connecting them are added to subpaths
   using the methods described below. In all cases, the methods only
   modify the last subpath in the context's paths.</p>
 
 
   <p>The <dfn title="dom-context-2d-lineTo"><code>lineTo(<var
-  title="">x</var>, <var title="">y</var>)</code></dfn> method must do
-  nothing if the context has no subpaths. Otherwise, it must connect
-  the last point in the subpath to the given point (<var
-  title="">x</var>, <var title="">y</var>) using a straight line, and
-  must then add the given point (<var title="">x</var>, <var
-  title="">y</var>) to the subpath.</p>
+  title="">x</var>, <var title="">y</var>)</code></dfn> method must
+  <span>ensure there is a subpath</span> for <span title="">(<var
+  title="">x</var>, <var title="">y</var>)</span> if the context has
+  no subpaths. Otherwise, it must connect the last point in the
+  subpath to the given point (<var title="">x</var>, <var
+  title="">y</var>) using a straight line, and must then add the given
+  point (<var title="">x</var>, <var title="">y</var>) to the
+  subpath.</p>
 
 
   <p>The <dfn
   title="dom-context-2d-quadraticCurveTo"><code>quadraticCurveTo(<var
   title="">cpx</var>, <var title="">cpy</var>, <var title="">x</var>,
-  <var title="">y</var>)</code></dfn> method must do nothing if the
-  context has no subpaths. Otherwise it must connect the last point in
-  the subpath to the given point (<var title="">x</var>, <var
+  <var title="">y</var>)</code></dfn> method must <span>ensure there
+  is a subpath</span> for <span title="">(<var title="">cpx</var>,
+  <var title="">cpy</var>)</span>, and then must connect the last
+  point in the subpath to the given point (<var title="">x</var>, <var
   title="">y</var>) using a quadratic B&eacute;zier curve with control
   point (<var title="">cpx</var>, <var title="">cpy</var>), and must
   then add the given point (<var title="">x</var>, <var
-  title="">y</var>) to the subpath. <a href="#refsBEZIER">[BEZIER]</a></p>
+  title="">y</var>) to the subpath. <a
+  href="#refsBEZIER">[BEZIER]</a></p>
 
 
   <p>The <dfn
   title="dom-context-2d-bezierCurveTo"><code>bezierCurveTo(<var
   title="">cp1x</var>, <var title="">cp1y</var>, <var
   title="">cp2x</var>, <var title="">cp2y</var>, <var
-  title="">x</var>, <var title="">y</var>)</code></dfn> method must do
-  nothing if the context has no subpaths. Otherwise, it must connect
-  the last point in the subpath to the given point (<var
+  title="">x</var>, <var title="">y</var>)</code></dfn> method must
+  <span>ensure there is a subpath</span> for <span title="">(<var
+  title="">cp1x</var>, <var title="">cp1y</var>)</span>, and then must
+  connect the last point in the subpath to the given point (<var
   title="">x</var>, <var title="">y</var>) using a cubic B&eacute;zier
   curve with control points (<var title="">cp1x</var>, <var
   title="">cp1y</var>) and (<var title="">cp2x</var>, <var
@@ -26564,13 +26580,15 @@
   title="">x</var>, <var title="">y</var>) to the subpath. <a
   href="#refsBEZIER">[BEZIER]</a></p>
 
+  <hr>
 
   <p>The <dfn title="dom-context-2d-arcTo"><code>arcTo(<var
   title="">x1</var>, <var title="">y1</var>, <var title="">x2</var>,
   <var title="">y2</var>, <var title="">radius</var>)</code></dfn>
-  method must do nothing if the context has no subpaths. If the
-  context <em>does</em> have a subpath, then the behavior depends on
-  the arguments and the last point in the subpath.</p>
+  method must first <span>ensure there is a subpath</span> for <span
+  title="">(<var title="">x1</var>, <var
+  title="">y1</var>)</span>. Then, the behavior depends on the
+  arguments and the last point in the subpath, as described below.</p>
 
   <p>Negative values for <var title="">radius</var> must cause the
   implementation to raise an <code>INDEX_SIZE_ERR</code>
@@ -26616,6 +26634,7 @@
   title="">The Arc</var>, adding the end tangent point to the
   subpath.</p>
 
+  <hr>
 
   <p>The <dfn title="dom-context-2d-arc"><code>arc(<var
   title="">x</var>, <var title="">y</var>, <var title="">radius</var>,
@@ -26664,6 +26683,7 @@
   implementation to raise an <code>INDEX_SIZE_ERR</code>
   exception.</p>
 
+  <hr>
 
   <p>The <dfn title="dom-context-2d-rect"><code>rect(<var
   title="">x</var>, <var title="">y</var>, <var title="">w</var>, <var

|