Skip to content

Commit

Permalink
[e] (0) Rephrase this algorithm to be more like a series of steps tha…
Browse files Browse the repository at this point in the history
…n a switch statement, now that it has redundancies

Affected topics: Video Text Tracks

git-svn-id: http://svn.whatwg.org/webapps@8767 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 12, 2014
1 parent 9e32c95 commit 8cbd162
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 68 deletions.
49 changes: 23 additions & 26 deletions complete.html
Expand Up @@ -26280,26 +26280,23 @@ <h5 id=user-interface>4.8.14.13 User interface</h5>
<ol><li><p>If the <a href=#media-element id=user-interface:media-element-17>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-9>current media controller</a>, and that
<a href=#current-media-controller id=user-interface:current-media-controller-10>current media controller</a> is a <a href=#restrained-media-controller id=user-interface:restrained-media-controller>restrained media controller</a>, then invoke
the <code id=user-interface:dom-mediacontroller-play><a href=#dom-mediacontroller-play>play()</a></code> method of the
<code id=user-interface:mediacontroller-7><a href=#mediacontroller>MediaController</a></code>.<li><p>Otherwise, if the <a href=#media-element id=user-interface:media-element-18>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-11>current media controller</a>,
and that <a href=#current-media-controller id=user-interface:current-media-controller-12>current media controller</a> is a <a href=#paused-media-controller id=user-interface:paused-media-controller>paused media controller</a>, but all
<code id=user-interface:mediacontroller-7><a href=#mediacontroller>MediaController</a></code> and abort these steps.<li><p>If the <a href=#media-element id=user-interface:media-element-18>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-11>current media controller</a>,
and that <a href=#current-media-controller id=user-interface:current-media-controller-12>current media controller</a> is a <a href=#paused-media-controller id=user-interface:paused-media-controller>paused media controller</a>, all
of the <code id=user-interface:mediacontroller-8><a href=#mediacontroller>MediaController</a></code>'s <a href=#slaved-media-elements id=user-interface:slaved-media-elements-4>slaved media elements</a> have <a href=#ended-playback id=user-interface:ended-playback>ended
playback</a> and the <a href=#media-controller-playback-rate id=user-interface:media-controller-playback-rate>media controller playback rate</a> is positive or zero, then
<a href=#seek-the-media-controller id=user-interface:seek-the-media-controller>seek the media controller</a> to zero and invoke the <code id=user-interface:dom-mediacontroller-unpause><a href=#dom-mediacontroller-unpause>unpause()</a></code> method of the
<code id=user-interface:mediacontroller-9><a href=#mediacontroller>MediaController</a></code>.<li><p>Otherwise, if the <a href=#media-element id=user-interface:media-element-19>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-13>current media controller</a>,
playback</a>, and the <a href=#media-controller-playback-rate id=user-interface:media-controller-playback-rate>media controller playback rate</a> is positive or zero, then
<a href=#seek-the-media-controller id=user-interface:seek-the-media-controller>seek the media controller</a> to zero.<li><p>If the <a href=#media-element id=user-interface:media-element-19>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-13>current media controller</a>,
and that <a href=#current-media-controller id=user-interface:current-media-controller-14>current media controller</a> is a <a href=#paused-media-controller id=user-interface:paused-media-controller-2>paused media controller</a>, then
invoke the <code id=user-interface:dom-mediacontroller-unpause-2><a href=#dom-mediacontroller-unpause>unpause()</a></code> method of the
<code id=user-interface:mediacontroller-10><a href=#mediacontroller>MediaController</a></code>.<li><p>Otherwise, if the <a href=#media-element id=user-interface:media-element-20>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-15>current media controller</a>,
invoke the <code id=user-interface:dom-mediacontroller-unpause><a href=#dom-mediacontroller-unpause>unpause()</a></code> method of the
<code id=user-interface:mediacontroller-9><a href=#mediacontroller>MediaController</a></code> and abort these steps.<li><p>If the <a href=#media-element id=user-interface:media-element-20>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-15>current media controller</a>,
then that <a href=#current-media-controller id=user-interface:current-media-controller-16>current media controller</a> is a <a href=#playing-media-controller id=user-interface:playing-media-controller>playing media controller</a>;
invoke the <code id=user-interface:dom-mediacontroller-pause><a href=#dom-mediacontroller-pause>pause()</a></code> method of the
<code id=user-interface:mediacontroller-11><a href=#mediacontroller>MediaController</a></code>.<li><p>Otherwise, the <a href=#media-element id=user-interface:media-element-21>media element</a> has no <a href=#current-media-controller id=user-interface:current-media-controller-17>current media controller</a>; if
the <a href=#media-element id=user-interface:media-element-22>media element</a>'s <code id=user-interface:dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is true,
then invoke the <code id=user-interface:dom-media-play><a href=#dom-media-play>play()</a></code> method on the <a href=#media-element id=user-interface:media-element-23>media
element</a>.<li><p>Otherwise, the <a href=#media-element id=user-interface:media-element-24>media element</a> has no <a href=#current-media-controller id=user-interface:current-media-controller-18>current media controller</a>,
and the <a href=#media-element id=user-interface:media-element-25>media element</a>'s <code id=user-interface:dom-media-paused-2><a href=#dom-media-paused>paused</a></code> attribute is
false; invoke the <code id=user-interface:dom-media-pause><a href=#dom-media-pause>pause()</a></code> method on the <a href=#media-element id=user-interface:media-element-26>media
<code id=user-interface:mediacontroller-10><a href=#mediacontroller>MediaController</a></code> and abort these steps.<li><p>If
the <a href=#media-element id=user-interface:media-element-21>media element</a>'s <code id=user-interface:dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is true,
then invoke the <code id=user-interface:dom-media-play><a href=#dom-media-play>play()</a></code> method on the <a href=#media-element id=user-interface:media-element-22>media
element</a> and abort these steps.<li><p>Invoke the <code id=user-interface:dom-media-pause><a href=#dom-media-pause>pause()</a></code> method on the <a href=#media-element id=user-interface:media-element-23>media
element</a>.</ol>

