Skip to content

Commit

Permalink
[giow] (0) Make browsers fire events for all cues, even when they're …
Browse files Browse the repository at this point in the history
…overloaded, rather that skipping events on skipped cues.

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=13622

git-svn-id: http://svn.whatwg.org/webapps@6517 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Aug 22, 2011
1 parent 8a83677 commit fce5967
Show file tree
Hide file tree
Showing 3 changed files with 409 additions and 192 deletions.
189 changes: 127 additions & 62 deletions complete.html
Expand Up @@ -239,7 +239,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1>Web Applications 1.0</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 19 August 2011</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 22 August 2011</h2>
</hgroup><dl><dt>Multiple-page version:</dt>
<dd><a href=http://www.whatwg.org/specs/web-apps/current-work/complete/>http://www.whatwg.org/specs/web-apps/current-work/complete/</a></dd>
<dt>One-page version:</dt>
Expand Down Expand Up @@ -29091,25 +29091,35 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the
agent rushes ahead to "catch up".)
</p>

<ol><li><p>Let <var title="">current cues</var> be an ordered list of
<a href=#text-track-cue title="text track cue">cues</a>, initialized to contain
all the <a href=#text-track-cue title="text track cue">cues</a> of all the <a href=#text-track-hidden title="text track hidden">hidden</a>, <a href=#text-track-showing title="text track
<ol><li><p>Let <var title="">current cues</var> be a list of <a href=#text-track-cue title="text track cue">cues</a>, initialized to contain all the
<a href=#text-track-cue title="text track cue">cues</a> of all the <a href=#text-track-hidden title="text track hidden">hidden</a>, <a href=#text-track-showing title="text track
showing">showing</a>, or <a href=#text-track-showing-by-default title="text track showing by
default">showing by default</a> <a href=#text-track title="text track">text
tracks</a> of the <a href=#media-element>media element</a> (not the <a href=#text-track-disabled title="text track disabled">disabled</a> ones) whose <a href=#text-track-cue-start-time title="text track cue start time">start times</a> are less than
or equal to the <a href=#current-playback-position>current playback position</a> and whose
<a href=#text-track-cue-end-time title="text track cue end time">end times</a> are greater
than the <a href=#current-playback-position>current playback position</a>, in <a href=#text-track-cue-order>text
track cue order</a>.</li>
than the <a href=#current-playback-position>current playback position</a>.</li>

<li><p>Let <var title="">other cues</var> be an ordered list of
<a href=#text-track-cue title="text track cue">cues</a>, initialized to contain
all the <a href=#text-track-cue title="text track cue">cues</a> of <a href=#text-track-hidden title="text track hidden">hidden</a>, <a href=#text-track-showing title="text track
<li><p>Let <var title="">other cues</var> be a list of <a href=#text-track-cue title="text track cue">cues</a>, initialized to contain all the
<a href=#text-track-cue title="text track cue">cues</a> of <a href=#text-track-hidden title="text track
hidden">hidden</a>, <a href=#text-track-showing title="text track
showing">showing</a>, and <a href=#text-track-showing-by-default title="text track showing by
default">showing by default</a> <a href=#text-track title="text track">text
tracks</a> of the <a href=#media-element>media element</a> that are not
present in <var title="">current cues</var>, also in <a href=#text-track-cue-order>text
track cue order</a>.</li>
present in <var title="">current cues</var>.</li>

<li><p>Let <var title="">last time</var> be the <a href=#current-playback-position>current
playback position</a> at the time this algorithm was last run
for this <a href=#media-element>media element</a>, if this is not the first time
it has run.</li>

<li><p>If the <a href=#current-playback-position>current playback position</a> has, since the
last time this algorithm was run, only changed through its usual
monotonic increase during normal playback, then let <var title="">missed cues</var> be the list of <a href=#text-track-cue title="text track
cue">cues</a> in <var title="">other cues</var> whose <a href=#text-track-cue-start-time title="text track cue start time">start times</a> are greater
than or equal to <var title="">last time</var> and whose <a href=#text-track-cue-end-time title="text track cue end time">end times</a> are less than or
equal to the <a href=#current-playback-position>current playback position</a>. Otherwise, let
<var title="">missed cues</var> be an empty list.</li>

