Skip to content

Commit

Permalink
[giow] (0) Add removeHitRegion() to canvas, since Microsoft want it.
Browse files Browse the repository at this point in the history
Affected topics: Canvas

git-svn-id: http://svn.whatwg.org/webapps@7179 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 17, 2012
1 parent d83d2f2 commit 0cfa743
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 9 deletions.
50 changes: 47 additions & 3 deletions complete.html
Original file line number Diff line number Diff line change
Expand Up @@ -35845,6 +35845,7 @@ <h5 id=2dcontext><span class=secno>4.8.11.1 </span>The 2D context</h5>

// hit regions
void <a href=#dom-context-2d-addhitregion title=dom-context-2d-addHitRegion>addHitRegion</a>(<a href=#hitregionoptions>HitRegionOptions</a> options);
void <a href=#dom-context-2d-removehitregion title=dom-context-2d-removeHitRegion>removeHitRegion</a>(<a href=#hitregionoptions>HitRegionOptions</a> options);

// pixel manipulation
<a href=#imagedata>ImageData</a> <a href=#dom-context-2d-createimagedata title=dom-context-2d-createImageData>createImageData</a>(double sw, double sh);
Expand Down Expand Up @@ -39529,6 +39530,21 @@ <h6 id=hit-regions><span class=secno>4.8.11.1.14 </span>Hit regions</h6>

</ul></dd>

<dt><var title="">context</var> . <code title=dom-context-2d-removeHitRegion><a href=#dom-context-2d-removehitregion>removeHitRegion</a></code>(<var title="">options</var>)</dt>

<dd>

<p>Removes a hit region (and all its ancestors) from the canvas
bitmap. The argument is the ID of a region added using <code title=dom-context-2d-addHitRegion><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>.</p>

<p>The pixels that were covered by this region and its descendants
are effectively cleared by this operation, leaving the regions
non-interactive. In particular, regions that occupied the same
pixels before the removed regions were added, overlapping them, do
not resume their previous role.</p>

</dd>

</dl><div class=impl>

<p>A <a href=#hit-region>hit region</a> <var title="">A</var> is an
Expand Down Expand Up @@ -39564,7 +39580,7 @@ <h6 id=hit-regions><span class=secno>4.8.11.1.14 </span>Hit regions</h6>
steps.</li>

<li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region
list</a> associatd with <var title="">ancestor</var>'s
list</a> associated with <var title="">ancestor</var>'s
bitmap.</li>

<li><p>If there is a <a href=#hit-region>hit region</a> in <var title="">list</var> whose <a href="#hit-region's-control" title="hit region's
Expand Down Expand Up @@ -39610,7 +39626,7 @@ <h6 id=hit-regions><span class=secno>4.8.11.1.14 </span>Hit regions</h6>
<a href=#hit-region>hit region</a> or nothing):</p>

<ol><li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region
list</a> associatd with <var title="">ancestor</var>'s
list</a> associated with <var title="">ancestor</var>'s
bitmap.</li>

<li><p>If there is a <a href=#hit-region>hit region</a> in <var title="">list</var> whose <a href="#hit-region's-set-of-pixels" title="hit region's set of
Expand All @@ -39624,13 +39640,23 @@ <h6 id=hit-regions><span class=secno>4.8.11.1.14 </span>Hit regions</h6>
steps:</p>

<ol><li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region
list</a> associatd with <var title="">ancestor</var>'s
list</a> associated with <var title="">ancestor</var>'s
bitmap.</li>

<li><p>Remove all pixels in <var title="">pixels</var> from the
<a href="#hit-region's-set-of-pixels" title="hit region's set of pixels">set of pixels</a> of
each <a href=#hit-region>hit region</a> in <var title="">list</var>.</li>

<li><p><a href=#garbage-collect-the-regions>Garbage-collect the regions</a> of <var title="">ancestor</var>.</li>

</ol><p>To <dfn id=garbage-collect-the-regions>garbage-collect the regions</dfn> of a
<code><a href=#the-canvas-element>canvas</a></code> element <var title="">ancestor</var>, the user
agent must run the following steps:</p>

