Navigation Menu

Skip to content

Commit

Permalink
[giow] (3) Define how to handle neutered ImageData objects
Browse files Browse the repository at this point in the history
Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=25672
Affected topics: Canvas

git-svn-id: http://svn.whatwg.org/webapps@8629 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed May 13, 2014
1 parent 0ecc916 commit 10ef1e1
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 9 deletions.
20 changes: 17 additions & 3 deletions complete.html
Expand Up @@ -59476,7 +59476,7 @@ <h6 id=pixel-manipulation><span class=secno>4.12.4.2.16 </span><dfn>Pixel manipu
<p>Returns an <code><a href=#imagedata>ImageData</a></code> object with the given dimensions. All the pixels in the
returned object are transparent black.</p>

<p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the either of the width or height
<p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if either of the width or height
arguments are zero.</p>

</dd>
Expand Down Expand Up @@ -59549,6 +59549,9 @@ <h6 id=pixel-manipulation><span class=secno>4.12.4.2.16 </span><dfn>Pixel manipu

<p>Throws a <code><a href=#notsupportederror>NotSupportedError</a></code> exception if any of the arguments are not finite.</p>

<p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <var title="">imagedata</var>
object's data has been <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>.</p>

</dd>

</dl><div class=impl>
Expand Down Expand Up @@ -59659,6 +59662,11 @@ <h6 id=pixel-manipulation><span class=secno>4.12.4.2.16 </span><dfn>Pixel manipu

<ol><li>

<p>If the <var title="">imagedata</var> argument's <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute has been <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>, throw an <code><a href=#invalidstateerror>InvalidStateError</a></code>
exception and abort these steps.</p>

<li>

<p>If <var title="">dirtyWidth</var> is negative, let <var title="">dirtyX</var> be <span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span>, and let <var title="">dirtyWidth</var> be equal to the absolute magnitude of <var title="">dirtyWidth</var>.</p>

<p>If <var title="">dirtyHeight</var> is negative, let <var title="">dirtyY</var> be <span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span>, and let <var title="">dirtyHeight</var> be equal to the absolute magnitude of <var title="">dirtyHeight</var>.</p>
Expand Down Expand Up @@ -59691,9 +59699,10 @@ <h6 id=pixel-manipulation><span class=secno>4.12.4.2.16 </span><dfn>Pixel manipu

</li>

<!--CLEANUP-->
<li><p>For all integer values of <var title="">x</var> and <var title="">y</var> where <span title=""><var title="">dirtyX</var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span></span> and <span title=""><var title="">dirtyY</var>&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span></span>, copy the
four channels of the pixel with coordinate (<var title="">x</var>, <var title="">y</var>) in
the <var title="">imagedata</var> data structure to the pixel with coordinate (<span title=""><var title="">dx</var>+<var title="">x</var></span>, <span title=""><var title="">dy</var>+<var title="">y</var></span>) in the rendering context's <a href=#scratch-bitmap>scratch
the <var title="">imagedata</var> data structure's <a href=#canvas-pixel-arraybuffer>Canvas Pixel <code>ArrayBuffer</code></a> to the pixel with coordinate (<span title=""><var title="">dx</var>+<var title="">x</var></span>, <span title=""><var title="">dy</var>+<var title="">y</var></span>) in the rendering context's <a href=#scratch-bitmap>scratch
bitmap</a>.</li>

</ol><p>The handling of pixel rounding when the specified coordinates are not integers is not defined
Expand Down Expand Up @@ -76178,10 +76187,11 @@ <h3 id=images><span class=secno>7.7 </span>Images</h3>
any pixels missing in the original replaced by transparent black. These coordinates are in the
source image's pixel coordinate space, <em>not</em> in CSS pixels.</p>

