Skip to content
Permalink
Browse files

[giow] (1) Make text track cues more forgiving: drop the concept of c…

…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 fb93d0c4f6103630cebb1a2d3b6b7ecdc2692405
Showing with 128 additions and 163 deletions.
  1. +43 −54 complete.html
  2. +43 −54 index
  3. +42 −55 source
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
computed line position</dfn> whose value is defined in terms of
the other aspects of the cue. If the <a href=#text-track-cue-line-position>text track cue line
position</a> is numeric, then that is the <a href=#text-track-cue-computed-line-position>text track cue
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
cue automatic line position">auto</a>; 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, the <a href=#text-track-cue-computed-line-position>text track cue computed line position</a>
is the value 100; otherwise, it is the value returned by the
following algorithm:</p>

<ol><li><p>Let <var title="">cue</var> be the <a href=#text-track-cue>text track
computed line position</dfn> whose value is that returned by the
following algorithm, which is defined in terms of the other
aspects of the cue:</p>

<ol><li><p>If the <a href=#text-track-cue-line-position>text track cue line position</a> is
numeric, 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, and the <a href=#text-track-cue-line-position>text
track cue line position</a> is negative or greater than 100,
then return 100 and abort these steps.</li>

<li><p>If the <a href=#text-track-cue-line-position>text track cue line position</a> is numeric,
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>

<li><p>If <var title="">cue</var> is not associated with a
<a href=#text-track>text track</a>, or if that <a href=#text-track>text track</a> is
not in the <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>If <var title="">cue</var> is not in a <a href=#text-track-list-of-cues title="text
track list of cues">list of cues</a> of a <a href=#text-track>text
track</a>, or if that <a href=#text-track>text track</a> is not in the
<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
track</a> that the <var title="">cue</var> is associated
with.</li>
track</a> whose <a href=#text-track-list-of-cues title="text track list of cues">list of
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
mode</a> is <a href=#text-track-showing title="text track showing">showing</a>
</dd>

</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
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
<code><a href=#texttrackcue>TextTrackCue</a></code> object. A <a href=#text-track-cue>text track cue</a>'s
in-memory representation can be dynamically changed through this
<code><a href=#texttrackcue>TextTrackCue</a></code> API.</p>

<dt><var title="">textTrack</var> . <code title=dom-TextTrack-addCue><a href=#dom-texttrack-addcue>addCue</a></code>( <var title="">cue</var> )</dt>
<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>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>

<dt><var title="">textTrack</var> . <code title=dom-TextTrack-removeCue><a href=#dom-texttrack-removecue>removeCue</a></code>( <var title="">cue</var> )</dt>
<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>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>

</dl><div class=impl>
<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>

<ol><li><p>If the given <var title="">cue</var> is already associated
with a <a href=#text-track>text track</a> other than 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 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>
<ol><li><p>If the given <var title="">cue</var> is in a <a href=#text-track-list-of-cues>text
track list of cues</a>, then remove <var title="">cue</var> from
that <a href=#text-track-list-of-cues>text track list of cues</a>.</li>

<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> objects, when invoked, must run the
following steps:</p>

<ol><li><p>If the given <var title="">cue</var> is not associated with
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
<ol><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
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>
<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>

<ol><li><p>Create a new <a href=#text-track-cue>text track cue</a> that is not
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>
<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>

<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>

</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
of the <a href=#text-track>text track</a> with which the <a href=#text-track-cue>text track
cue</a> that the <code><a href=#texttrackcue>TextTrackCue</a></code> object represents is
associated, if any; or null otherwise.</p>
of the <a href=#text-track>text track</a> in whose <a href=#text-track-list-of-cues title="text track list
of cues">list of cues</a> the <a href=#text-track-cue>text track cue</a> that
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>
attribute, on getting, must return the <a href=#text-track-cue-identifier>text track cue
<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
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
<a href=#text-track-cue-snap-to-lines-flag>text track cue snap-to-lines flag</a> is not set, and the
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>
<code><a href=#texttrackcue>TextTrackCue</a></code> object represents. On setting, 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
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>

0 comments on commit fb93d0c

Please sign in to comment.
You can’t perform that action at this time.