HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
7024[Gecko] [Internet Explorer] [Opera] [Webkit] Make it possible to draw Path primitives to the canvas.2012-03-10 00:31
@@ -40579,29 +40579,36 @@ dictionary <dfn>TrackEventInit</dfn> : <span>EventInit</span> {
            attribute double <span title="dom-context-2d-shadowOffsetX">shadowOffsetX</span>; // (default 0)
            attribute double <span title="dom-context-2d-shadowOffsetY">shadowOffsetY</span>; // (default 0)
            attribute double <span title="dom-context-2d-shadowBlur">shadowBlur</span>; // (default 0)
            attribute DOMString <span title="dom-context-2d-shadowColor">shadowColor</span>; // (default transparent black)
 
   // rects
   void <span title="dom-context-2d-clearRect">clearRect</span>(double x, double y, double w, double h);
   void <span title="dom-context-2d-fillRect">fillRect</span>(double x, double y, double w, double h);
   void <span title="dom-context-2d-strokeRect">strokeRect</span>(double x, double y, double w, double h);
 
-  // current default path API (see also <span>CanvasPathMethods</span>)
+  // path API (see also <span>CanvasPathMethods</span>)
   void <span title="dom-context-2d-beginPath">beginPath</span>();
   void <span title="dom-context-2d-fill">fill</span>();
+  void <span title="dom-context-2d-fill">fill</span>(<span>Path</span> path);
   void <span title="dom-context-2d-stroke">stroke</span>();
+  void <span title="dom-context-2d-stroke">stroke</span>(<span>Path</span> path);
   void <span title="dom-context-2d-drawSystemFocusRing">drawSystemFocusRing</span>(<span>Element</span> element);
+  void <span title="dom-context-2d-drawSystemFocusRing">drawSystemFocusRing</span>(<span>Path</span> path, <span>Element</span> element);
   boolean <span title="dom-context-2d-drawCustomFocusRing">drawCustomFocusRing</span>(<span>Element</span> element);
+  boolean <span title="dom-context-2d-drawCustomFocusRing">drawCustomFocusRing</span>(<span>Path</span> path, <span>Element</span> element);
   void <span title="dom-context-2d-scrollPathIntoView">scrollPathIntoView</span>();
+  void <span title="dom-context-2d-scrollPathIntoView">scrollPathIntoView</span>(<span>Path</span> path);
   void <span title="dom-context-2d-clip">clip</span>();
+  void <span title="dom-context-2d-clip">clip</span>(<span>Path</span> path);
   boolean <span title="dom-context-2d-isPointInPath">isPointInPath</span>(double x, double y);
+  boolean <span title="dom-context-2d-isPointInPath">isPointInPath</span>(<span>Path</span> path, double x, double y);
 
   // text (see also the <span>CanvasText</span> interface)
   void <span title="dom-context-2d-fillText">fillText</span>(DOMString text, double x, double y, optional double maxWidth);
   void <span title="dom-context-2d-strokeText">strokeText</span>(DOMString text, double x, double y, optional double maxWidth);<!-- v6DVT
   void <span title="dom-context-2d-fillVerticalText">fillVerticalText</span>(DOMString text, double x, double y, optional double maxHeight);
   void <span title="dom-context-2d-strokeVerticalText">strokeVerticalText</span>(DOMString text, double x, double y, optional double maxHeight); -->
   <span>TextMetrics</span> <span title="dom-context-2d-measureText">measureText</span>(DOMString text);
 
   // drawing images
   void <span title="dom-context-2d-drawImage">drawImage</span>((<span>HTMLImageElement</span> or <span>HTMLCanvasElement</span> or <span>HTMLVideoElement</span>) image, double dx, double dy);
@@ -43227,244 +43234,278 @@ v6DVT (also check for '- -' bits in the part above) -->
 
    <dt><var title="">context</var> . <code title="dom-context-2d-beginPath">beginPath</code>()</dt>
 
    <dd>
 
     <p>Resets the current default path.</p>
 
    </dd>
 
    <dt><var title="">context</var> . <code title="dom-context-2d-fill">fill</code>()</dt>
+   <dt><var title="">context</var> . <code title="dom-context-2d-fill">fill</code>(<var title="">path</var>)</dt>
 
    <dd>
 
-    <p>Fills the subpaths of the current default path with the current fill style.</p>
+    <p>Fills the subpaths of the current default path or the given path with the current fill style.</p>
 
    </dd>
 
+
    <dt><var title="">context</var> . <code title="dom-context-2d-stroke">stroke</code>()</dt>
+   <dt><var title="">context</var> . <code title="dom-context-2d-stroke">stroke</code>(<var title="">path</var>)</dt>
 
    <dd>
 
-    <p>Strokes the subpaths of the currnet default path with the current stroke style.</p>
+    <p>Strokes the subpaths of the current default path or the given path with the current stroke style.</p>
 
    </dd>
 
+
    <dt><var title="">context</var> . <code title="dom-context-2d-drawSystemFocusRing">drawSystemFocusRing</code>(<var title="">element</var>)</dt>
+   <dt><var title="">context</var> . <code title="dom-context-2d-drawSystemFocusRing">drawSystemFocusRing</code>(<var title="">path</var>, <var title="">element</var>)</dt>
 
    <dd>
 
     <p>If the given element is focused, draws a focus ring around the
-    current default path, following the platform conventions for focus
-    rings.</p>
+    current default path or hte given path, following the platform
+    conventions for focus rings.</p>
 
    </dd>
 
+
    <dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title="dom-context-2d-drawCustomFocusRing">drawCustomFocusRing</code>(<var title="">element</var>)</dt>
+   <dt><var title="">shouldDraw</var> = <var title="">context</var> . <code title="dom-context-2d-drawCustomFocusRing">drawCustomFocusRing</code>(<var title="">path</var>, <var title="">element</var>)</dt>
 
    <dd>
 
     <p>If the given element is focused, and the user has configured
     his system to draw focus rings in a particular manner (for
     example, high contrast focus rings), draws a focus ring around the
-    current default path and returns false.</p>
+    current default path or the given path and returns false.</p>
 
     <p>Otherwise, returns true if the given element is focused, and
     false otherwise. This can thus be used to determine when to draw a
     focus ring (see <a href="#drawCustomFocusRingExample">the
     example</a> below).</p>
 
    </dd>
 
+
    <dt><var title="">context</var> . <code title="dom-context-2d-scrollPathIntoView">scrollPathIntoView</code>()</dt>
+   <dt><var title="">context</var> . <code title="dom-context-2d-scrollPathIntoView">scrollPathIntoView</code>(<var title="">path</var>)</dt>
 
    <dd>
 
     <p>Scrolls the current default path into view. This is especially
     useful on devices with small screens, where the whole canvas might
     not be visible at once.</p>
 
    </dd>
 
+
    <dt><var title="">context</var> . <code title="dom-context-2d-clip">clip</code>()</dt>
+   <dt><var title="">context</var> . <code title="dom-context-2d-clip">clip</code>(<var title="">path</var>)</dt>
 
    <dd>
 
     <p>Further constrains the clipping region to the current default
     path.</p>
 
    </dd>
 
+
    <dt><var title="">context</var> . <code title="dom-context-2d-isPointInPath">isPointInPath</code>(<var title="">x</var>, <var title="">y</var>)</dt>
+   <dt><var title="">context</var> . <code title="dom-context-2d-isPointInPath">isPointInPath</code>(<var title="">path</var>, <var title="">x</var>, <var title="">y</var>)</dt>
 
    <dd>
 
     <p>Returns true if the given point is in the current default
     path.</p>
 
    </dd>
 
   </dl>
 
   <div class="impl">
 
   <p>The <dfn
   title="dom-context-2d-beginPath"><code>beginPath()</code></dfn>
   method must empty the list of subpaths in the context's current
   default path so that the it once again has zero subpaths.</p>
 
+  <p>Where the following method definitions use the term <i>intended
+  path</i>, it means the <code>Path</code> argument, if one was
+  provided, or the current default path otherwise.</p>
+
+  <p>When the intended path is a <code>Path</code> object, the
+  coordinates of its subpaths must be transformed according to the
+  <code>CanvasRenderingContext2D</code> object's <span
+  title="dom-context-2d-transformation">current transformation
+  matrix</span> when used by these methods (without affecting the
+  <code>Path</code> object itself). When the intended path is the
+  current default path, it is not affected by the transform, (This is
+  because transformations already affect the current default path when
+  it is constructed, so applying it when it is painted as well would
+  result in a double transformation.)</p>
+
   <p>The <dfn title="dom-context-2d-fill"><code>fill()</code></dfn>
-  method must fill all the subpaths of the current default path, using
-  <code title="dom-context-2d-fillStyle">fillStyle</code>, and using
-  the non-zero winding number rule. Open subpaths must be implicitly
+  method must fill all the subpaths of the intended path, using <code
+  title="dom-context-2d-fillStyle">fillStyle</code>, and using the
+  non-zero winding number rule. Open subpaths must be implicitly
   closed when being filled (without affecting the actual
   subpaths).</p>
 
   <p class="note">Thus, if two overlapping but otherwise independent
   subpaths have opposite windings, they cancel out and result in no
   fill. If they have the same winding, that area just gets painted
   once.</p>
 
   <p>The <dfn
   title="dom-context-2d-stroke"><code>stroke()</code></dfn> method
-  must calculate the strokes of all the subpaths of the current
-  default path, using the <code
-  title="dom-context-2d-lineWidth">lineWidth</code>, <code
-  title="dom-context-2d-lineCap">lineCap</code>, <code
+  must calculate the strokes of all the subpaths of the intended path,
+  using the <code title="dom-context-2d-lineWidth">lineWidth</code>,
+  <code title="dom-context-2d-lineCap">lineCap</code>, <code
   title="dom-context-2d-lineJoin">lineJoin</code>, and (if
   appropriate) <code
   title="dom-context-2d-miterLimit">miterLimit</code> attributes, and
   then fill the combined stroke area using the <code
   title="dom-context-2d-strokeStyle">strokeStyle</code> attribute.</p>
 
   <p class="note">Since the subpaths are all stroked as one,
   overlapping parts of the paths in one stroke operation are treated
   as if their union was what was painted.</p>
 
+  <p class="note">The stroke <em>style</em> is affected by the
+  transformation during painting, even if the intended path is the
+  current default path.</p>
+
   <p>Paths, when filled or stroked, must be painted without affecting
-  the current default path, and must be subject to <span
-  title="shadows">shadow effects</span>, <span
+  the current default path or any <code>Path</code> objects, and must
+  be subject to <span title="shadows">shadow effects</span>, <span
   title="dom-context-2d-globalAlpha">global alpha</span>, the <span
   title="clipping region">clipping region</span>, and <span
   title="dom-context-2d-globalCompositeOperation">global composition
-  operators</span>. (Transformations affect the path when the path is
-  created, not when it is painted, though the stroke <em>style</em> is
-  still affected by the transformation during painting.)</p>
+  operators</span>. (The effect of transformations is described above
+  and varies based on which path is being used.)</p>
 
-  <p>Zero-length line segments must be pruned before stroking a
-  path. Empty subpaths must be ignored.</p>
+  <p>Zero-length line segments must be pruned before stroking a path.
+  Empty subpaths must be ignored.</p>
 
   <hr>
 
   <p id="dom-context-2d-drawosfocusring">The <dfn
   title="dom-context-2d-drawSystemFocusRing"><code>drawSystemFocusRing(<var
   title="">element</var>)</code></dfn> method, when invoked, must run
   the following steps:</p>
 
   <ol>
 
    <li><p>If <var title="">element</var> is not focused or is not a
    descendant of the element with whose context the method is
    associated, then abort these steps.</p></li>
 
    <li>
 
     <p>If the user has requested the use of particular focus rings
     (e.g. high-contrast focus rings), or if the <var
     title="">element</var> would have a focus ring drawn around it,
-    then draw a focus ring of the appropriate style along the current
-    default path, following platform conventions, and abort these
-    steps.</p>
+    then draw a focus ring of the appropriate style along the intended
+    path, following platform conventions, and abort these steps.</p>
 
     <p class="note">Some platforms only draw focus rings around
     elements that have been focused from the keyboard, and not those
     focused from the mouse. Other platforms simply don't draw focus
     rings around some elements at all unless relevant accessibility
     features are enabled. This API is intended to follow these
     conventions. User agents that implement distinctions based on the
     manner in which the element was focused are encouraged to classify
     focus driven by the <code title="dom-focus">focus()</code> method
     based on the kind of user interaction event from which the call
     was triggered (if any).</p>
 
     <p>The focus ring should not be subject to the <span
     title="shadows">shadow effects</span>, the <span
-    title="dom-context-2d-globalAlpha">global alpha</span>, or the <span
-    title="dom-context-2d-globalCompositeOperation">global composition
-    operators</span>, but <em>should</em> be subject to the <span
-    title="clipping region">clipping region</span>.</p>
+    title="dom-context-2d-globalAlpha">global alpha</span>, or the
+    <span title="dom-context-2d-globalCompositeOperation">global
+    composition operators</span>, but <em>should</em> be subject to
+    the <span title="clipping region">clipping region</span>. (The
+    effect of transformations is described above and varies based on
+    which path is being used.)</p>
 
    </li>
 
    <li>
 
     <p>Optionally, <a href="#inform">inform the user</a> that the
-    focus is at the location given by the current default path. User
-    agents may wait until the next time the <span>event loop</span>
-    reaches its "update the rendering" step to optionally inform the
-    user.</p>
+    focus is at the location given by the intended path. User agents
+    may wait until the next time the <span>event loop</span> reaches
+    its "update the rendering" step to optionally inform the user.</p>
 
    </li>
 
   </ol>
 
   <p>The <dfn
   title="dom-context-2d-drawCustomFocusRing"><code>drawCustomFocusRing(<var
   title="">element</var>)</code></dfn> method, when invoked, must run
   the following steps:</p>
 
   <ol>
 
    <li><p>If <var title="">element</var> is not focused or is not a
    descendant of the element with whose context the method is
    associated, then return false and abort these steps.</p></li>
 
    <li>
 
     <p>If the user has requested the use of particular focus rings
     (e.g. high-contrast focus rings), then draw a focus ring of the
-    appropriate style along the current default path, return false,
-    and abort these steps.</p>
+    appropriate style along the intended path, return false, and abort
+    these steps.</p>
 
     <p>The focus ring should not be subject to the <span
     title="shadows">shadow effects</span>, the <span
-    title="dom-context-2d-globalAlpha">global alpha</span>, or the <span
-    title="dom-context-2d-globalCompositeOperation">global composition
-    operators</span>, but <em>should</em> be subject to the <span
-    title="clipping region">clipping region</span>.</p>
+    title="dom-context-2d-globalAlpha">global alpha</span>, or the
+    <span title="dom-context-2d-globalCompositeOperation">global
+    composition operators</span>, but <em>should</em> be subject to
+    the <span title="clipping region">clipping region</span>. (The
+    effect of transformations is described above and varies based on
+    which path is being used.)</p>
 
    </li>
 
    <li>
 
     <p>Optionally, <a href="#inform">inform the user</a> that the
-    focus is at the location given by the current default path. User
-    agents may wait until the next time the <span>event loop</span>
-    reaches its "update the rendering" step to optionally inform the
-    user.</p>
+    focus is at the location given by the intended path. User agents
+    may wait until the next time the <span>event loop</span> reaches
+    its "update the rendering" step to optionally inform the user.</p>
 
    </li>
 
    <li><p>Return true.</p></li>
 
   </ol>
 
   <p>The <dfn
   title="dom-context-2d-scrollPathIntoView"><code>scrollPathIntoView()</code></dfn>
   method, when invoked, must run the following steps:</p>
 
   <ol>
 
+   <li><p>Let <var title="">the specified rectangle</var> be the
+   rectangle of the bounding box of the intended path.</p></li>
+
    <li><p>Let <var title="">notional child</var> be a hypothetical
    element that is a rendered child of the <code>canvas</code> element
-   whose dimensions are exactly the rectangle of the bounding box of
-   the current default path.</p></li>
+   whose dimensions are those of <var title="">the specified
+   rectangle</var>.</p></li>
 
    <li><p><span title="scroll an element into view">Scroll <var
    title="">notional child</var> into view</span> with the <var
    title="">align to top flag</var> set.</p>
 
    <li><p>Optionally, <a href="#inform">inform the user</a> that the
    caret and/or selection cover <var title="">the specified
    rectangle</var> of the canvas. User agents may wait until the next
    time the <span>event loop</span> reaches its "update the rendering"
    step to optionally inform the user.</p></li>
@@ -43482,23 +43523,23 @@ v6DVT (also check for '- -' bits in the part above) -->
   title="">element</var> element passed as an argument, if that
   element is focused, and the bounding box of the area to which the
   user agent is scrolling as the bounding box of the current
   selection.</p>
 
   <hr>
 
   <p>The <dfn title="dom-context-2d-clip"><code>clip()</code></dfn>
   method must create a new <dfn>clipping region</dfn> by calculating
   the intersection of the current clipping region and the area
-  described by the current default path, using the non-zero winding
-  number rule. Open subpaths must be implicitly closed when computing
-  the clipping region, without affecting the actual subpaths. The new
+  described by the intended path, using the non-zero winding number
+  rule. Open subpaths must be implicitly closed when computing the
+  clipping region, without affecting the actual subpaths. The new
   clipping region replaces the current clipping region.</p>
 
   <p>When the context is initialized, the clipping region must be set
   to the rectangle with the top left corner at (0,0) and the width and
   height of the coordinate space.</p>
 
   <!-- v6
    Jordan OSETE suggests:
     * support ways of extending the clipping region (union instead of intersection)
        - also "add", "subtract", "replace", "intersect" and "xor"
@@ -43510,22 +43551,22 @@ v6DVT (also check for '- -' bits in the part above) -->
   -->
 
   <hr>
 
   <p>The <dfn
   title="dom-context-2d-isPointInPath"><code>isPointInPath(<var
   title="">x</var>, <var title="">y</var>)</code></dfn> method must
   return true if the point given by the <var title="">x</var> and <var
   title="">y</var> coordinates passed to the method, when treated as
   coordinates in the canvas coordinate space unaffected by the current
-  transformation, is inside the current default path as determined by
-  the non-zero winding number rule; and must return false otherwise.
+  transformation, is inside the intended path as determined by the
+  non-zero winding number rule; and must return false otherwise.
   Points on the path itself must be considered to be inside the path.
   If either of the arguments is infinite or NaN, then the method must
   return false.</p>
 
   </div>
 
 
   <div class="example" id="drawCustomFocusRingExample">
 
    <p>This <code>canvas</code> element has a couple of checkboxes. The

|