<!--CLEANUP-->
<p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the source image is not in a valid
state (e.g. an <code><a href=#the-img-element>img</a></code> element that hasn't finished loading, or a
<code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object whose bitmap data has zero length along one or both
dimensions). Throws a <code><a href=#securityerror>SecurityError</a></code> exception if the script is not allowed to
dimensions, or an <code><a href=#imagedata>ImageData</a></code> object whose data is <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute has been <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>). Throws a <code><a href=#securityerror>SecurityError</a></code> exception if the script is not allowed to
access the image data of the source image (e.g. a <code><a href=#the-video-element>video</a></code> that is
<a href=#cors-cross-origin>CORS-cross-origin</a>, or a <code><a href=#the-canvas-element>canvas</a></code> being drawn on by a script in a worker
from another <a href=#origin>origin</a>).</p>
Expand Down Expand Up @@ -76369,6 +76379,10 @@ <h3 id=images><span class=secno>7.7 </span>Images</h3>
<ol><li><p>If either the <var title="">sw</var> or <var title="">sh</var> arguments are specified
but zero, throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li>

<li><p>If the <var title="">image</var> object's <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code>
attribute has been <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>, throw an
<code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

<li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>

<li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be the image data given by the
Expand Down
20 changes: 17 additions & 3 deletions index
Expand Up @@ -59476,7 +59476,7 @@ partial dictionary <a href=#mouseeventinit>MouseEventInit</a> {
<p>Returns an <code><a href=#imagedata>ImageData</a></code> object with the given dimensions. All the pixels in the
returned object are transparent black.</p>

<p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if the either of the width or height
<p>Throws an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception if either of the width or height
arguments are zero.</p>

</dd>
Expand Down Expand Up @@ -59549,6 +59549,9 @@ partial dictionary <a href=#mouseeventinit>MouseEventInit</a> {

<p>Throws a <code><a href=#notsupportederror>NotSupportedError</a></code> exception if any of the arguments are not finite.</p>

<p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <var title="">imagedata</var>
object's data has been <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>.</p>

</dd>

</dl><div class=impl>
Expand Down Expand Up @@ -59659,6 +59662,11 @@ partial dictionary <a href=#mouseeventinit>MouseEventInit</a> {

<ol><li>

<p>If the <var title="">imagedata</var> argument's <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute has been <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>, throw an <code><a href=#invalidstateerror>InvalidStateError</a></code>
exception and abort these steps.</p>

<li>

<p>If <var title="">dirtyWidth</var> is negative, let <var title="">dirtyX</var> be <span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span>, and let <var title="">dirtyWidth</var> be equal to the absolute magnitude of <var title="">dirtyWidth</var>.</p>

<p>If <var title="">dirtyHeight</var> is negative, let <var title="">dirtyY</var> be <span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span>, and let <var title="">dirtyHeight</var> be equal to the absolute magnitude of <var title="">dirtyHeight</var>.</p>
Expand Down Expand Up @@ -59691,9 +59699,10 @@ partial dictionary <a href=#mouseeventinit>MouseEventInit</a> {

</li>

<!--CLEANUP-->
<li><p>For all integer values of <var title="">x</var> and <var title="">y</var> where <span title=""><var title="">dirtyX</var>&nbsp;&le;&nbsp;<var title="">x</var>&nbsp;&lt;&nbsp;<span title=""><var title="">dirtyX</var>+<var title="">dirtyWidth</var></span></span> and <span title=""><var title="">dirtyY</var>&nbsp;&le;&nbsp;<var title="">y</var>&nbsp;&lt;&nbsp;<span title=""><var title="">dirtyY</var>+<var title="">dirtyHeight</var></span></span>, copy the
four channels of the pixel with coordinate (<var title="">x</var>, <var title="">y</var>) in
the <var title="">imagedata</var> data structure to the pixel with coordinate (<span title=""><var title="">dx</var>+<var title="">x</var></span>, <span title=""><var title="">dy</var>+<var title="">y</var></span>) in the rendering context's <a href=#scratch-bitmap>scratch
the <var title="">imagedata</var> data structure's <a href=#canvas-pixel-arraybuffer>Canvas Pixel <code>ArrayBuffer</code></a> to the pixel with coordinate (<span title=""><var title="">dx</var>+<var title="">x</var></span>, <span title=""><var title="">dy</var>+<var title="">y</var></span>) in the rendering context's <a href=#scratch-bitmap>scratch
bitmap</a>.</li>

</ol><p>The handling of pixel rounding when the specified coordinates are not integers is not defined
Expand Down Expand Up @@ -76178,10 +76187,11 @@ interface <dfn id=imagebitmapfactories>ImageBitmapFactories</dfn> {
any pixels missing in the original replaced by transparent black. These coordinates are in the
source image's pixel coordinate space, <em>not</em> in CSS pixels.</p>

<!--CLEANUP-->
<p>Throws an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception if the source image is not in a valid
state (e.g. an <code><a href=#the-img-element>img</a></code> element that hasn't finished loading, or a
<code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object whose bitmap data has zero length along one or both
dimensions). Throws a <code><a href=#securityerror>SecurityError</a></code> exception if the script is not allowed to
dimensions, or an <code><a href=#imagedata>ImageData</a></code> object whose data is <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute has been <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>). Throws a <code><a href=#securityerror>SecurityError</a></code> exception if the script is not allowed to
access the image data of the source image (e.g. a <code><a href=#the-video-element>video</a></code> that is
<a href=#cors-cross-origin>CORS-cross-origin</a>, or a <code><a href=#the-canvas-element>canvas</a></code> being drawn on by a script in a worker
from another <a href=#origin>origin</a>).</p>
Expand Down Expand Up @@ -76369,6 +76379,10 @@ interface <dfn id=imagebitmapfactories>ImageBitmapFactories</dfn> {
<ol><li><p>If either the <var title="">sw</var> or <var title="">sh</var> arguments are specified
but zero, throw an <code><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</li>

<li><p>If the <var title="">image</var> object's <code title=dom-imagedata-data><a href=#dom-imagedata-data>data</a></code>
attribute has been <a href=#concept-transferable-neutered title=concept-Transferable-neutered>neutered</a>, throw an
<code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</li>

<li><p>Create a new <code><a href=#imagebitmap>ImageBitmap</a></code> object.</li>

<li><p>Let the <code><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be the image data given by the
Expand Down
24 changes: 21 additions & 3 deletions source
Expand Up @@ -65107,7 +65107,7 @@ partial dictionary <span>MouseEventInit</span> {
<p>Returns an <code>ImageData</code> object with the given dimensions. All the pixels in the
returned object are transparent black.</p>

<p>Throws an <code>IndexSizeError</code> exception if the either of the width or height
<p>Throws an <code>IndexSizeError</code> exception if either of the width or height
arguments are zero.</p>

</dd>
Expand Down Expand Up @@ -65181,6 +65181,9 @@ partial dictionary <span>MouseEventInit</span> {

<p>Throws a <code>NotSupportedError</code> exception if any of the arguments are not finite.</p>

<p>Throws an <code>InvalidStateError</code> exception if the <var data-x="">imagedata</var>
object's data has been <span data-x="concept-Transferable-neutered">neutered</span>.</p>

</dd>

</dl>
Expand Down Expand Up @@ -65311,6 +65314,13 @@ partial dictionary <span>MouseEventInit</span> {

<ol>

<li>

<p>If the <var data-x="">imagedata</var> argument's <code
data-x="dom-imagedata-data">data</code> attribute has been <span
data-x="concept-Transferable-neutered">neutered</span>, throw an <code>InvalidStateError</code>
exception and abort these steps.</p>

<li>

<p>If <var data-x="">dirtyWidth</var> is negative, let <var data-x="">dirtyX</var> be <span
Expand Down Expand Up @@ -65361,13 +65371,14 @@ partial dictionary <span>MouseEventInit</span> {

</li>

<!--CLEANUP-->
<li><p>For all integer values of <var data-x="">x</var> and <var data-x="">y</var> where <span
data-x=""><var data-x="">dirtyX</var>&nbsp;&le;&nbsp;<var data-x="">x</var>&nbsp;&lt;&nbsp;<span
data-x=""><var data-x="">dirtyX</var>+<var data-x="">dirtyWidth</var></span></span> and <span
data-x=""><var data-x="">dirtyY</var>&nbsp;&le;&nbsp;<var data-x="">y</var>&nbsp;&lt;&nbsp;<span
data-x=""><var data-x="">dirtyY</var>+<var data-x="">dirtyHeight</var></span></span>, copy the
four channels of the pixel with coordinate (<var data-x="">x</var>, <var data-x="">y</var>) in
the <var data-x="">imagedata</var> data structure to the pixel with coordinate (<span
the <var data-x="">imagedata</var> data structure's <span>Canvas Pixel <code>ArrayBuffer</code></span> to the pixel with coordinate (<span
data-x=""><var data-x="">dx</var>+<var data-x="">x</var></span>, <span data-x=""><var
data-x="">dy</var>+<var data-x="">y</var></span>) in the rendering context's <span>scratch
bitmap</span>.</p></li>
Expand Down Expand Up @@ -84060,10 +84071,13 @@ interface <dfn>ImageBitmapFactories</dfn> {
any pixels missing in the original replaced by transparent black. These coordinates are in the
source image's pixel coordinate space, <em>not</em> in CSS pixels.</p>

<!--CLEANUP-->
<p>Throws an <code>InvalidStateError</code> exception if the source image is not in a valid
state (e.g. an <code>img</code> element that hasn't finished loading, or a
<code>CanvasRenderingContext2D</code> object whose bitmap data has zero length along one or both
dimensions). Throws a <code>SecurityError</code> exception if the script is not allowed to
dimensions, or an <code>ImageData</code> object whose data is <code
data-x="dom-imagedata-data">data</code> attribute has been <span
data-x="concept-Transferable-neutered">neutered</span>). Throws a <code>SecurityError</code> exception if the script is not allowed to
access the image data of the source image (e.g. a <code>video</code> that is
<span>CORS-cross-origin</span>, or a <code>canvas</code> being drawn on by a script in a worker
from another <span>origin</span>).</p>
Expand Down Expand Up @@ -84285,6 +84299,10 @@ interface <dfn>ImageBitmapFactories</dfn> {
<li><p>If either the <var data-x="">sw</var> or <var data-x="">sh</var> arguments are specified
but zero, throw an <code>IndexSizeError</code> exception and abort these steps.</p></li>

<li><p>If the <var data-x="">image</var> object's <code data-x="dom-imagedata-data">data</code>
attribute has been <span data-x="concept-Transferable-neutered">neutered</span>, throw an
<code>InvalidStateError</code> exception and abort these steps.</p></li>

<li><p>Create a new <code>ImageBitmap</code> object.</p></li>

<li><p>Let the <code>ImageBitmap</code> object's bitmap data be the image data given by the
Expand Down

0 comments on commit 10ef1e1

Please sign in to comment.