<p>For the purposes of listing chapters in the <a href=#media-resource id=user-interface:media-resource-3>media resource</a>, only <a href=#text-track id=user-interface:text-track>text tracks</a> in the <a href=#media-element id=user-interface:media-element-27>media element</a>'s <a href=#list-of-text-tracks id=user-interface:list-of-text-tracks>list of text tracks</a>
<p>For the purposes of listing chapters in the <a href=#media-resource id=user-interface:media-resource-3>media resource</a>, only <a href=#text-track id=user-interface:text-track>text tracks</a> in the <a href=#media-element id=user-interface:media-element-24>media element</a>'s <a href=#list-of-text-tracks id=user-interface:list-of-text-tracks>list of text tracks</a>
that are <a href=#text-track-showing id=user-interface:text-track-showing>showing</a> and whose <a href=#text-track-kind id=user-interface:text-track-kind>text track kind</a> is
<code id=user-interface:dom-texttrack-kind-chapters><a href=#dom-texttrack-kind-chapters>chapters</a></code> should be used. Such tracks must be
interpreted according to the <a href=#rules-for-constructing-the-chapter-tree-from-a-text-track id=user-interface:rules-for-constructing-the-chapter-tree-from-a-text-track>rules for constructing the chapter tree from a text
Expand Down Expand Up @@ -26334,42 +26331,42 @@ <h5 id=user-interface>4.8.14.13 User interface</h5>



