[html5] r8427 - [e] (0) Be more explicit about the ImageData constructor Fixing https://www.w3.o [...]

whatwg at whatwg.org whatwg at whatwg.org
Tue Jan 28 10:49:56 PST 2014


Author: ianh
Date: 2014-01-28 10:49:55 -0800 (Tue, 28 Jan 2014)
New Revision: 8427

Modified:
   complete.html
   index
   source
Log:
[e] (0) Be more explicit about the ImageData constructor
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=24429
Affected topics: Canvas, HTML

Modified: complete.html
===================================================================
--- complete.html	2014-01-27 23:55:24 UTC (rev 8426)
+++ complete.html	2014-01-28 18:49:55 UTC (rev 8427)
@@ -298,7 +298,7 @@
 
   <header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 27 January 2014</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 28 January 2014</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -58522,8 +58522,13 @@
 
     <p>Returns an <code><a href=#imagedata>ImageData</a></code> object using the data provided in the <code><a href=#uint8clampedarray>Uint8ClampedArray</a></code> argument, interpreted using the given dimensions.</p>
 
-    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given data and dimensions can't be interpreted consistently.</p>
+    <p>As each pixel in the data is represented by four numbers, the length of the data needs to be
+    a multiple of four times the given width. If the height is provided as well, then the length
+    needs to be exactly the width times the height times 4.</p>
 