<li><p>If the time was reached through the usual monotonic increase
of the <a href=#current-playback-position>current playback position</a> during normal
Expand All @@ -29131,54 +29141,110 @@ <h5 id=playing-the-media-resource><span class=secno>4.8.10.8 </span>Playing the

<li><p>If all of the <a href=#text-track-cue title="text track cue">cues</a> in
<var title="">current cues</var> have their <a href=#text-track-cue-active-flag>text track cue
active flag</a> set, and none of the <a href=#text-track-cue title="text track
active flag</a> set, none of the <a href=#text-track-cue title="text track
cue">cues</a> in <var title="">other cues</var> have their
<a href=#text-track-cue-active-flag>text track cue active flag</a> set, then abort these
<a href=#text-track-cue-active-flag>text track cue active flag</a> set, and <var title="">missed cues</var> is empty, then abort these
steps.</li>

<li><p>If the time was reached through the usual monotonic increase
of the <a href=#current-playback-position>current playback position</a> during normal
playback, and there are <a href=#text-track-cue title="text track cue">cues</a> in
<var title="">other cues</var> that have both their <a href=#text-track-cue-active-flag>text
track cue active flag</a> set and their <a href=#text-track-cue-pause-on-exit-flag>text track cue
pause-on-exit flag</a> set, then immediately <a href=#dom-media-pause title=dom-media-pause>pause</a> the <a href=#media-element>media
element</a>. <!-- "pause" can in theory call load(), but never
can it do so as part of this invokation, since we wouldn't be in
this algorithm if the media element was empty. So, no need to couch
all this in a task. --> (In the other cases, such as explicit
seeks, playback is not paused by going past the end time of a <a href=#text-track-cue title="text track cue">cue</a>, even if that <a href=#text-track-cue title="text
track cue">cue</a> has its <a href=#text-track-cue-pause-on-exit-flag>text track cue pause-on-exit
flag</a> set.)</li>

<li><p>Let <var title="">affected tracks</var> be a list of <a href=#text-track title="text track">text tracks</a>, initially empty.</li>

<li><p>For each <a href=#text-track-cue title="text track cue">text track
cue</a> in <var title="">other cues</var> that has its
<a href=#text-track-cue-active-flag>text track cue active flag</a> set, in list order,
<a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
<code title=event-exit>exit</code> at the
<code><a href=#texttrackcue>TextTrackCue</a></code> object, and add the <a href=#text-track-cue title="text
track cue">cue</a>'s <a href=#text-track>text track</a> to <var title="">affected tracks</var>, if it's not already in the
list.</li>
<li>

<li><p>For each <a href=#text-track-cue title="text track cue">text track
cue</a> in <var title="">current cues</var> that does not have
its <a href=#text-track-cue-active-flag>text track cue active flag</a> set, in list order,
<a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a simple event</a> named
<code title=event-enter>enter</code> at the
<code><a href=#texttrackcue>TextTrackCue</a></code> object, and add the <a href=#text-track-cue title="text
track cue">cue</a>'s <a href=#text-track>text track</a> to <var title="">affected tracks</var>, if it's not already in the
list.</li>
<p>If the time was reached through the usual monotonic increase of
the <a href=#current-playback-position>current playback position</a> during normal playback,
and there are <a href=#text-track-cue title="text track cue">cues</a> in <var title="">other cues</var> that have their <a href=#text-track-cue-pause-on-exit-flag>text track cue
pause-on-exit flag</a> set and that either have their
<a href=#text-track-cue-active-flag>text track cue active flag</a> set or are also in <var title="">missed cues</var>, then immediately <a href=#dom-media-pause title=dom-media-pause>pause</a> the <a href=#media-element>media
element</a>. <!-- "pause" can in theory call load(), but never
can it do so as part of this invokation, since we wouldn't be in
this algorithm if the media element was empty. So, no need to
couch all this in a task. --></p>

