Skip to content

Commit

Permalink
Clarify line and snap-to-lines and how they can be invalid
Browse files Browse the repository at this point in the history
Also be consistently use true or false for the snap-to-lines flag.

Fixes #289.
  • Loading branch information
zcorpan committed May 27, 2016
1 parent 882c3b5 commit 7860599
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 70 deletions.
43 changes: 26 additions & 17 deletions index.bs
Expand Up @@ -70,7 +70,7 @@ urlPrefix: https://heycam.github.io/webidl/
</pre>

<pre class=link-defaults>
spec:dom-ls; type:interface; text:Document
spec:dom; type:interface; text:Document
spec:css-ruby-1; type:value; text:ruby-base
spec:css-color-4; type:property; text:color
spec:css-fonts-3; type:property; text:font-style
Expand Down Expand Up @@ -701,10 +701,10 @@ precomposed character).</p>

<p>A boolean indicating whether the <a lt="WebVTT cue line">line</a> is an integer number of lines
(using the line dimensions of the first line of the cue), or whether it is a percentage of the
dimension of the video. The flag is set when lines are counted, unset otherwise.</p>
dimension of the video. The flag is set to true when lines are counted, and false otherwise.</p>

<p>Cues whose <a>WebVTT cue snap-to-lines flag</a> is set will be placed within the title-safe
area on user agents that use overscan. Cues with the flag unset will be offset as requested
<p>Cues whose <a>WebVTT cue snap-to-lines flag</a> is true will be placed within the title-safe
area on user agents that use overscan. Cues where the flag is false will be offset as requested
(modulo overlap avoidance if multiple cues are in the same place).</p>

<p>By default, the <a lt="WebVTT cue snap-to-lines flag">snap-to-lines flag</a> is set to
Expand Down Expand Up @@ -733,15 +733,15 @@ precomposed character).</p>
<ol algorithm="computed line">

<li><p>If the <a lt="WebVTT cue line">line</a> is numeric, the <a>WebVTT cue snap-to-lines
flag</a> of the <a>WebVTT cue</a> is not set, and the <a lt="WebVTT cue line">line</a> is
flag</a> of the <a>WebVTT cue</a> is false, and the <a lt="WebVTT cue line">line</a> is
negative or greater than 100, then return 100 and abort these steps.</p></li>

<li><p>If the <a lt="WebVTT cue line">line</a> is numeric, return the value of the <a>WebVTT cue
line</a> and abort these steps. (Either the <a>WebVTT cue snap-to-lines flag</a> is set, so any
line</a> and abort these steps. (Either the <a>WebVTT cue snap-to-lines flag</a> is true, 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.)</p></li>

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

Expand All @@ -766,6 +766,11 @@ precomposed character).</p>

</ol>

<p class="note">Although the <a>WebVTT parser</a> will not set the <a lt="WebVTT cue
line">line</a> to a number outside the range 0..100 and also set the <a>WebVTT cue snap-to-lines
flag</a> to false, this can happen when using the DOM API's {{VTTCue/snapToLines}} and
{{VTTCue/line}} attributes.</p>

</dd>

<dt><dfn lt="WebVTT cue line alignment">A line alignment</dfn></dt>
Expand Down Expand Up @@ -3977,7 +3982,7 @@ following algorithm.</p>

<dl class="switch">

<dt>If the <a>WebVTT cue snap-to-lines flag</a> is not set</dt>
<dt>If the <a>WebVTT cue snap-to-lines flag</a> is false</dt>
<dd>
<dl class="switch">

Expand All @@ -3993,7 +3998,7 @@ following algorithm.</p>
</dl>
</dd>

<dt>If the <a>WebVTT cue snap-to-lines flag</a> is set</dt>
<dt>If the <a>WebVTT cue snap-to-lines flag</a> is true</dt>
<dd>
<dl class="switch">

Expand All @@ -4018,7 +4023,7 @@ following algorithm.</p>

<li>

<p>If the <a>WebVTT cue snap-to-lines flag</a> is set, then run the appropriate steps from the
<p>If the <a>WebVTT cue snap-to-lines flag</a> is true, then run the appropriate steps from the
following list:</p>

<dl class="switch">
Expand Down Expand Up @@ -4199,7 +4204,7 @@ following algorithm.</p>

<dl class="switch">

<dt>If |cue|'s <a>WebVTT cue snap-to-lines flag</a> is set</dt>
<dt>If |cue|'s <a>WebVTT cue snap-to-lines flag</a> is true</dt>

<dd>

Expand Down Expand Up @@ -4250,8 +4255,8 @@ following algorithm.</p>

<li>

<p>Let |max dimension| be <var>full&nbsp;dimension</var>&nbsp;-&nbsp;(2&nbsp;&times;&nbsp;
|margin|).</p>
<p>Let |max dimension| be
<var>full&nbsp;dimension</var>&nbsp;-&nbsp;(2&nbsp;&times;&nbsp;|margin|).</p>

</li>

Expand Down Expand Up @@ -4362,7 +4367,7 @@ following algorithm.</p>

</dd>

<dt>If |cue|'s <a>WebVTT cue snap-to-lines flag</a> is not set</dt>
<dt>If |cue|'s <a>WebVTT cue snap-to-lines flag</a> is false</dt>
<dd>

<ol>
Expand Down Expand Up @@ -4886,7 +4891,7 @@ interface VTTCue : TextTrackCue {

<dt>|cue| . {{VTTCue/snapToLines}} [ = |value| ]</dt>
<dd>
<p>Returns true if the <a>WebVTT cue snap-to-lines flag</a> is set, false otherwise.</p>
<p>Returns true if the <a>WebVTT cue snap-to-lines flag</a> is true, false otherwise.</p>
<p>Can be set.</p>
</dd>

Expand Down Expand Up @@ -5060,8 +5065,8 @@ value.</p>

<p>The <dfn attribute for=VTTCue>snapToLines</dfn> attribute, on getting, must return true if the
<a>WebVTT cue snap-to-lines flag</a> of the <a>WebVTT cue</a> that the {{VTTCue}} object represents
is set; or false otherwise. On setting, the <a>WebVTT cue snap-to-lines flag</a> must be set if the
new value is true, and must be unset otherwise.</p>
is true; or false otherwise. On setting, the <a>WebVTT cue snap-to-lines flag</a> must be set to
the new value.</p>

<p>The <dfn attribute for=VTTCue>line</dfn> attribute, on getting, must return the <a>WebVTT cue
line</a> of the <a>WebVTT cue</a> that the {{VTTCue}} object represents. The special value <a
Expand All @@ -5070,6 +5075,10 @@ setting, the <a>WebVTT cue line</a> must be set to the new value; if the new val
"<code>auto</code>", then it must be interpreted as the special value <a lt="WebVTT cue line
automatic">auto</a>.</p>

<p class="note">In order to be able to set the {{VTTCue/snapToLines}} and {{VTTCue/line}} attributes
in any order, the API does not reject setting {{VTTCue/snapToLines}} to false when {{VTTCue/line}}
has a value outside the range 0..100, or vice versa.

<p>The <dfn attribute for=VTTCue>lineAlign</dfn> attribute, on getting, must return the string from
the second cell of the row in the table below whose first cell is the <a>WebVTT cue line
alignment</a> of the <a>WebVTT cue</a> that the {{VTTCue}} object represents:</p>
Expand Down

0 comments on commit 7860599

Please sign in to comment.