html5/2dcontext Overview.html,1.113,1.114

Update of /sources/public/html5/2dcontext
In directory hutz:/tmp/cvs-serv8158

Modified Files:
	Overview.html 
Log Message:
Make sure canvas.toBlob() honours the origin-clean flag. Also, make it more likely this will be implemented correctly by explicitly putting the security checks in the relevant algorithms. (whatwg r6879)

Index: Overview.html
===================================================================
RCS file: /sources/public/html5/2dcontext/Overview.html,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -d -r1.113 -r1.114
--- Overview.html	9 Dec 2011 18:39:15 -0000	1.113
+++ Overview.html	6 Jan 2012 20:46:54 -0000	1.114
@@ -320,12 +320,13 @@
 
    <h1>HTML Canvas 2D Context</h1>
    <h2 class="no-num no-toc" id="generatedID"></h2>
-   <h2 class="no-num no-toc" id="editor-s-draft-9-december-2011">Editor's Draft 9 December 2011</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-6-january-2012">Editor's Draft 6 January 2012</h2>
    <dl><dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/2dcontext/">http://www.w3.org/TR/2dcontext/</a></dd>
     <dt>Latest Editor's Draft:</dt>
     <dd><a class="latest-link" href="http://dev.w3.org/html5/2dcontext/">http://dev.w3.org/html5/2dcontext/</a></dd>
 
+
     <dt>Previous Versions:</dt>
     <dd><a href="http://www.w3.org/TR/2011/WD-2dcontext-20110525/">http://www.w3.org/TR/2011/WD-2dcontext-20110525/</a></dd>
     <dd><a href="http://www.w3.org/TR/2011/WD-2dcontext-20110405/">http://www.w3.org/TR/2011/WD-2dcontext-20110405/</a></dd>
@@ -455,7 +456,7 @@
   Group</a> is the W3C working group responsible for this
   specification's progress along the W3C Recommendation
   track.
-  This specification is the 9 December 2011 Editor's Draft.
+  This specification is the 6 January 2012 Editor's Draft.
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><p>Work on this specification is also done at the <a href="http://www.whatwg.org/">WHATWG</a>. The W3C HTML working group
   actively pursues convergence with the WHATWG, as required by the <a href="http://www.w3.org/2007/03/HTML-WG-charter">W3C HTML working
   group charter</a>.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><p>This specification is an extension to the HTML5 language. All
@@ -469,6 +470,7 @@
   individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
   Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
   6 of the W3C Patent Policy</a>.<h2 class="no-num no-toc" id="contents">Table of Contents</h2>
+
 <ol class="toc">
  <li><a href="#conformance-requirements"><span class="secno">1 </span>Conformance requirements</a></li>
  <li><a href="#the-canvas-state"><span class="secno">2 </span>The canvas state</a></li>
@@ -509,15 +511,18 @@
   // state
   void <a href="#dom-context-2d-save" title="dom-context-2d-save">save</a>(); // push state on state stack
   void <a href="#dom-context-2d-restore" title="dom-context-2d-restore">restore</a>(); // pop state stack and restore state
+
   // transformations (default transform is the identity matrix)
   void <a href="#dom-context-2d-scale" title="dom-context-2d-scale">scale</a>(double x, double y);
   void <a href="#dom-context-2d-rotate" title="dom-context-2d-rotate">rotate</a>(double angle);
   void <a href="#dom-context-2d-translate" title="dom-context-2d-translate">translate</a>(double x, double y);
   void <a href="#dom-context-2d-transform" title="dom-context-2d-transform">transform</a>(double a, double b, double c, double d, double e, double f);
   void <a href="#dom-context-2d-settransform" title="dom-context-2d-setTransform">setTransform</a>(double a, double b, double c, double d, double e, double f);
+
   // compositing
            attribute double <a href="#dom-context-2d-globalalpha" title="dom-context-2d-globalAlpha">globalAlpha</a>; // (default 1.0)
            attribute DOMString <a href="#dom-context-2d-globalcompositeoperation" title="dom-context-2d-globalCompositeOperation">globalCompositeOperation</a>; // (default source-over)