<p class=note>In the other cases, such as explicit seeks,
playback is not paused by going past the end time of a <a href=#text-track-cue title="text track cue">cue</a>, even if that <a href=#text-track-cue title="text
track cue">cue</a> has its <a href=#text-track-cue-pause-on-exit-flag>text track cue pause-on-exit
flag</a> set.</p>

</li>

<li>

<p>Let <var title="">events</var> be a list of <a href=#concept-task title=concept-task>tasks</a>, initially empty. Each <a href=#concept-task title=concept-task>task</a> in this list will be associated
with a <a href=#text-track>text track</a>, a <a href=#text-track-cue>text track cue</a>, and
a time, which are used to sort the list before the <a href=#concept-task title=concept-task>tasks</a> are queued.</p>

<p>Let <var title="">affected tracks</var> be a list of <a href=#text-track title="text track">text tracks</a>, initially empty.</p>

<p>When the steps below say to <dfn id=prepare-an-event>prepare an event</dfn> named
<var title="">event</var> for a <a href=#text-track-cue>text track cue</a> <var title="">target</var> with a time <var title="">time</var>, the
user agent must run these substeps:</p>

<ol><li><p>Let <var title="">track</var> be the <a href=#text-track>text
track</a> with which the <a href=#text-track-cue>text track cue</a> <var title="">target</var> is associated.</li>

<li><p>Create a <a href=#concept-task title=concept-task>task</a> to
<a href=#fire-a-simple-event>fire a simple event</a> named <var title="">event</var>
at <var title="">target</var>.</li>

<li><p>Add to the newly create <a href=#concept-task title=concept-task>task</a> to <var title="">events</var>,
associated with the time <var title="">time</var>, the <a href=#text-track>text
track</a> <var title="">track</var>, and the <a href=#text-track-cue>text track
cue</a> <var title="">target</var>.</li>

<li><p>Add <var title="">track</var> to <var title="">affected
tracks</var>.</li>

</ol></li>

<li><p>For each <a href=#text-track-cue title="text track cue">text track cue</a>
in <var title="">missed cues</var>, <a href=#prepare-an-event>prepare an event</a>
named <code title=event-enter>enter</code> for the
<code><a href=#texttrackcue>TextTrackCue</a></code> object with the <a href=#text-track-cue-start-time>text track cue
start time</a>.</li>

<li><p>For each <a href=#text-track-cue title="text track cue">text track cue</a>
in <var title="">other cues</var> that either has its <a href=#text-track-cue-active-flag>text
track cue active flag</a> set or is in <var title="">missed
cues</var>, <a href=#prepare-an-event>prepare an event</a> named <code title=event-exit>exit</code> for the <code><a href=#texttrackcue>TextTrackCue</a></code>
object with the <a href=#text-track-cue-end-time>text track cue end time</a>.</li>

<li><p>For each <a href=#text-track-cue title="text track cue">text track cue</a>
in <var title="">current cues</var> that does not have its
<a href=#text-track-cue-active-flag>text track cue active flag</a> set, <a href=#prepare-an-event>prepare an
event</a> named <code title=event-enter>enter</code> for the
<code><a href=#texttrackcue>TextTrackCue</a></code> object with the <a href=#text-track-cue-start-time>text track cue
start time</a>.</li>

<li>

<p>Sort the <a href=#concept-task title=concept-task>tasks</a> in <var title="">events</var> in ascending time order (<a href=#concept-task title=concept-task>tasks</a> with earlier times
first).</p>

<p>Further sort <a href=#concept-task title=concept-task>tasks</a> in <var title="">events</var> that have the same time by the <a href=#text-track>text
track</a> associated with the <a href=#concept-task title=concept-task>tasks</a>, in the same order as the <a href=#text-track title="text track">text tracks</a> appear in the <a href=#media-element>media
element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>.</p>

<p>Further sort <a href=#concept-task title=concept-task>tasks</a> in <var title="">events</var> that have the same time and <a href=#text-track>text
track</a> by the <a href=#text-track-cue>text track cue</a> associated with
the <a href=#concept-task title=concept-task>tasks</a>, in the same order as
the <a href=#text-track-cue title="text track cue">cues</a> were created (so e.g.
for cues from a <a href=#webvtt-file>WebVTT file</a>, that would be the order
in which the cues were listed in the file).</p>

