HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2845[Gecko] [Opera] [Webkit] Define that <canvas>'s drawImage() can take a <video>.2009-02-20 01:10
@@ -19027,24 +19027,25 @@ href="?audio">audio&lt;/a> test instead.)&lt;/p></pre>
   idea of what the video is like.</p>
 
   <p>The <dfn title="dom-video-poster"><code>poster</code></dfn> DOM
   attribute must <span>reflect</span> the <code
   title="attr-video-poster">poster</code> content attribute.</p>
 
   <hr>
 
   <p>When no video data is available (the element's <code
   title="dom-media-readyState">readyState</code> attribute is either
-  <code title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code> or <code
-  title="dom-media-HAVE_METADATA">HAVE_METADATA</code>), the
-  <code>video</code> element <span>represents</span> either the
-  <span>poster frame</span>, or nothing.</p>
+  <code title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code>, or <code
+  title="dom-media-HAVE_METADATA">HAVE_METADATA</code> but no video
+  data has yet been obtained at all), the <code>video</code> element
+  <span>represents</span> either the <span>poster frame</span>, or
+  nothing.</p>
 
   <p>When a <code>video</code> element is <span
   title="dom-media-paused">paused</span> and the <span title="current
   playback position">current playback position</span> is the first
   frame of video, the element <span>represents</span> either the frame
   of video corresponding to the <span title="current playback
   position">current playback position</span> or the <span>poster
   frame</span>, at the discretion of the user agent.</p>
 
   <p>Notwithstanding the above, the <span>poster frame</span> should
@@ -21949,25 +21950,27 @@ interface <dfn>CueRangeCallback</dfn> {
   // text
            attribute DOMString <span title="dom-context-2d-font">font</span>; // (default 10px sans-serif)
            attribute DOMString <span title="dom-context-2d-textAlign">textAlign</span>; // "start", "end", "left", "right", "center" (default: "start")
            attribute DOMString <span title="dom-context-2d-textBaseline">textBaseline</span>; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
   void <span title="dom-context-2d-fillText">fillText</span>(in DOMString text, in float x, in float y, [Optional] in float maxWidth);
   void <span title="dom-context-2d-strokeText">strokeText</span>(in DOMString text, in float x, in float y, [Optional] in float maxWidth);<!-- v4DVT
   void <span title="dom-context-2d-fillVerticalText">fillVerticalText</span>(in DOMString text, in float x, in float y, [Optional] in float maxHeight);
   void <span title="dom-context-2d-strokeVerticalText">strokeVerticalText</span>(in DOMString text, in float x, in float y, [Optional] in float maxHeight); -->
   <span>TextMetrics</span> <span title="dom-context-2d-measureText">measureText</span>(in DOMString text);
 
-  // drawing images<!-- XXX add and define HTMLVideoElement variants -->
+  // drawing images
   void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLImageElement</span> image, in float dx, in float dy, [Optional] in float dw, in float dh);
   void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLImageElement</span> image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
   void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLCanvasElement</span> image, in float dx, in float dy, [Optional] in float dw, in float dh);
   void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLCanvasElement</span> image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
