Added IDLs for TextTrackRegion and TextTrackRegionList and follow-on changes.
authorSilvia Pfeiffer
Mon, 11 Feb 2013 08:14:02 +1100
changeset 62 9bf82099e923
parent 61 096bf69dd1f1
child 63 d1542c7153ab
Added IDLs for TextTrackRegion and TextTrackRegionList and follow-on changes.
608toVTT/region.html
--- a/608toVTT/region.html	Sun Feb 10 16:56:33 2013 +1100
+++ b/608toVTT/region.html	Mon Feb 11 08:14:02 2013 +1100
@@ -8,10 +8,12 @@
       For the three scripts below, if your spec resides on dev.w3 you can check them
       out in the same tree and use relative links so that they'll work offline,
      -->
-    <!-- old but local:
+    <!-- old but local: -->
     <script src='../../2009/dap/ReSpec.js/js/respec.js' class='remove'></script>
     -->
+    <!--
     <script src='http://www.w3.org/Tools/respec/respec-w3c-common' class='remove' async></script>
+    -->
     <script class='remove'>
       var respecConfig = {
           // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
@@ -232,7 +234,7 @@
         <p>In addition to the existing attributes, each <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue" class="externalDFN"><dfn>text track cue</dfn></a> also consists of:</p>
 
         <dl>
-         <dt><dfn id="text-track-cue-region">A region reference</dfn></dt>
+         <dt><dfn id="text-track-cue-region-identifier">A region identifier</dfn></dt>
          <dd>
           <p>A string that references by identifier the region that a cue belongs to, if it is not null.</p>
          </dd>
@@ -625,7 +627,7 @@
         <p>Introduce an additional assignment step after step 28.</p>
 
         <ul>
-          <li>Let <var>cue</var>'s <a href="#text-track-cue-region" class="internalDFN">region reference</a> be the empty string.
+          <li>Let <var>cue</var>'s <a href="#text-track-cue-region-identifier" class="internalDFN">region identifier</a> be the empty string.
           </li>
         </ul>
       </section>
@@ -642,7 +644,7 @@
 
           <dd>
             <ol>
-              <li>Let <var>cue</var>'s <a href="#text-track-cue-region-identifier" class="internalDFN">region reference</a> be <var>value</var>.</li>
+              <li>Let <var>cue</var>'s <a href="#text-track-cue-region-identifier" class="internalDFN">region identifier</a> be <var>value</var>.</li>
             </ol>
           </dd>
         </dl>
@@ -651,10 +653,10 @@
 
         <ol start="5">
           <li>If <var>cue</var>'s <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-line-position" class="externalDFN">line position</a> is not <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-automatic-line-position" class="externalDFN">auto</a> or <var>cue</var>'s <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-size" class="externalDFN">size</a> is not 100 or <var>cue</var>'s <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-writing-direction"
-          class="externalDFN">writing direction</a> is not <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-horizontal-writing-direction" class="externalDFN">horizontal</a>, but <var>cue</var>'s <a href="#text-track-cue-region" class="internalDFN">region reference</a> is not the empty string, let <var>cue</var>'s <a href="#text-track-cue-region" class="internalDFN">region reference</a> be the empty string.</li>
+          class="externalDFN">writing direction</a> is not <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-horizontal-writing-direction" class="externalDFN">horizontal</a>, but <var>cue</var>'s <a href="#text-track-cue-region-identifier" class="internalDFN">region identifier</a> is not the empty string, let <var>cue</var>'s <a href="#text-track-cue-region-identifier" class="internalDFN">region identifier</a> be the empty string.</li>
         </ol>
 
-        <p class="note">This makes sure that no matter in which order the cue settings are provided, if the cue has a <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-line-position" class="externalDFN">line position</a> or a <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-size" class="externalDFN">size</a> setting or is <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-vertical-writing-direction" class="externalDFN">vertical</a>, the <a href="#text-track-cue-region" class="internalDFN">region reference</a> will be ignored.</p>
+        <p class="note">This makes sure that no matter in which order the cue settings are provided, if the cue has a <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-line-position" class="externalDFN">line position</a> or a <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-size" class="externalDFN">size</a> setting or is <a href="http://www.w3.org/TR/html5/single-page.html#text-track-cue-vertical-writing-direction" class="externalDFN">vertical</a>, the <a href="#text-track-cue-region-identifier" class="internalDFN">region identifier</a> will be ignored.</p>
       </section>
     </section>
 
@@ -662,7 +664,7 @@
     <section>
       <h3>WebVTT region object</h3>
 
-      <p>A <dfn id="webvtt-region-object">WebVTT region object</dfn> is a conceptual construct to represent a <a href="#webvtt-region" class="internalDFN">WebVTT region</a> that can be used as a root node for <a href="http://dev.w3.org/html5/webvtt/#list-of-webvtt-node-objects" class="externalDFN">lists of WebVTT node objects</a>.</p>
+      <p>A <dfn id="webvtt-region-object">WebVTT region object</dfn> is a conceptual construct to represent a <a href="#webvtt-region" class="internalDFN">WebVTT region</a> that is used as a root node for <a href="http://dev.w3.org/html5/webvtt/#list-of-webvtt-node-objects" class="externalDFN">lists of WebVTT node objects</a>.</p>
     </section>
 
 
@@ -681,7 +683,188 @@
       <p>The <a href="http://dev.w3.org/html5/webvtt/#rules-for-updating-the-display-of-webvtt-text-tracks" class="externalDFN">rules for updating the display of WebVTT text tracks</a> are defined in the WebVTT specification to render the text tracks of a HTML video element and result in a set of CSS boxes that covers the rendering area of the video element.</p>
 
       <p>These rules are extended with the following steps.</p>
+XXX
+    </section>
 
+
+    <section class="appendix">
+      <h2>Extension of the HTML TextTrack API</h2>
+
+      <p>The functionality of the "region" extension of WebVTT should also be available to JavaScript developers of Web applications. Therefore, the <a hef="http://www.w3.org/TR/html5/single-page.html#text-track-api" class="externalDFN">HTML TextTrack API</a> is also extended. In particular, the <a href="http://www.w3.org/TR/html5/single-page.html#texttrack" class="externalDFN">TextTrack</a> and the <a href="http://www.w3.org/TR/html5/single-page.html#texttrackcue" class="externalDFN">TextTrackCue</a>object are extended and <a href="#texttrackregion" class="internalDFN">TextTrackRegion</a> and <a href="#texttrackregionlist" class="internalDFN">TextTrackRegionList</a> objects are introduced.</p>
+
+      <section>
+        <h3>Extension of the TextTrack object</h3>
+
+        <p>The following attribute and method are introduced into the <a href="http://www.w3.org/TR/html5/single-page.html#texttrack" class="externalDFN">TextTrack</a> object:</p>
+          
+        <dl class="idl" title="interface TextTrack : EventTarget">
+          <dt>attribute TextTrackRegionList? regions</dt>
+          <dd>Returns the <a href="#text-track-list-of-regions" class="internalDFN">text track list of regions</a>, as a <code>TextTrackRegionList</code> object.</dd>
+
+          <dt>void addRegion(TextTrackRegion region)</dt>
+          <dd>Adds the given region to <var>TextTrack</var>'s <a href="#text-track-list-of-regions" class="internalDFN">text track list of regions</a>.</dd>
+        </dl>
+
+        <section>
+          <h3>Implementation</h3>
+          <p>If the <a href="http://www.w3.org/TR/html5/single-page.html#text-track-mode" class="externalDFN">text track mode</a> of the <a href="http://www.w3.org/TR/html5/single-page.html#text-track" class="externalDFN">text track</a> that the <var>TextTrack</var> object represents is not the <a href="http://www.w3.org/TR/html5/single-page.html#text-track-disabled" class="externalDFN">text track disabled</a> mode, then the <code>regions</code> attribute must return a live <var>TextTrackRegionList</var> object that represents the <a href="#text-track-list-of-regions" class="internalDFN">text track list of regions</a> of the <a href="http://www.w3.org/TR/html5/single-page.html#text-track" class="externalDFN">text track</a>. Otherwise, it must return null. When an object is returned, the same object must be returned each time.</p>
+
+          <p>The <dfn id="dom-TextTrack-addRegion"><code>addRegion(<var>region</var>)</code></dfn> method of <code>TextTrack</code> objects, when invoked, must run the following steps:</p>
+      
+          <ol>
+           <li><p>If the given <var>region</var> is in a <span>text track list of regions</span>, then remove <var>region</var> from that <span>text track list of regions</span>.</p></li>
+
+           <li><p>Add <var>region</var> to the method's <code>TextTrack</code> object's <span>text track</span>'s <span>text track list of regions</span>.</p></li>
+          </ol>
+        </section>
+      </section>
+
+      <section>
+        <h3>Extension of the TextTrackCue object</h3>
+
+        <p>The following attribute is introduced into the <a href="http://www.w3.org/TR/html5/single-page.html#texttrackcue" class="externalDFN">TextTrackCue</a> object:</p>
+          
+        <dl class="idl" title="interface TextTrackCue : EventTarget">
+          <dt>attribute DOMString regionId</dt>
+          <dd>Returns the <a href="#text-track-cue-region-identifier" class="internalDFN">text track cue region identifier</a>.</dd>
+        </dl>
+
+        <section>
+          <h3>Implementation</h3>
+
+          <p>Initialise <code>regionId</code> in the <var>TextTrackCue</var> constructor with the empty string.</p>
+
+          <p>The <code>regionId</code> attribute, on getting, must return the <a href="#text-track-cue-region-identifier" class="internalDFN">text track cue region identifier</a> of the text track cue that the <a href="http://www.w3.org/TR/html5/single-page.html#texttrackcue" class="externalDFN">TextTrackCue</a> object represents. On setting, the text track region identifier must be set to the new value.</p>
+        </section>
+      </section>
+
+      <section>
+        <h3>TextTrackRegion object</h3>
+
+        <dl class="idl" title="[Constructor] interface TextTrackRegion : EventTarget">
+          <dt>readonly attribute TextTrack? <span title="dom-TextTrackRegion-track">track</span></dt>
+          <dd>Returns the <var>TextTrack</var> object to which this text track region belongs, if any, or null otherwise.</dd>
+
+          <dt>attribute DOMString id</dt>
+          <dd>Returns the text track region identifier. Can be set.</dd>
+
+          <dt>attribute double width</dt>
+          <dd>Returns the text track region width as a percentage of the video width. Can be set.</dd>
+
+          <dt>attribute long height</dt>
+          <dd>Returns the text track region height as a number of lines. Can be set.</dd>
+
+          <dt>attribute double regionAnchorX</dt>
+          <dd>Returns the text track region anchor X offset as a percentage of the region width. Can be set.</dd>
+
+          <dt>attribute double regionAnchorY</dt>
+          <dd>Returns the text track region anchor Y offset as a percentage of the region height. Can be set.</dd>
+
+          <dt>attribute double viewportAnchorX</dt>
+          <dd>Returns the text track viewport anchor X offset as a percentage of the video width. Can be set.</dd>
+
+          <dt>attribute double viewportAnchorY</dt>
+          <dd>Returns the text track viewport anchor Y offset as a percentage of the video height. Can be set.</dd>
+
+          <dt>attribute DOMString scroll</dt>
+          <dd><p>Returns a string representing the text track region scroll as follows:</p>
+            <dl class="switch">
+             <dt>If it is unset.</dt>
+             <dd><p>The empty string.</p></dd>
+             <dt>If it is up</dt>
+             <dd><p>The string "<code>up</code>".</p></dd>
+            </dl>
+             <p>Can be set.</p></dd>
+        </dl>
+
+        <section>
+          <h3>Implementation</h3>
+
+          <p>The <dfn id="dom-TextTrackRegion"><code>TextTrackRegion()</code></dfn> constructor, when invoked, must run the following steps:</p>
+
+          <ol>
+            <li><p>Create a new <span>text track region</span>. Let <var>region</var> be that <span>text track region</span>.</p></li>
+
+            <!-- default settings -->
+            <li><p>Let <var>region</var>'s <span>text track region identifier</span> be the empty string.</p></li>
+
+            <li><p>Let <var>region</var>'s <span>text track region width</span> be 100.</p></li>
+
+            <li><p>Let <var>region</var>'s <span>text track region height</span> be 3.</p></li>
+
+            <li><p>Let <var>region</var>'s <span>text track region regionAnchorX</span> be 0.</p></li>
+
+            <li><p>Let <var>region</var>'s <span>text track region regionAnchorY</span> be 100.</p></li>
+
+            <li><p>Let <var>region</var>'s <span>text track region viewportAnchorX</span> be 0.</p></li>
+
+            <li><p>Let <var>region</var>'s <span>text track region viewportAnchorY</span> be 100.</p></li>
+
+            <li><p>Let <var>region</var>'s <span>text track region scroll</span> be the empty string.</p></li>
+
+            <li><p>Return the <code>TextTrackRegion</code> object representing region.</p></li>
+          </ol>
+
+          <p>The <dfn id="dom-TextTrackRegion-track"><code>track</code></dfn> attribute, on getting, must return the <code>TextTrack</code> object of the <span>text track</span> in whose list of regions the <span>text track region</span> that the <code>TextTrackRegion</code> object represents finds itself, if any; or null otherwise.</p>
+
+          <p>The <dfn id="dom-TextTrackRegion-width"><code>width</code></dfn> attribute, on getting, must return the <span>text track region width</span> of the <span>text track region</span> that the <code>TextTrackRegion</code> object represents, in percent of video width. On setting, the <span>text track region width</span> must be set to the new value, interpreted as a percentage.</p>
+
+          <p>The <dfn id="dom-TextTrackRegion-height"><code>height</code></dfn> attribute, on getting, must return the <span>text track region height</span> of the <span>text track region</span> that the <code>TextTrackRegion</code> object represents, as number of lines. On setting, the <span>text track region height</span> must be set to the new value, interpreted as a number of lines.</p>
+          
+          <p>The <dfn id="dom-TextTrackRegion-regionAnchorX"><code>regionAnchor X</code></dfn> attribute, on getting, must return the <span>text track region anchor X offset</span> of the <span>text track region</span> that the <code>TextTrackRegion</code> object represents, in percent of region width. On setting, the <span>text track regionAnchor X</span> distance must be set to the new value, interpreted as a percentage.</p>
+
+          <p>The <dfn id="dom-TextTrackRegion-regionAnchorY"><code>regionAnchor Y</code></dfn> attribute, on getting, must return the <span>text track region anchor Y offset</span> of the <span>text track region</span> that the <code>TextTrackRegion</code> object represents, in percent of region height. On setting, the <span>text track regionAnchor Y</span> distance must be set to the new value, interpreted as a percentage.</p>
+
+          <p>The <dfn id="dom-TextTrackRegion-viewportAnchorX"><code>viewportAnchor X</code></dfn> attribute, on getting, must return the <span>text track region viewport anchor X offset</span> of the <span>text track region</span> that the <code>TextTrackRegion</code> object represents, in percent of video width. On setting, the <span>text track viewportAnchor X</span> distance must be set to the new value, interpreted as a percentage.</p>
+
+          <p>The <dfn id="dom-TextTrackRegion-viewportAnchorY"><code>viewportAnchor Y</code></dfn> attribute, on getting, must return the <span>text track region viewport anchor Y offset</span> of the <span>text track region</span> that the <code>TextTrackRegion</code> object represents, in percent of video height. On setting, the <span>text track viewportAnchor Y</span> distance must be set to the new value, interpreted as a percentage.</p>
+
+          <p>The <dfn id="dom-TextTrackRegion-scroll"><code>scroll</code></dfn> attribute, on getting, must return the string from the second cell of the row in the table below whose first cell is the <span>text track region scroll setting</span> of the <span>text track region</span> that the <code>TextTrackRegion</code> object represents:</p>
+          <table>
+           <thead>
+            <tr> <th> <span>Text track region scroll setting</span>
+                 <th> <code id="dom-TextTrackRegion-scroll">scroll</code> value
+           <tbody>
+            <tr> <td> <a href="#text-track-region-scroll-none" class="interalDFN">None</a>
+                 <td> "<code></code>" (the empty string)
+            <tr> <td> <a href="#text-track-region-scroll-up" class="internalDFN">"Up</a>
+                 <td> "<code title="">up</code>"
+          </table>
+
+          <p>On setting, the <span>text track scroll</span> must be set to the value given on the first cell of the row in the table above whose second cell is a <span>case-sensitive</span> match for the new value, if any. If none of the values match, then the user agent must instead throw a <code>SyntaxError</code> exception.</p>
+        </section>
+      </section>
+
+      <section>
+        <h3>TextTrackRegionList object</h3>
+
+        <dl class="idl" title="interface TextTrackRegionList">
+          <dt>readonly attribute unsigned long <span id="dom-TextTrackRegionList-length">length</span></dt>
+          <dd>Returns the number of <var>regions</var> in the list.</dd>
+
+          <dt>getter TextTrackRegion (unsigned long index)</span></dt>
+          <dd>Returns the <span>text track region</span> with index <var>index</var> in the list. The regions are sorted in the order in which they were inserted.</dd>
+
+          <dt><span>TextTrackRegion</span>? <span id="dom-TextTrackRegionList-getRegionById">getRegionById</span>(DOMString id)</dt>
+          <dd>Returns the first <span>text track region</span> with <span>text track region identifier</span> <var>id</var>.</p>
+              <p>Returns null if none of the regions have the given identifier or if the argument is the empty string.</p></dd>
+        </dl>
+
+        <section>
+          <h3>Implementation</h3>
+
+          <p>A <code>TextTrackRegionList</code> object represents a dynamically updating list of <a href="#text-track-region">text track regions</a> in a given order.</p>
+
+          <p>The <dfn id="dom-TextTrackRegionList-length"><code>length</code></dfn> attribute must return the number of <a href="#text-track-region">regions</a> in the list represented by the <code>TextTrackRegionList</code> object.</p>
+
+          <p>The <span>supported property indices</span> of a <code>TextTrackRegionList</code> object at any instant are the numbers from zero to the number of <a href="#text-track-region" class="internalDFN">regions</a> in the list represented by the <code>TextTrackRegionList</code> object minus one, if any. If there are no <a href="#text-track-region" class="internalDFN">regions</a> in the list, there are no <span>supported property indices</span>.</p>
+
+          <p>To <span>determine the value of an indexed property</span> for a given index <var title="">index</var>, the user agent must return the <var title="">index</var> of the <span>text track region</span> in the list represented by the <code>TextTrackRegionList</code> object.</p>
+
+          <p>The <dfn id="dom-TextTrackRegionList-getRegionById"><code>getRegionById(<var>id</var>)</code></dfn> method, when called with an argument other than the empty string, must return the first <span>text track region</span> in the list represented by the <code>TextTrackRegionList</code> object whose <span>text track region identifier</span> is <var>id</var>, if any, or null otherwise. If the argument is the empty string, then the method must return null.</p>
+          <p>
+        </section>
+      </section>
     </section>
 
     <section class='appendix'>