</li>

<li><p><a href=#queue-a-task title="queue a task">Queue</a> each <a href=#concept-task title=concept-task>task</a> in <var title="">events</var>, in
list order.</li>

<li><p>Sort <var title="">affected tracks</var> in the same order
as the <a href=#text-track title="text track">text tracks</a> appear in the
<a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of text tracks</a>, and
remove duplicates.</p>

<li><p>For each <a href=#text-track>text track</a> in <var title="">affected
tracks</var>, in the order they were added to the list (which will
match the relative order of the <a href=#text-track title="text track">text
tracks</a> in the <a href=#media-element>media element</a>'s <a href=#list-of-text-tracks>list of
text tracks</a>), <a href=#queue-a-task>queue a task</a> to <a href=#fire-a-simple-event>fire a
simple event</a> named <code title=event-cuechange>cuechange</code> at the
<code><a href=#texttrack>TextTrack</a></code> object, and, if the <a href=#text-track>text
track</a> has a corresponding <code><a href=#the-track-element>track</a></code> element, to
then <a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-cuechange>cuechange</code> at the <code><a href=#the-track-element>track</a></code>
tracks</var>, in the list order, <a href=#queue-a-task>queue a task</a> to
<a href=#fire-a-simple-event>fire a simple event</a> named <code title=event-cuechange>cuechange</code> at the
<code><a href=#texttrack>TextTrack</a></code> object, and, if the <a href=#text-track>text track</a>
has a corresponding <code><a href=#the-track-element>track</a></code> element, to then <a href=#fire-a-simple-event>fire
a simple event</a> named <code title=event-cuechange>cuechange</code> at the <code><a href=#the-track-element>track</a></code>
element as well.</li>

<li><p>Set the <a href=#text-track-cue-active-flag>text track cue active flag</a> of all the
Expand Down Expand Up @@ -31684,15 +31750,14 @@ <h6 id=text-track-api><span class=secno>4.8.10.12.5 </span>Text track API</h6>
</dl><p>If the <a href=#text-track-mode>text track mode</a> of the <a href=#text-track>text
track</a> that the <code><a href=#texttrack>TextTrack</a></code> object represents is
not the <a href=#text-track-disabled>text track disabled</a> mode, then the <dfn id=dom-texttrack-cues title=dom-TextTrack-cues><code>cues</code></dfn> attribute must
return a <a href=#live>live</a> <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object
that represents the subset of the <a href=#text-track-list-of-cues>text track list of
cues</a> of the <a href=#text-track>text track</a> that the
<code><a href=#texttrack>TextTrack</a></code> object represents whose <a href=#text-track-cue-start-time title="text
track cue start time">start times</a> occur before the
<a href=#earliest-possible-position-when-the-script-started>earliest possible position when the script started</a>, in
<a href=#text-track-cue-order>text track cue order</a>. Otherwise, it must return
null. When an object is returned, the same object must be returned
each time.</p>
return a <a href=#live>live</a> <code><a href=#texttrackcuelist>TextTrackCueList</a></code> object that
represents the subset of the <a href=#text-track-list-of-cues>text track list of cues</a> of
the <a href=#text-track>text track</a> that the <code><a href=#texttrack>TextTrack</a></code> object
represents whose <a href=#text-track-cue-start-time title="text track cue start time">start
times</a> occur at or after the <a href=#earliest-possible-position-when-the-script-started>earliest possible position
when the script started</a>, in <a href=#text-track-cue-order>text track cue
order</a>. Otherwise, it must return null. When an object is
returned, the same object must be returned each time.</p>

<p>The <dfn id=earliest-possible-position-when-the-script-started>earliest possible position when the script started</dfn>
is whatever the <a href=#earliest-possible-position>earliest possible position</a> was the last
Expand Down

0 comments on commit fce5967

Please sign in to comment.