Skip to content

Commit

Permalink
Remove the extensions to the TextTrack interface
Browse files Browse the repository at this point in the history
https://www.w3.org/Bugs/Public/show_bug.cgi?id=24380

With a direct association between cues and regions, the text track
itself doesn't need to know about regions, simplifying the API.
  • Loading branch information
foolip committed Jan 29, 2014
1 parent 6db2325 commit 970b3a2
Showing 1 changed file with 1 addition and 96 deletions.
97 changes: 1 addition & 96 deletions webvtt.html
Expand Up @@ -5347,59 +5347,6 @@ <h3>VTTCue interface</h3>

</section>

<section>
<h3>Extension of the TextTrack interface for region support</h3>

<p>The following attribute and methods are introduced into the <a>TextTrack</a> object:</p>

<pre class="idl_whatwg">
partial interface <a>TextTrack</a> {
readonly attribute <a>VTTRegionList</a>? <a title="dom-TextTrack-regions">regions</a>;
void <a title="dom-TextTrack-addRegion">addRegion</a>(<a>VTTRegion</a> region);
void <a title="dom-TextTrack-removeRegion">removeRegion</a>(<a>VTTRegion</a> region);
};</pre>

<dl class="domintro">

<dt><var title="">textTrack</var> . <a title="dom-TextTrack-regions">regions</a></dt>
<dd>
<p>Returns the <a>text track list of regions</a>, as a <code>VTTRegionList</code> object.</p>
</dd>

<dt><var title="">textTrack</var> . <a title="dom-TextTrack-addRegion">addRegion</a>(region)</dt>
<dd>
<p>Adds the given region to <var>TextTrack</var>'s <a>text track list of regions</a>. If that list already contains a region with the same identifier, update that region's attributes with those of <var>region</var>.</p>
</dd>

<dt><var title="">textTrack</var> . <a title="dom-TextTrack-removeRegion">removeRegion</a>(region)</dt>
<dd>
<p>Removes the given region from <var>TextTrack</var>'s <a>text track list of regions</a>.</p>
</dd>

</dl>

<p>If the <a>text track mode</a> of the <a>text track</a> that the <var>TextTrack</var> object represents is not the <a>text track disabled</a> mode, then the <dfn title="dom-texttrack-regions">regions</dfn> attribute must return a live <a>VTTRegionList</a> object that represents the <a>text track list of regions</a> of the <a>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 title="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 <a>text track list of regions</a>, then remove <var>region</var> from that <a>text track list of regions</a>.</p></li>

<li><p>If the method's <a><code>TextTrack</code></a> object's <a>text track list of regions</a> contains a region with the same identifier as <var>region</var> replace the values of that region's <var>width</var>, <var>lines</var>, <var>anchor point</var>, <var>viewport anchor point</var> and <var>scroll</var> attributes with those of <var>region</var>.</p>

<p>Otherwise: add <var>region</var> to the method's <code>TextTrack</code> object's <a>text track list of regions</a>.</p></li>
</ol>

<p>The <dfn title="dom-TextTrack-removeRegion"><code>removeRegion(<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 not currently listed in the method's <code>TextTrack</code> object's <a>text track list of regions</a>, then throw a NotFoundError exception.</p></li>

<li><p>Otherwise: remove <var>region</var> from that <a>text track list of regions</a>.</p></li>
</ol>

</section><!-- TextTrack interface -->

<section>
<h3>VTTRegion interface</h3>

Expand All @@ -5422,7 +5369,7 @@ <h3>VTTRegion interface</h3>

<dt><var title="">region</var> = new <code title="dom-VTTRegion">VTTRegion</code>()</dt>
<dd>
<p>Returns a new <code>VTTRegion</code> object, for use with the <code title="dom-TextTrack-addRegion">addRegion()</code> method.</p>
<p>Returns a new <code>VTTRegion</code> object.</p>
</dd>

<dt><var title="">region</var> . <a title="dom-VTTRegion-width">width</a></dt>
Expand Down Expand Up @@ -5520,48 +5467,6 @@ <h3>VTTRegion interface</h3>

</section><!-- end VTTRegion object -->

<section>
<h3>VTTRegionList interface</h3>

<pre class="idl_whatwg">
interface <dfn>VTTRegionList</dfn> {
readonly attribute unsigned long <a title="dom-VTTRegionList-length">length</a>;
getter <a title="dom-VTTRegion">VTTRegion</a> (unsigned long index);
<a>VTTRegion</a>? <a title="dom-VTTRegionList-getRegionById">getRegionById</a>(DOMString id);
};</pre>

<dl class="domintro">

<dt><var title="">regionList</var> . <a title="dom-VTTRegionList-length">length</a></dt>
<dd>
<p>Returns the number of <var>regions</var> in the list.</p>
</dd>

<dt><var title="">regionList</var>[index]</dt>
<dd>
<p>Returns the <a>text track region</a> with index <var>index</var> in the list. The regions are sorted in the order in which they were inserted.</p>
</dd>

<dt><var title="">regionList</var> . <a title="dom-VTTRegionList-getRegionById">getRegionById</a>( id )</dt>
<dd>
<p>Returns the first <a>text track region</a> with <a>text track region identifier</a> <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>

<p>A <code>VTTRegionList</code> object represents a dynamically updating list of <a title="text track region">text track regions</a> in a given order.</p>

<p>The <dfn title="dom-VTTRegionList-length"><code>length</code></dfn> attribute must return the number of <a title="text track region">regions</a> in the list represented by the <code>VTTRegionList</code> object.</p>

<p>The <a>supported property indices</a> of a <code>VTTRegionList</code> object at any instant are the numbers from zero to the number of <a title="text track region">regions</a> in the list represented by the <code>VTTRegionList</code> object minus one, if any. If there are no <a title="text track region">regions</a> in the list, there are no <a>supported property indices</a>.</p>

<p>To <a>determine the value of an indexed property</a> for a given index <var>index</var>, the user agent must return the <var>index</var> of the <a>text track region</a> in the list represented by the <code>VTTRegionList</code> object.</p>

<p>The <dfn title="dom-VTTRegionList-getRegionById"><code>getRegionById(<var>id</var>)</code></dfn> method, when called with an argument other than the empty string, must return the first <a>text track region</a> in the list represented by the <code>VTTRegionList</code> object whose <a>text track region identifier</a> 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><!-- end VTTRegionList object -->

</section><!-- WebVTT API for browsers -->

<section>
Expand Down

0 comments on commit 970b3a2

Please sign in to comment.