+
   // colors and styles
            attribute any <a href="#dom-context-2d-strokestyle" title="dom-context-2d-strokeStyle">strokeStyle</a>; // (default black)
            attribute any <a href="#dom-context-2d-fillstyle" title="dom-context-2d-fillStyle">fillStyle</a>; // (default black)
@@ -567,7 +572,8 @@
            attribute DOMString <a href="#dom-context-2d-textalign" title="dom-context-2d-textAlign">textAlign</a>; // "start", "end", "left", "right", "center" (default: "start")
            attribute DOMString <a href="#dom-context-2d-textbaseline" title="dom-context-2d-textBaseline">textBaseline</a>; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
   void <a href="#dom-context-2d-filltext" title="dom-context-2d-fillText">fillText</a>(DOMString text, double x, double y, optional double maxWidth);
-  void <a href="#dom-context-2d-stroketext" title="dom-context-2d-strokeText">strokeText</a>(DOMString text, double x, double y, optional double maxWidth);  <a href="#textmetrics">TextMetrics</a> <a href="#dom-context-2d-measuretext" title="dom-context-2d-measureText">measureText</a>(DOMString text);
+  void <a href="#dom-context-2d-stroketext" title="dom-context-2d-strokeText">strokeText</a>(DOMString text, double x, double y, optional double maxWidth);
+  <a href="#textmetrics">TextMetrics</a> <a href="#dom-context-2d-measuretext" title="dom-context-2d-measureText">measureText</a>(DOMString text);
 
   // drawing images
   void <a href="#dom-context-2d-drawimage" title="dom-context-2d-drawImage">drawImage</a>(<span>HTMLImageElement</span> image, double dx, double dy);
@@ -624,6 +630,7 @@
   NaN value must be ignored.</p>
 
   
+
   <p>Whenever the CSS value <code title="">currentColor</code> is used
   as a color in this API, the "computed value of the 'color' property"
   for the purposes of determining the computed value of the <code title="">currentColor</code> keyword is the computed value of the
@@ -684,6 +691,7 @@
   must do nothing.</p>
 
   
+
   </div><h2 id="transformations"><span class="secno">3 </span><dfn title="dom-context-2d-transformation">Transformations</dfn></h2><p>The transformation matrix is applied to coordinates when creating
   shapes and paths.</p><div class="impl">
 
@@ -810,6 +818,7 @@
   attributes, <code title="dom-context-2d-globalAlpha"><a href="#dom-context-2d-globalalpha">globalAlpha</a></code> and <code title="dom-context-2d-globalCompositeOperation"><a href="#dom-context-2d-globalcompositeoperation">globalCompositeOperation</a></code>.</p>
 
   
+
   <p>The <dfn id="dom-context-2d-globalalpha" title="dom-context-2d-globalAlpha"><code>globalAlpha</code></dfn>
   attribute gives an alpha value that is applied to shapes and images
   before they are composited onto the canvas. The value must be in the
@@ -878,6 +887,7 @@
 
 
 
+
    <dt><dfn id="gcop-lighter" title="gcop-lighter"><code>lighter</code></dfn></dt>
 
    <dd><var title="">A</var> plus <var title="">B</var>. <span class="note">Display the
@@ -957,6 +967,7 @@
   </dl><div class="impl">
 
   
+
   <p>The <dfn id="dom-context-2d-strokestyle" title="dom-context-2d-strokeStyle"><code>strokeStyle</code></dfn>
   attribute represents the color or style to use for the lines around
   shapes, and the <dfn id="dom-context-2d-fillstyle" title="dom-context-2d-fillStyle"><code>fillStyle</code></dfn>
@@ -1009,11 +1020,13 @@
   fractional part of the alpha value, if any, with the level of
   precision necessary for the alpha value, when reparsed, to be
   interpreted as the same alpha value.</p> 
+
   <p>When the context is created, the <code title="dom-context-2d-strokeStyle"><a href="#dom-context-2d-strokestyle">strokeStyle</a></code> and <code title="dom-context-2d-fillStyle"><a href="#dom-context-2d-fillstyle">fillStyle</a></code> attributes must
   initially have the string value <code title="">#000000</code>.</p>
 
   <p>When the value is a color, it must not be affected by the
   transformation matrix when used to draw on the canvas.</p> 
