HTML5 Tracker

Diff (omit for latest revision)
Filter

Short URL: http://html5.org/r/7179

SVNBugCommentTime (UTC)
7179[Gecko] [Internet Explorer] [Opera] [Webkit] Add removeHitRegion() to canvas, since Microsoft want it.2012-07-17 20:48
Index: source
===================================================================
--- source	(revision 7178)
+++ source	(revision 7179)
@@ -41767,6 +41767,7 @@
 
   // 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);
@@ -46126,6 +46127,22 @@
 
    </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">
@@ -46176,7 +46193,7 @@
    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
@@ -46244,7 +46261,7 @@
   <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
@@ -46265,13 +46282,28 @@
   <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
@@ -46605,6 +46637,30 @@
 
   </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>

|