+  void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLVideoElement</span> image, in float dx, in float dy, [Optional] in float dw, in float dh);
+  void <span title="dom-context-2d-drawImage">drawImage</span>(in <span>HTMLVideoElement</span> image, in float sx, in float sy, in float sw, in float sh, in float dx, in float dy, in float dw, in float dh);
 
   // pixel manipulation
   <span>ImageData</span> <span title="dom-context-2d-createImageData">createImageData</span>(in float sw, in float sh);
   <span>ImageData</span> <span title="dom-context-2d-getImageData">getImageData</span>(in float sx, in float sy, in float sw, in float sh);
   void <span title="dom-context-2d-putImageData">putImageData</span>(in <span>ImageData</span> imagedata, in float dx, in float dy, [Optional] in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight);
 };
 
 interface <dfn>CanvasGradient</dfn> {
   // opaque object
   void <span title="dom-canvasgradient-addColorStop">addColorStop</span>(in float offset, in DOMString color);
@@ -23689,65 +23692,74 @@ v4DVT (also check for '- -' bits in the part above) -->
   to the canvas. This would be provided in preference to a dedicated
   way of doing multiline layout.</p>
 
 
   <h6>Images</h6>
 
   <p>To draw images onto the canvas, the <dfn
   title="dom-context-2d-drawImage"><code>drawImage</code></dfn> method
   can be used.</p>
 
-  <p>This method is overloaded with three variants: <code
-  title="">drawImage(<var title="">image</var>, <var
-  title="">dx</var>, <var title="">dy</var>)</code>, <code
-  title="">drawImage(<var title="">image</var>, <var
-  title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>,
-  <var title="">dh</var>)</code>, and <code title="">drawImage(<var
-  title="">image</var>, <var title="">sx</var>, <var
-  title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>,
-  <var title="">dx</var>, <var title="">dy</var>, <var
-  title="">dw</var>, <var title="">dh</var>)</code>. (Actually it is
-  overloaded with six; each of those three can take either an
-  <code>HTMLImageElement</code> or an <code>HTMLCanvasElement</code>
-  for the <var title="">image</var> argument.)  If not specified, the
-  <var title="">dw</var> and <var title="">dh</var> arguments must
-  default to the values of <var title="">sw</var> and <var
-  title="">sh</var>, interpreted such that one CSS pixel in the image
-  is treated as one unit in the canvas coordinate space. If the <var
-  title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>,
-  and <var title="">sh</var> arguments are omitted, they must default
-  to 0, 0, the image's intrinsic width in image pixels, and the
-  image's intrinsic height in image pixels, respectively.</p>
+  <p>This method can be invoked with three different sets of argments:</p>
+
+  <ul class="brief">
+   <li><code title="">drawImage(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>)</code>
+   <li><code title="">drawImage(<var title="">image</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</code>
+   <li><code title="">drawImage(<var title="">image</var>, <var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>, <var title="">dx</var>, <var title="">dy</var>, <var title="">dw</var>, <var title="">dh</var>)</code>
+  </ul>
+
+  <p>Each of those three can take either an
+  <code>HTMLImageElement</code>, an <code>HTMLCanvasElement</code>, or
+  an <code>HTMLVideoElement</code> for the <var title="">image</var>
+  argument.</p>
+
+  <p>If not specified, the <var title="">dw</var> and <var
+  title="">dh</var> arguments must default to the values of <var
+  title="">sw</var> and <var title="">sh</var>, interpreted such that
+  one CSS pixel in the image is treated as one unit in the canvas
+  coordinate space. If the <var title="">sx</var>, <var
+  title="">sy</var>, <var title="">sw</var>, and <var
+  title="">sh</var> arguments are omitted, they must default to 0, 0,
+  the image's intrinsic width in image pixels, and the image's
+  intrinsic height in image pixels, respectively.</p>
 
   <p>The <var title="">image</var> argument must be an instance of an
-  <code>HTMLImageElement</code> or <code>HTMLCanvasElement</code>. If
-  the <var title="">image</var> is of the wrong type or null, the
-  implementation must raise a <code>TYPE_MISMATCH_ERR</code>
-  exception.</p>
+  <code>HTMLImageElement</code>, <code>HTMLCanvasElement</code>, or
+  <code>HTMLVideoElement</code>. If the <var title="">image</var> is
+  of the wrong type or null, the implementation must raise a
+  <code>TYPE_MISMATCH_ERR</code> exception.</p>
   <!-- createPattern() has an equivalent paragraph -->
 
   <p>If the <var title="">image</var> argument is an
   <code>HTMLImageElement</code> object whose <code
   title="dom-img-complete">complete</code> attribute is false, then
   the implementation must raise an <code>INVALID_STATE_ERR</code>
   exception.</p>
   <!-- createPattern() has an equivalent paragraph -->
 
-  <!-- handled by the next paragraph
+  <!-- handled by a later paragraph
   <p>If the <var title="">image</var> argument is an
   <code>HTMLCanvasElement</code> object with either a horizontal
   dimension or a vertical dimension equal to zero, then the
-  implementation must raise an <code>INVALID_STATE_ERR</code>
+  implementation must raise an <code>INVALID_SIZE_ERR</code>
   exception.</p>
   -->
   <!-- createPattern() has an equivalent paragraph -->
 
+  <p>If the <var title="">image</var> argument is an
+  <code>HTMLVideoElement</code> object whose <code
+  title="dom-media-readyState">readyState</code> attribute is either
+  <code title="dom-media-HAVE_NOTHING">HAVE_NOTHING</code> or <code
+  title="dom-media-HAVE_METADATA">HAVE_METADATA</code>, then the
+  implementation must raise an <code>INVALID_STATE_ERR</code>
+  exception.</p>
+
   <p>The source rectangle is the rectangle whose corners are the four
   points (<var title="">sx</var>, <var title="">sy</var>), (<span><var
   title="">sx</var>+<var title="">sw</var></span>, <var
   title="">sy</var>), (<span><var title="">sx</var>+<var
   title="">sw</var></span>, <span><var title="">sy</var>+<var
   title="">sh</var></span>), (<var title="">sx</var>, <span><var
   title="">sy</var>+<var title="">sh</var></span>).</p>
 
   <p>If the source rectangle is not entirely within the source image,
   or if one of the <var title="">sw</var> or <var title="">sh</var>
@@ -23773,25 +23785,30 @@ v4DVT (also check for '- -' bits in the part above) -->
   since the image is just repeating what was stated in the previous
   paragraph. -->
 
   <p class="note">When a canvas is drawn onto itself, the drawing
   model requires the source to be copied before the image is drawn
   back onto the canvas, so it is possible to copy parts of a canvas
   onto overlapping parts of itself.</p>
 
   <p>When the <code
   title="dom-context-2d-drawImage">drawImage()</code> method is
-  passed, as its <var title="">image</var> argument, an animated
-  image, the poster frame of the animation, or the first frame of the
-  animation if there is no poster frame, must be used.</p>
+  passed, as its <var title="">image</var> argument, an
+  <code>HTMLImageElement</code> representing an animated image, the
+  poster frame of the animation, or the first frame of the animation
+  if there is no poster frame, must be used.</p>
   <!-- createPattern() has an equivalent paragraph -->
 
+  <p>When the <var title="">image</var> argument is an
+  <code>HTMLVideoElement</code>, then the frame at the <span>current
+  playback position</span> must be used as the source image.</p>
+
   <p>Images are painted without affecting the current path, and are
   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>.</p>
 
   <!-- XXX should somehow say that the image used is the actual image
   of the target element, not the rendered image (e.g. height/width
   attributes don't affect it -->

|