+
   </div><hr><p>There are two types of gradients, linear gradients and radial
   gradients, both represented by objects implementing the opaque
   <code><a href="#canvasgradient">CanvasGradient</a></code> interface.<p id="interpolation">Once a gradient has been created (see below),
@@ -1194,11 +1207,13 @@
   <p>The <var title="">image</var> argument is an instance of either
   <code>HTMLImageElement</code>, <code>HTMLCanvasElement</code>, or
   <code>HTMLVideoElement</code>.</p> 
+
   <p>If the <var title="">image</var> argument is an
   <code>HTMLImageElement</code> object that is not <span title="img-good">fully decodable</span>, or 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 return null.</p> 
+
   <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
@@ -1250,6 +1265,7 @@
   
 
   
+
   </div><div class="impl">
 
   <hr><p>If a radial gradient or repeated pattern is used when the
@@ -1407,6 +1423,7 @@
   initially have the value <code>10.0</code>.</p>
 
   
+
   </div><h2 id="shadows"><span class="secno">7 </span><dfn>Shadows</dfn></h2><p>All drawing operations are affected by the four global shadow
   attributes.<dl class="domintro"><dt><var title="">context</var> . <code title="dom-context-2d-shadowColor"><a href="#dom-context-2d-shadowcolor">shadowColor</a></code> [ = <var title="">value</var> ]</dt>
 
@@ -1905,6 +1922,7 @@
 
   
 
+
   <p>The <dfn id="dom-context-2d-fill" title="dom-context-2d-fill"><code>fill()</code></dfn>
   method must fill all the subpaths of the current path, using
   <code title="dom-context-2d-fillStyle"><a href="#dom-context-2d-fillstyle">fillStyle</a></code>, and using
@@ -2048,6 +2066,7 @@
   height of the coordinate space.</p>
 
   
+
   <hr><p>The <dfn id="dom-context-2d-ispointinpath" 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
@@ -2133,6 +2152,7 @@
  redraw();
 &lt;/script&gt;</pre>
 
+
   </div><h2 id="text"><span class="secno">10 </span>Text</h2><dl class="domintro"><dt><var title="">context</var> . <code title="dom-context-2d-font"><a href="#dom-context-2d-font">font</a></code> [ = <var title="">value</var> ]</dt>
 
    <dd>
@@ -2327,6 +2347,7 @@
    'white-space' property set to 'pre'. <a href="#refsCSS">[CSS]</a></li>
 
    
+
    <li><p>If the <var title="">maxWidth</var> argument was specified
    and the hypothetical width of the inline box in the hypothetical
    line box is greater than <var title="">maxWidth</var> CSS pixels,
@@ -2448,9 +2469,20 @@
   of the inline element set to 'pre' and the 'font' property of the
   inline element set to the current font of the context as given by
   the <code title="dom-context-2d-font"><a href="#dom-context-2d-font">font</a></code> attribute, and
-  must then return a new <code><a href="#textmetrics">TextMetrics</a></code> object with its
+  must then create a new <code><a href="#textmetrics">TextMetrics</a></code> object with its
   <code title="dom-textmetrics-width"><a href="#dom-textmetrics-width">width</a></code> attribute set to
-  the width of that inline box, in CSS pixels. <a href="#refsCSS">[CSS]</a></p>
+  the width of that inline box, in CSS pixels.
+
+  If doing these measurements requires using a font that has an
+  <span>origin</span> that is not the <span title="same
+  origin">same</span> as that of the <code>Document</code> object that
+  owns the <code>canvas</code> element (even if "using a font" means
+  just checking if that font has a particular glyph in it before
+  falling back to another font), then the method must throw a
+  <code>SecurityError</code> exception.
+
+  Otherwise, it must return the new <code><a href="#textmetrics">TextMetrics</a></code> object.
+  <a href="#refsCSS">[CSS]</a></p>
 
   <p>The <code><a href="#textmetrics">TextMetrics</a></code> interface is used for the objects
   returned from <code title="dom-context-2d-measureText"><a href="#dom-context-2d-measuretext">measureText()</a></code>. It has one