+    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given data and dimensions can't be
+    interpreted consistently, or if either dimension is zero.</p>
+
    </dd>
 
    <dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData</a></code>(<var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</dt>
@@ -58594,10 +58599,17 @@
 
    <li><p>Let <var title="">length</var> be <var title="">length</var> divided by four.</p>
 
-   <li><p>If <var title="">length</var> is not an integral multiple of <var title="">sw</var>,
-   throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li> <!-- nothing
-   non-zero is an integral multiple of 0, so this will throw for sw=0 -->
+   <li>
 
+    <p>If <var title="">length</var> is not an integral multiple of <var title="">sw</var>,
+    throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</p>
+
+    <p class=note>At this step, the length is guaranteed to be greater than zero (otherwise the
+    second step above would have aborted the steps), so if <var title="">sw</var> is zero, this
+    step will throw the exception and abort these steps.</p>
+
+   </li>
+
    <li><p>Let <var title="">height</var> be <var title="">length</var> divided by <var title="">sw</var>.</li>
 
    <li><p>If the <var title="">sh</var> argument was not omitted, and its value is not equal to
@@ -102751,6 +102763,7 @@
   Martin Nilsson,
   Martin Thomson,
   Masataka Yakura,
+  Masatoshi Kimura,
   Mathias Bynens,
   Mathieu Henri,
   Matias Larsson,

Modified: index
===================================================================
--- index	2014-01-27 23:55:24 UTC (rev 8426)
+++ index	2014-01-28 18:49:55 UTC (rev 8427)
@@ -298,7 +298,7 @@
 
   <header class=head id=head><p><a href=http://www.whatwg.org/ class=logo><img width=101 src=/images/logo alt=WHATWG height=101></a></p>
    <hgroup><h1 class=allcaps>HTML</h1>
-    <h2 class="no-num no-toc">Living Standard — Last Updated 27 January 2014</h2>
+    <h2 class="no-num no-toc">Living Standard — Last Updated 28 January 2014</h2>
    </hgroup><dl><dt><strong>Web developer edition:</strong></dt>
     <dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
     <dt>Multiple-page version:</dt>
@@ -58522,8 +58522,13 @@
 
     <p>Returns an <code><a href=#imagedata>ImageData</a></code> object using the data provided in the <code><a href=#uint8clampedarray>Uint8ClampedArray</a></code> argument, interpreted using the given dimensions.</p>
 
-    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given data and dimensions can't be interpreted consistently.</p>
+    <p>As each pixel in the data is represented by four numbers, the length of the data needs to be
+    a multiple of four times the given width. If the height is provided as well, then the length
+    needs to be exactly the width times the height times 4.</p>
 
+    <p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given data and dimensions can't be
+    interpreted consistently, or if either dimension is zero.</p>
+
    </dd>
 
    <dt><var title="">imagedata</var> = <var title="">context</var> . <code title=dom-context-2d-getImageData><a href=#dom-context-2d-getimagedata>getImageData</a></code>(<var title="">sx</var>, <var title="">sy</var>, <var title="">sw</var>, <var title="">sh</var>)</dt>
@@ -58594,10 +58599,17 @@
 
    <li><p>Let <var title="">length</var> be <var title="">length</var> divided by four.</p>
 
-   <li><p>If <var title="">length</var> is not an integral multiple of <var title="">sw</var>,
-   throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li> <!-- nothing
-   non-zero is an integral multiple of 0, so this will throw for sw=0 -->
+   <li>
 
+    <p>If <var title="">length</var> is not an integral multiple of <var title="">sw</var>,
+    throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</p>
+
+    <p class=note>At this step, the length is guaranteed to be greater than zero (otherwise the
+    second step above would have aborted the steps), so if <var title="">sw</var> is zero, this
+    step will throw the exception and abort these steps.</p>
+
+   </li>
+
    <li><p>Let <var title="">height</var> be <var title="">length</var> divided by <var title="">sw</var>.</li>
 
    <li><p>If the <var title="">sh</var> argument was not omitted, and its value is not equal to
@@ -102751,6 +102763,7 @@
   Martin Nilsson,
   Martin Thomson,
   Masataka Yakura,
+  Masatoshi Kimura,
   Mathias Bynens,
   Mathieu Henri,
   Matias Larsson,

Modified: source
===================================================================
--- source	2014-01-27 23:55:24 UTC (rev 8426)
+++ source	2014-01-28 18:49:55 UTC (rev 8427)
@@ -65158,8 +65158,13 @@
 
     <p>Returns an <code>ImageData</code> object using the data provided in the <code>Uint8ClampedArray</code> argument, interpreted using the given dimensions.</p>
 
-    <p>Throws an <code>IndexSizeError</code> exception if the given data and dimensions can't be interpreted consistently.</p>
+    <p>As each pixel in the data is represented by four numbers, the length of the data needs to be
+    a multiple of four times the given width. If the height is provided as well, then the length
+    needs to be exactly the width times the height times 4.</p>
 
+    <p>Throws an <code>IndexSizeError</code> exception if the given data and dimensions can't be
+    interpreted consistently, or if either dimension is zero.</p>
+
    </dd>
 
    <dt><var data-x="">imagedata</var> = <var data-x="">context</var> . <code data-x="dom-context-2d-getImageData">getImageData</code>(<var data-x="">sx</var>, <var data-x="">sy</var>, <var data-x="">sw</var>, <var data-x="">sh</var>)</dt>
@@ -65240,10 +65245,17 @@
 
    <li><p>Let <var data-x="">length</var> be <var data-x="">length</var> divided by four.</p>
 
-   <li><p>If <var data-x="">length</var> is not an integral multiple of <var data-x="">sw</var>,
-   throw an <code>IndexSizeError</code> exception and abort these steps.</p></li> <!-- nothing
-   non-zero is an integral multiple of 0, so this will throw for sw=0 -->
+   <li>
 
+    <p>If <var data-x="">length</var> is not an integral multiple of <var data-x="">sw</var>,
+    throw an <code>IndexSizeError</code> exception and abort these steps.</p>
+
+    <p class="note">At this step, the length is guaranteed to be greater than zero (otherwise the
+    second step above would have aborted the steps), so if <var data-x="">sw</var> is zero, this
+    step will throw the exception and abort these steps.</p>
+
+   </li>
+
    <li><p>Let <var data-x="">height</var> be <var data-x="">length</var> divided by <var
    data-x="">sw</var>.</p></li>
 
@@ -114746,6 +114758,7 @@
   Martin Nilsson,
   Martin Thomson,
   Masataka Yakura,
+  Masatoshi Kimura,
   Mathias Bynens,
   Mathieu Henri,
   Matias Larsson,




More information about the Commit-Watchers mailing list