<p>A <a href=#media-element id=user-interface:media-element-28>media element</a> has a <dfn id=concept-media-volume>playback volume</dfn>, which is a fraction in the range 0.0 (silent) to 1.0 (loudest).
<p>A <a href=#media-element id=user-interface:media-element-25>media element</a> has a <dfn id=concept-media-volume>playback volume</dfn>, which is a fraction in the range 0.0 (silent) to 1.0 (loudest).
Initially, the volume should be 1.0, but user agents may remember the last set value across
sessions, on a per-site basis or otherwise, so the volume may start at other values.</p>

<p>The <dfn id=dom-media-volume><code>volume</code></dfn> IDL attribute must return the
<a href=#concept-media-volume id=user-interface:concept-media-volume>playback volume</a> of any audio portions of the
<a href=#media-element id=user-interface:media-element-29>media element</a>. On setting, if the new value is in the range 0.0 to 1.0 inclusive, the
<a href=#media-element id=user-interface:media-element-30>media element</a>'s <a href=#concept-media-volume id=user-interface:concept-media-volume-2>playback volume</a> must be
<a href=#media-element id=user-interface:media-element-26>media element</a>. On setting, if the new value is in the range 0.0 to 1.0 inclusive, the
<a href=#media-element id=user-interface:media-element-27>media element</a>'s <a href=#concept-media-volume id=user-interface:concept-media-volume-2>playback volume</a> must be
set to the new value. If the new value is outside the range 0.0 to 1.0 inclusive, then, on
setting, an <code id=user-interface:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception must be thrown instead.</p>

<p>A <a href=#media-element id=user-interface:media-element-31>media element</a> can also be <dfn id=concept-media-muted>muted</dfn>. If
<p>A <a href=#media-element id=user-interface:media-element-28>media element</a> can also be <dfn id=concept-media-muted>muted</dfn>. If
anything is muting the element, then it is muted. (For example, when the <a href=#direction-of-playback id=user-interface:direction-of-playback>direction of
playback</a> is backwards, the element is muted.)</p>

<p>The <dfn id=dom-media-muted><code>muted</code></dfn> IDL attribute must return the value
to which it was last set. When a <a href=#media-element id=user-interface:media-element-32>media element</a> is created, if the element has a <code id=user-interface:attr-media-muted><a href=#attr-media-muted>muted</a></code> content attribute specified, then the <code id=user-interface:dom-media-muted-2><a href=#dom-media-muted>muted</a></code> IDL attribute should be set to true; otherwise, the user
to which it was last set. When a <a href=#media-element id=user-interface:media-element-29>media element</a> is created, if the element has a <code id=user-interface:attr-media-muted><a href=#attr-media-muted>muted</a></code> content attribute specified, then the <code id=user-interface:dom-media-muted-2><a href=#dom-media-muted>muted</a></code> IDL attribute should be set to true; otherwise, the user
agents may set the value to the user's preferred value (e.g. remembering the last set value across
sessions, on a per-site basis or otherwise). While the <code id=user-interface:dom-media-muted-3><a href=#dom-media-muted>muted</a></code>
IDL attribute is set to true, the <a href=#media-element id=user-interface:media-element-33>media element</a> must be <a href=#concept-media-muted id=user-interface:concept-media-muted>muted</a>.</p>
IDL attribute is set to true, the <a href=#media-element id=user-interface:media-element-30>media element</a> must be <a href=#concept-media-muted id=user-interface:concept-media-muted>muted</a>.</p>

<p>Whenever either of the values that would be returned by the <code id=user-interface:dom-media-volume-4><a href=#dom-media-volume>volume</a></code> and <code id=user-interface:dom-media-muted-4><a href=#dom-media-muted>muted</a></code> IDL
attributes change, the user agent must <a href=#queue-a-task id=user-interface:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=user-interface:fire-a-simple-event>fire a simple
event</a> named <code id=user-interface:event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> at the <a href=#media-element id=user-interface:media-element-34>media
event</a> named <code id=user-interface:event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> at the <a href=#media-element id=user-interface:media-element-31>media
element</a>.</p>

<p>An element's <dfn id=effective-media-volume>effective media volume</dfn> is determined as follows:</p>

