Skip to content

Commit

Permalink
[giow] (1) Make text track cues more forgiving: drop the concept of c…
Browse files Browse the repository at this point in the history
…ues being 'associated' with something, and make .snapToLines and .line allow invalid values and just have those be ignored in the rendering.

Affected topics: Video Text Tracks

git-svn-id: http://svn.whatwg.org/webapps@7328 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 11, 2012
1 parent 538cca0 commit fb93d0c
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 163 deletions.
97 changes: 43 additions & 54 deletions complete.html
Expand Up @@ -33879,28 +33879,41 @@ <h6 id=text-track-model><span class=secno>4.8.10.12.1 </span>Text track model</h
the other active tracks.</p> the other active tracks.</p>


<p>A <a href=#text-track-cue>text track cue</a> has a <dfn id=text-track-cue-computed-line-position>text track cue <p>A <a href=#text-track-cue>text track cue</a> has a <dfn id=text-track-cue-computed-line-position>text track cue
computed line position</dfn> whose value is defined in terms of computed line position</dfn> whose value is that returned by the
the other aspects of the cue. If the <a href=#text-track-cue-line-position>text track cue line following algorithm, which is defined in terms of the other
position</a> is numeric, then that is the <a href=#text-track-cue-computed-line-position>text track cue aspects of the cue:</p>
computed line position</a>. Otherwise, the <a href=#text-track-cue-line-position>text track cue
line position</a> is the special value <a href=#text-track-cue-automatic-line-position title="text track <ol><li><p>If the <a href=#text-track-cue-line-position>text track cue line position</a> is
cue automatic line position">auto</a>; if the <a href=#text-track-cue-snap-to-lines-flag>text track numeric, the <a href=#text-track-cue-snap-to-lines-flag>text track cue snap-to-lines flag</a> of
cue snap-to-lines flag</a> of the <a href=#text-track-cue>text track cue</a> the <a href=#text-track-cue>text track cue</a> is not set, and the <a href=#text-track-cue-line-position>text
is not set, the <a href=#text-track-cue-computed-line-position>text track cue computed line position</a> track cue line position</a> is negative or greater than 100,
is the value 100; otherwise, it is the value returned by the then return 100 and abort these steps.</li>
following algorithm:</p>

<li><p>If the <a href=#text-track-cue-line-position>text track cue line position</a> is numeric,
<ol><li><p>Let <var title="">cue</var> be the <a href=#text-track-cue>text track return the value of the <a href=#text-track-cue-line-position>text track cue line position</a>
and abort these steps. (Either the <a href=#text-track-cue-snap-to-lines-flag>text track cue
snap-to-lines flag</a> is set, so any value, not just those in
the range 0..100, is valid, or the value is in the range 0..100
and is thus valid regardless of the value of that flag.)</li>