<ol><li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region
list</a> associated with <var title="">ancestor</var>'s
bitmap.</li>

<li><p><i>Loop</i>: Let <var title="">victim</var> be the first
<a href=#hit-region>hit region</a> in <var title="">list</var> to have an
empty <a href="#hit-region's-set-of-pixels" title="hit region's set of pixels">set of
Expand Down Expand Up @@ -39898,6 +39924,24 @@ <h6 id=hit-regions><span class=secno>4.8.11.1.14 </span>Hit regions</h6>
<li><p>Add <var title="">region</var> to the <code><a href=#the-canvas-element>canvas</a></code>
element's <a href=#hit-region-list>hit region list</a>.</li>

</ol><p>When the <dfn id=dom-context-2d-removehitregion title=dom-context-2d-removeHitRegion><code>removeHitRegion()</code></dfn>
method is invoked, the user agent must run the following steps:</p>

<ol><li><p>Let <var title="">region</var> be <a href=#the-region-identified-by-the-id>the region
identified by the ID</a> given by the method's argument in this
<code><a href=#the-canvas-element>canvas</a></code> element, if any. If no such region currently
exists, abort these steps.</li>

<li><p>Remove <var title="">region</var>, and all <a href=#hit-region title="hit
region">hit regions</a> for which it is an <a href=#ancestor-region>ancestor
region</a>, from the <code><a href=#the-canvas-element>canvas</a></code> element's <a href=#hit-region-list>hit
region list</a>; then, if it had a <a href="#hit-region's-parent" title="hit region's
parent">parent</a> region, decrement that <a href="#hit-region's-child-count">hit region's
child count</a> by one.</li> <!-- we garbage collect the
regions below -->

<li><p><a href=#garbage-collect-the-regions>Garbage-collect the regions</a> of <var title="">ancestor</var>.</li>

</ol></div>

<hr><p>The <code><a href=#mouseevent>MouseEvent</a></code> interface is extended to support hit
Expand Down
50 changes: 47 additions & 3 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -35845,6 +35845,7 @@ dictionary <dfn id=trackeventinit>TrackEventInit</dfn> : <a href=#eventinit>Even

// hit regions
void <a href=#dom-context-2d-addhitregion title=dom-context-2d-addHitRegion>addHitRegion</a>(<a href=#hitregionoptions>HitRegionOptions</a> options);
void <a href=#dom-context-2d-removehitregion title=dom-context-2d-removeHitRegion>removeHitRegion</a>(<a href=#hitregionoptions>HitRegionOptions</a> options);

// pixel manipulation
<a href=#imagedata>ImageData</a> <a href=#dom-context-2d-createimagedata title=dom-context-2d-createImageData>createImageData</a>(double sw, double sh);
Expand Down Expand Up @@ -39529,6 +39530,21 @@ v6DVT (also check for '- -' bits in the part above) --><p>The <dfn id=dom-contex

</ul></dd>

<dt><var title="">context</var> . <code title=dom-context-2d-removeHitRegion><a href=#dom-context-2d-removehitregion>removeHitRegion</a></code>(<var title="">options</var>)</dt>

<dd>

<p>Removes a hit region (and all its ancestors) from the canvas
bitmap. The argument is the ID of a region added using <code title=dom-context-2d-addHitRegion><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>.</p>

<p>The pixels that were covered by this region and its descendants
are effectively cleared by this operation, leaving the regions
non-interactive. In particular, regions that occupied the same
pixels before the removed regions were added, overlapping them, do
not resume their previous role.</p>

</dd>

</dl><div class=impl>

<p>A <a href=#hit-region>hit region</a> <var title="">A</var> is an
Expand Down Expand Up @@ -39564,7 +39580,7 @@ v6DVT (also check for '- -' bits in the part above) --><p>The <dfn id=dom-contex
steps.</li>

<li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region
list</a> associatd with <var title="">ancestor</var>'s
list</a> associated with <var title="">ancestor</var>'s
bitmap.</li>