<ol><li><p>If the user has indicated that the user agent is to override the volume of the element,
then the element's <a href=#effective-media-volume id=user-interface:effective-media-volume>effective media volume</a> is the volume desired by the user. Abort
these steps.<li><p>If the element's audio output is <a href=#concept-media-muted id=user-interface:concept-media-muted-2>muted</a>, the
element's <a href=#effective-media-volume id=user-interface:effective-media-volume-2>effective media volume</a> is zero. Abort these steps.<li><p>If the element has a <a href=#current-media-controller id=user-interface:current-media-controller-19>current media controller</a> and that
<code id=user-interface:mediacontroller-12><a href=#mediacontroller>MediaController</a></code> object's <a href=#media-controller-mute-override id=user-interface:media-controller-mute-override>media controller mute override</a> is true, the
element's <a href=#effective-media-volume id=user-interface:effective-media-volume-2>effective media volume</a> is zero. Abort these steps.<li><p>If the element has a <a href=#current-media-controller id=user-interface:current-media-controller-17>current media controller</a> and that
<code id=user-interface:mediacontroller-11><a href=#mediacontroller>MediaController</a></code> object's <a href=#media-controller-mute-override id=user-interface:media-controller-mute-override>media controller mute override</a> is true, the
element's <a href=#effective-media-volume id=user-interface:effective-media-volume-3>effective media volume</a> is zero. Abort these steps.<li><p>Let <var>volume</var> be the <a href=#concept-media-volume id=user-interface:concept-media-volume-3>playback
volume</a> of the audio portions of the <a href=#media-element id=user-interface:media-element-35>media element</a>, in range 0.0 (silent) to
1.0 (loudest).<li><p>If the element has a <a href=#current-media-controller id=user-interface:current-media-controller-20>current media controller</a>, multiply <var>volume</var> by that <code id=user-interface:mediacontroller-13><a href=#mediacontroller>MediaController</a></code> object's <a href=#media-controller-volume-multiplier id=user-interface:media-controller-volume-multiplier>media controller
volume</a> of the audio portions of the <a href=#media-element id=user-interface:media-element-32>media element</a>, in range 0.0 (silent) to
1.0 (loudest).<li><p>If the element has a <a href=#current-media-controller id=user-interface:current-media-controller-18>current media controller</a>, multiply <var>volume</var> by that <code id=user-interface:mediacontroller-12><a href=#mediacontroller>MediaController</a></code> object's <a href=#media-controller-volume-multiplier id=user-interface:media-controller-volume-multiplier>media controller
volume multiplier</a>. (The <a href=#media-controller-volume-multiplier id=user-interface:media-controller-volume-multiplier-2>media controller volume multiplier</a> is in the range
0.0 to 1.0, so this can only reduce the value.)<li><p>The element's <a href=#effective-media-volume id=user-interface:effective-media-volume-4>effective media volume</a> is <var>volume</var>,
interpreted relative to the range 0.0 to 1.0, with 0.0 being silent, and 1.0 being the loudest
Expand All @@ -26379,7 +26376,7 @@ <h5 id=user-interface>4.8.14.13 User interface</h5>



<p>The <dfn id=attr-media-muted><code>muted</code></dfn> content attribute on <a href=#media-element id=user-interface:media-element-36>media elements</a> is a <a href=#boolean-attribute id=user-interface:boolean-attribute-2>boolean attribute</a> that controls the
<p>The <dfn id=attr-media-muted><code>muted</code></dfn> content attribute on <a href=#media-element id=user-interface:media-element-33>media elements</a> is a <a href=#boolean-attribute id=user-interface:boolean-attribute-2>boolean attribute</a> that controls the
default state of the audio output of the <a href=#media-resource id=user-interface:media-resource-4>media resource</a>, potentially overriding user
preferences.</p>

Expand Down

0 comments on commit 8cbd162

Please sign in to comment.