<li><p>If the <a href=#text-track-cue-snap-to-lines-flag>text track cue snap-to-lines flag</a> of
the <a href=#text-track-cue>text track cue</a> is not set, return the value 100
and abort these steps. (The <a href=#text-track-cue-line-position>text track cue line
position</a> is the special value <a href=#text-track-cue-automatic-line-position title="text track cue
automatic line position">auto</a>.)</li>

<li><p>Let <var title="">cue</var> be the <a href=#text-track-cue>text track
cue</a>.</li> cue</a>.</li>


<li><p>If <var title="">cue</var> is not associated with a <li><p>If <var title="">cue</var> is not in a <a href=#text-track-list-of-cues title="text
<a href=#text-track>text track</a>, or if that <a href=#text-track>text track</a> is track list of cues">list of cues</a> of a <a href=#text-track>text
not in the <a href=#list-of-text-tracks>list of text tracks</a> of a <a href=#media-element>media track</a>, or if that <a href=#text-track>text track</a> is not in the
element</a>, return &minus;1 and abort these steps.</li> <a href=#list-of-text-tracks>list of text tracks</a> of a <a href=#media-element>media element</a>,
return &minus;1 and abort these steps.</li>


<li><p>Let <var title="">track</var> be the <a href=#text-track>text <li><p>Let <var title="">track</var> be the <a href=#text-track>text
track</a> that the <var title="">cue</var> is associated track</a> whose <a href=#text-track-list-of-cues title="text track list of cues">list of
with.</li> cues</a> the <var title="">cue</var> is in.</li>


<li><p>Let <var title="">n</var> be the number of <a href=#text-track title="text track">text tracks</a> whose <a href=#text-track-mode>text track <li><p>Let <var title="">n</var> be the number of <a href=#text-track title="text track">text tracks</a> whose <a href=#text-track-mode>text track
mode</a> is <a href=#text-track-showing title="text track showing">showing</a> mode</a> is <a href=#text-track-showing title="text track showing">showing</a>
Expand Down Expand Up @@ -33950,10 +33963,7 @@ <h6 id=text-track-model><span class=secno>4.8.10.12.1 </span>Text track model</h
</dd> </dd>


</dl><p>Each <a href=#text-track-cue>text track cue</a> has a corresponding </dl><p>Each <a href=#text-track-cue>text track cue</a> has a corresponding
<code><a href=#texttrackcue>TextTrackCue</a></code> object, and can be associated with a <code><a href=#texttrackcue>TextTrackCue</a></code> object. A <a href=#text-track-cue>text track cue</a>'s
particular <a href=#text-track>text track</a>. Once a <a href=#text-track-cue>text track
cue</a> is associated with a particular <a href=#text-track>text track</a>,
the association is permanent. A <a href=#text-track-cue>text track cue</a>'s
in-memory representation can be dynamically changed through this in-memory representation can be dynamically changed through this
<code><a href=#texttrackcue>TextTrackCue</a></code> API.</p> <code><a href=#texttrackcue>TextTrackCue</a></code> API.</p>


Expand Down Expand Up @@ -34723,13 +34733,11 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>
<dt><var title="">textTrack</var> . <code title=dom-TextTrack-addCue><a href=#dom-texttrack-addcue>addCue</a></code>( <var title="">cue</var> )</dt> <dt><var title="">textTrack</var> . <code title=dom-TextTrack-addCue><a href=#dom-texttrack-addcue>addCue</a></code>( <var title="">cue</var> )</dt>
<dd> <dd>
<p>Adds the given cue to <var title="">textTrack</var>'s <a href=#text-track-list-of-cues>text track list of cues</a>.</p> <p>Adds the given cue to <var title="">textTrack</var>'s <a href=#text-track-list-of-cues>text track list of cues</a>.</p>
<p>Throws an exception if the argument is associated with another <a href=#text-track>text track</a> or already in the list of cues.</p>
</dd> </dd>


<dt><var title="">textTrack</var> . <code title=dom-TextTrack-removeCue><a href=#dom-texttrack-removecue>removeCue</a></code>( <var title="">cue</var> )</dt> <dt><var title="">textTrack</var> . <code title=dom-TextTrack-removeCue><a href=#dom-texttrack-removecue>removeCue</a></code>( <var title="">cue</var> )</dt>
<dd> <dd>
<p>Removes the given cue from <var title="">textTrack</var>'s <a href=#text-track-list-of-cues>text track list of cues</a>.</p> <p>Removes the given cue from <var title="">textTrack</var>'s <a href=#text-track-list-of-cues>text track list of cues</a>.</p>
<p>Throws an exception if the argument is associated with another <a href=#text-track>text track</a> or not in the list of cues.</p>
</dd> </dd>


</dl><div class=impl> </dl><div class=impl>
Expand Down Expand Up @@ -34912,20 +34920,9 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>
<hr><p>The <dfn id=dom-texttrack-addcue title=dom-TextTrack-addCue><code>addCue(<var title="">cue</var>)</code></dfn> method of <code><a href=#texttrack>TextTrack</a></code> <hr><p>The <dfn id=dom-texttrack-addcue title=dom-TextTrack-addCue><code>addCue(<var title="">cue</var>)</code></dfn> method of <code><a href=#texttrack>TextTrack</a></code>
objects, when invoked, must run the following steps:</p> objects, when invoked, must run the following steps:</p>


<ol><li><p>If the given <var title="">cue</var> is already associated <ol><li><p>If the given <var title="">cue</var> is in a <a href=#text-track-list-of-cues>text
with a <a href=#text-track>text track</a> other than the method's track list of cues</a>, then remove <var title="">cue</var> from
<code><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track>text track</a>, then throw that <a href=#text-track-list-of-cues>text track list of cues</a>.</li>
an <code><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
steps.</li>

<li><p>If the given <var title="">cue</var> is already listed in
the method's <code><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track>text
track</a>'s <a href=#text-track-list-of-cues>text track list of cues</a>, then throw an
<code><a href=#invalidstateerror>InvalidStateError</a></code> exception.</li>

<li><p>Associate <var title="">cue</var> with the method's
<code><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track>text track</a>, if it is
not currently associated with a <a href=#text-track>text track</a>.</li>


<li><p>Add <var title="">cue</var> to the method's <li><p>Add <var title="">cue</var> to the method's
<code><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track>text track</a>'s <code><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track>text track</a>'s
Expand All @@ -34935,12 +34932,7 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>
<code><a href=#texttrack>TextTrack</a></code> objects, when invoked, must run the <code><a href=#texttrack>TextTrack</a></code> objects, when invoked, must run the
following steps:</p> following steps:</p>


<ol><li><p>If the given <var title="">cue</var> is not associated with <ol><li><p>If the given <var title="">cue</var> is not currently listed
the method's <code><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track>text
track</a>, then throw an <code><a href=#invalidstateerror>InvalidStateError</a></code>
exception.</li>

<li><p>If the given <var title="">cue</var> is not currently listed
in the method's <code><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track>text in the method's <code><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track>text
track</a>'s <a href=#text-track-list-of-cues>text track list of cues</a>, then throw a track</a>'s <a href=#text-track-list-of-cues>text track list of cues</a>, then throw a
<code><a href=#notfounderror>NotFoundError</a></code> exception.</li> <code><a href=#notfounderror>NotFoundError</a></code> exception.</li>
Expand Down Expand Up @@ -35166,8 +35158,7 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>
<p>The <dfn id=dom-texttrackcue title=dom-TextTrackCue><code>TextTrackCue(<var title="">startTime</var>, <var title="">endTime</var>, <var title="">text</var>)</code></dfn> constructor, when invoked, must <p>The <dfn id=dom-texttrackcue title=dom-TextTrackCue><code>TextTrackCue(<var title="">startTime</var>, <var title="">endTime</var>, <var title="">text</var>)</code></dfn> constructor, when invoked, must
run the following steps:</p> run the following steps:</p>


<ol><li><p>Create a new <a href=#text-track-cue>text track cue</a> that is not <ol><li><p>Create a new <a href=#text-track-cue>text track cue</a>. Let <var title="">cue</var> be that <a href=#text-track-cue>text track cue</a>.</li>
associated with any <a href=#text-track>text track</a>. Let <var title="">cue</var> be that <a href=#text-track-cue>text track cue</a>.</li>


<li><p>Let <var title="">cue</var>'s <a href=#text-track-cue-start-time>text track cue start <li><p>Let <var title="">cue</var>'s <a href=#text-track-cue-start-time>text track cue start
time</a> be the value of the <var title="">startTime</var> time</a> be the value of the <var title="">startTime</var>
Expand Down Expand Up @@ -35218,9 +35209,10 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>


</ol><p>The <dfn id=dom-texttrackcue-track title=dom-TextTrackCue-track><code>track</code></dfn> </ol><p>The <dfn id=dom-texttrackcue-track title=dom-TextTrackCue-track><code>track</code></dfn>
attribute, on getting, must return the <code><a href=#texttrack>TextTrack</a></code> object attribute, on getting, must return the <code><a href=#texttrack>TextTrack</a></code> object
of the <a href=#text-track>text track</a> with which the <a href=#text-track-cue>text track of the <a href=#text-track>text track</a> in whose <a href=#text-track-list-of-cues title="text track list
cue</a> that the <code><a href=#texttrackcue>TextTrackCue</a></code> object represents is of cues">list of cues</a> the <a href=#text-track-cue>text track cue</a> that
associated, if any; or null otherwise.</p> the <code><a href=#texttrackcue>TextTrackCue</a></code> object represents finds itself, if
any; or null otherwise.</p>


<p>The <dfn id=dom-texttrackcue-id title=dom-TextTrackCue-id><code>id</code></dfn> <p>The <dfn id=dom-texttrackcue-id title=dom-TextTrackCue-id><code>id</code></dfn>
attribute, on getting, must return the <a href=#text-track-cue-identifier>text track cue attribute, on getting, must return the <a href=#text-track-cue-identifier>text track cue
Expand Down Expand Up @@ -35280,11 +35272,8 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>
<p>The <dfn id=dom-texttrackcue-line title=dom-TextTrackCue-line><code>line</code></dfn> <p>The <dfn id=dom-texttrackcue-line title=dom-TextTrackCue-line><code>line</code></dfn>
attribute, on getting, must return the <a href=#text-track-cue-computed-line-position>text track cue computed attribute, on getting, must return the <a href=#text-track-cue-computed-line-position>text track cue computed
line position</a> of the <a href=#text-track-cue>text track cue</a> that the line position</a> of the <a href=#text-track-cue>text track cue</a> that the
<code><a href=#texttrackcue>TextTrackCue</a></code> object represents. On setting, if the <code><a href=#texttrackcue>TextTrackCue</a></code> object represents. On setting, set the
<a href=#text-track-cue-snap-to-lines-flag>text track cue snap-to-lines flag</a> is not set, and the <a href=#text-track-cue-line-position>text track cue line position</a> to the new value.</p>
new value is negative or greater than 100, then throw an
<code><a href=#indexsizeerror>IndexSizeError</a></code> exception. Otherwise, set the <a href=#text-track-cue-line-position>text
track cue line position</a> to the new value.</p>


<p class=note>There is no way to explicitly set the <a href=#text-track-cue-line-position>text <p class=note>There is no way to explicitly set the <a href=#text-track-cue-line-position>text
track cue line position</a> to the special default <a href=#text-track-cue-automatic-line-position title="text track cue automatic line position">auto</a> track cue line position</a> to the special default <a href=#text-track-cue-automatic-line-position title="text track cue automatic line position">auto</a>
Expand Down

0 comments on commit fb93d0c

Please sign in to comment.