@@ -2521,11 +2553,13 @@
   <p>The <var title="">image</var> argument is an instance of either
   <code>HTMLImageElement</code>, <code>HTMLCanvasElement</code>, or
   <code>HTMLVideoElement</code>.</p> 
+
   <p>If the <var title="">image</var> argument is an
   <code>HTMLImageElement</code> object that is not <span title="img-good">fully decodable</span>, or 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 return without drawing anything.</p> 
+
   <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
@@ -2570,7 +2604,8 @@
   filtering algorithm requires a pixel value from outside the original
   image data, it must instead use the value from the nearest edge
   pixel. (That is, the filter uses 'clamp-to-edge' behavior.)</p>
-    
+  
+  
 
   <p>When the <code title="dom-context-2d-drawImage"><a href="#dom-context-2d-drawimage">drawImage()</a></code> method
   is passed an animated image as its <var title="">image</var>
@@ -2678,14 +2713,18 @@
   with transparent black.</p>
 
   <p>The <dfn id="dom-context-2d-getimagedata" title="dom-context-2d-getImageData"><code>getImageData(<var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>,
-  <var title="">sh</var>)</code></dfn> method must return an
-  <code><a href="#imagedata">ImageData</a></code> object representing the underlying pixel data
-  for the area of the canvas denoted by the rectangle whose corners are
-  the four points (<var title="">sx</var>, <var title="">sy</var>),
-  (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), in canvas
-  coordinate space units. Pixels outside the canvas must be returned
-  as transparent black. Pixels must be returned as non-premultiplied
-  alpha values.</p>
+  <var title="">sh</var>)</code></dfn> method must,
+
+  if the <code>canvas</code> element's <i>origin-clean</i> flag is set
+  to false, throw a <code>SecurityError</code> exception; otherwise, it
+
+  must return an <code><a href="#imagedata">ImageData</a></code> object representing the
+  underlying pixel data for the area of the canvas denoted by the
+  rectangle whose corners are the four points (<var title="">sx</var>,
+  <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <var title="">sy</var>), (<span title=""><var title="">sx</var>+<var title="">sw</var></span>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>),
+  (<var title="">sx</var>, <span title=""><var title="">sy</var>+<var title="">sh</var></span>), in canvas coordinate space units. Pixels
+  outside the canvas must be returned as transparent black. Pixels
+  must be returned as non-premultiplied alpha values.</p>
 
   <p>If any of the arguments to <code title="dom-context-2d-createImageData"><a href="#dom-context-2d-createimagedata">createImageData()</a></code> or
   <code title="dom-context-2d-getImageData"><a href="#dom-context-2d-getimagedata">getImageData()</a></code>
@@ -3046,7 +3085,8 @@
    Hickson, H. Lie. W3C.</dd>
 
    <dt id="refsCSSCOLOR">[CSSCOLOR]</dt>
-      <dd><cite><a href="http://dev.w3.org/csswg/css3-color/">CSS Color
+   
+   <dd><cite><a href="http://dev.w3.org/csswg/css3-color/">CSS Color
    Module Level 3</a></cite>, T. &Ccedil;elik, C. Lilley, L.
    Baron. W3C.</dd>
 
@@ -3079,7 +3119,8 @@
    <dd><cite><a href="http://www.khronos.org/registry/typedarray/specs/latest/">Typed Array Specification</a></cite>, D. Herman, K. Russell. Khronos.</dd>
 
    <dt id="refsWEBIDL">[WEBIDL]</dt>
-      <dd><cite><a href="http://dev.w3.org/2006/webapi/WebIDL/">Web
+   
+   <dd><cite><a href="http://dev.w3.org/2006/webapi/WebIDL/">Web
    IDL</a></cite>, C. McCormack. W3C.</dd>
 
   </dl><h2 class="no-num" id="acknowledgements">Acknowledgements</h2><p>For a full list of acknowledgements, please see the HTML5

Received on Friday, 6 January 2012 20:46:59 UTC