<li><p>If there is a <a href=#hit-region>hit region</a> in <var title="">list</var> whose <a href="#hit-region's-control" title="hit region's
Expand Down Expand Up @@ -39610,7 +39626,7 @@ v6DVT (also check for '- -' bits in the part above) --><p>The <dfn id=dom-contex
<a href=#hit-region>hit region</a> or nothing):</p>

<ol><li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region
list</a> associatd with <var title="">ancestor</var>'s
list</a> associated with <var title="">ancestor</var>'s
bitmap.</li>

<li><p>If there is a <a href=#hit-region>hit region</a> in <var title="">list</var> whose <a href="#hit-region's-set-of-pixels" title="hit region's set of
Expand All @@ -39624,13 +39640,23 @@ v6DVT (also check for '- -' bits in the part above) --><p>The <dfn id=dom-contex
steps:</p>

<ol><li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region
list</a> associatd with <var title="">ancestor</var>'s
list</a> associated with <var title="">ancestor</var>'s
bitmap.</li>

<li><p>Remove all pixels in <var title="">pixels</var> from the
<a href="#hit-region's-set-of-pixels" title="hit region's set of pixels">set of pixels</a> of
each <a href=#hit-region>hit region</a> in <var title="">list</var>.</li>

<li><p><a href=#garbage-collect-the-regions>Garbage-collect the regions</a> of <var title="">ancestor</var>.</li>

</ol><p>To <dfn id=garbage-collect-the-regions>garbage-collect the regions</dfn> of a
<code><a href=#the-canvas-element>canvas</a></code> element <var title="">ancestor</var>, the user
agent must run the following steps:</p>

<ol><li><p>Let <var title="">list</var> be the <a href=#hit-region-list>hit region
list</a> associated with <var title="">ancestor</var>'s
bitmap.</li>

<li><p><i>Loop</i>: Let <var title="">victim</var> be the first
<a href=#hit-region>hit region</a> in <var title="">list</var> to have an
empty <a href="#hit-region's-set-of-pixels" title="hit region's set of pixels">set of
Expand Down Expand Up @@ -39898,6 +39924,24 @@ v6DVT (also check for '- -' bits in the part above) --><p>The <dfn id=dom-contex
<li><p>Add <var title="">region</var> to the <code><a href=#the-canvas-element>canvas</a></code>
element's <a href=#hit-region-list>hit region list</a>.</li>

</ol><p>When the <dfn id=dom-context-2d-removehitregion title=dom-context-2d-removeHitRegion><code>removeHitRegion()</code></dfn>
method is invoked, the user agent must run the following steps:</p>

<ol><li><p>Let <var title="">region</var> be <a href=#the-region-identified-by-the-id>the region
identified by the ID</a> given by the method's argument in this
<code><a href=#the-canvas-element>canvas</a></code> element, if any. If no such region currently
exists, abort these steps.</li>

<li><p>Remove <var title="">region</var>, and all <a href=#hit-region title="hit
region">hit regions</a> for which it is an <a href=#ancestor-region>ancestor
region</a>, from the <code><a href=#the-canvas-element>canvas</a></code> element's <a href=#hit-region-list>hit
region list</a>; then, if it had a <a href="#hit-region's-parent" title="hit region's
parent">parent</a> region, decrement that <a href="#hit-region's-child-count">hit region's
child count</a> by one.</li> <!-- we garbage collect the
regions below -->

<li><p><a href=#garbage-collect-the-regions>Garbage-collect the regions</a> of <var title="">ancestor</var>.</li>

</ol></div>

<hr><p>The <code><a href=#mouseevent>MouseEvent</a></code> interface is extended to support hit
Expand Down
62 changes: 59 additions & 3 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -41767,6 +41767,7 @@ dictionary <dfn>TrackEventInit</dfn> : <span>EventInit</span> {

// hit regions
void <span title="dom-context-2d-addHitRegion">addHitRegion</span>(<span>HitRegionOptions</span> options);
void <span title="dom-context-2d-removeHitRegion">removeHitRegion</span>(<span>HitRegionOptions</span> options);

// pixel manipulation
<span>ImageData</span> <span title="dom-context-2d-createImageData">createImageData</span>(double sw, double sh);
Expand Down Expand Up @@ -46126,6 +46127,22 @@ v6DVT (also check for '- -' bits in the part above) -->

</dd>

<dt><var title="">context</var> . <code title="dom-context-2d-removeHitRegion">removeHitRegion</code>(<var title="">options</var>)</dt>

<dd>

<p>Removes a hit region (and all its ancestors) from the canvas
bitmap. The argument is the ID of a region added using <code
title="dom-context-2d-addHitRegion">addHitRegion()</code>.</p>

<p>The pixels that were covered by this region and its descendants
are effectively cleared by this operation, leaving the regions
non-interactive. In particular, regions that occupied the same
pixels before the removed regions were added, overlapping them, do
not resume their previous role.</p>

</dd>

</dl>

<div class="impl">
Expand Down Expand Up @@ -46176,7 +46193,7 @@ v6DVT (also check for '- -' bits in the part above) -->
steps.</p></li>

<li><p>Let <var title="">list</var> be the <span>hit region
list</span> associatd with <var title="">ancestor</var>'s
list</span> associated with <var title="">ancestor</var>'s
bitmap.</p></li>

<li><p>If there is a <span>hit region</span> in <var
Expand Down Expand Up @@ -46244,7 +46261,7 @@ v6DVT (also check for '- -' bits in the part above) -->
<ol>

<li><p>Let <var title="">list</var> be the <span>hit region
list</span> associatd with <var title="">ancestor</var>'s
list</span> associated with <var title="">ancestor</var>'s
bitmap.</p></li>

<li><p>If there is a <span>hit region</span> in <var
Expand All @@ -46265,13 +46282,28 @@ v6DVT (also check for '- -' bits in the part above) -->
<ol>

<li><p>Let <var title="">list</var> be the <span>hit region
list</span> associatd with <var title="">ancestor</var>'s
list</span> associated with <var title="">ancestor</var>'s
bitmap.</p></li>

<li><p>Remove all pixels in <var title="">pixels</var> from the
<span title="hit region's set of pixels">set of pixels</span> of
each <span>hit region</span> in <var title="">list</var>.</p></li>

<li><p><span>Garbage-collect the regions</span> of <var
title="">ancestor</var>.</p></li>

</ol>

<p>To <dfn>garbage-collect the regions</dfn> of a
<code>canvas</code> element <var title="">ancestor</var>, the user
agent must run the following steps:</p>

<ol>

<li><p>Let <var title="">list</var> be the <span>hit region
list</span> associated with <var title="">ancestor</var>'s
bitmap.</p></li>

<li><p><i>Loop</i>: Let <var title="">victim</var> be the first
<span>hit region</span> in <var title="">list</var> to have an
empty <span title="hit region's set of pixels">set of
Expand Down Expand Up @@ -46605,6 +46637,30 @@ v6DVT (also check for '- -' bits in the part above) -->

</ol>

<p>When the <dfn
title="dom-context-2d-removeHitRegion"><code>removeHitRegion()</code></dfn>
method is invoked, the user agent must run the following steps:</p>

<ol>

<li><p>Let <var title="">region</var> be <span>the region
identified by the ID</span> given by the method's argument in this
<code>canvas</code> element, if any. If no such region currently
exists, abort these steps.</p></li>

<li><p>Remove <var title="">region</var>, and all <span title="hit
region">hit regions</span> for which it is an <span>ancestor
region</span>, from the <code>canvas</code> element's <span>hit
region list</span>; then, if it had a <span title="hit region's
parent">parent</span> region, decrement that <span>hit region's
child count</span> by one.</p></li> <!-- we garbage collect the
regions below -->

<li><p><span>Garbage-collect the regions</span> of <var
title="">ancestor</var>.</p></li>

</ol>

</div>

<hr>
Expand Down

0 comments on commit 0cfa743

Please sign in to comment.