[html5] r5153 - [giow] (0) Captions - Stage 21.6: rendering: avoiding cue collisions; supporting [...]

whatwg at whatwg.org whatwg at whatwg.org
Tue Jul 13 01:19:19 PDT 2010


Author: ianh
Date: 2010-07-13 01:19:18 -0700 (Tue, 13 Jul 2010)
New Revision: 5153

Modified:
   complete.html
   index
   source
Log:
[giow] (0) Captions - Stage 21.6: rendering: avoiding cue collisions; supporting the line-based positioning

Modified: complete.html
===================================================================
--- complete.html	2010-07-13 01:30:15 UTC (rev 5152)
+++ complete.html	2010-07-13 08:19:18 UTC (rev 5153)
@@ -86472,7 +86472,6 @@
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-start-alignment title="timed track cue start alignment">start</a></dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-start-alignment title="timed track cue start alignment">start</a></dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> subtracted from 100.</p>
        </dd>
@@ -86487,7 +86486,6 @@
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-end-alignment title="timed track cue end alignment">end</a></dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-end-alignment title="timed track cue end alignment">end</a></dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a>.</p>
        </dd>
@@ -86506,7 +86504,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a>,
               and the <a href=#timed-track-cue-text-position>timed track cue text position</a> is less than or equal to 50</dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> multiplied by two.</p>
        </dd>
@@ -86525,7 +86522,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a>,
               and the <a href=#timed-track-cue-text-position>timed track cue text position</a> is greater than <!-- or equal to --> 50</dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the result of subtracting <a href=#timed-track-cue-text-position>timed track cue text position</a> from 100 and then multiplying the result by two.</p>
        </dd>
@@ -86554,7 +86550,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-end-alignment title="timed track cue end alignment">end</a>,
               and <var title="">direction</var> is 'rtl'</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a>.</p>
        </dd>
@@ -86565,7 +86560,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-start-alignment title="timed track cue start alignment">start</a>,
               and <var title="">direction</var> is 'rtl'</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> subtracted from 100.</p>
        </dd>
@@ -86574,7 +86568,6 @@
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-start-alignment title="timed track cue start alignment">start</a></dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-start-alignment title="timed track cue start alignment">start</a></dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a>.</p>
        </dd>
@@ -86583,7 +86576,6 @@
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-end-alignment title="timed track cue end alignment">end</a></dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-end-alignment title="timed track cue end alignment">end</a></dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> subtracted from 100.</p>
        </dd>
@@ -86591,7 +86583,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a>,
               and <var title="">direction</var> is 'ltr'</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> minus half of <var title="">size</var>.</p>
        </dd>
@@ -86599,7 +86590,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a>,
               and <var title="">direction</var> is 'rtl'</dt>
-
        <dd>
         <p>Let <var title="">x-position-reverse</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> minus half of <var title="">size</var>.</p>
         <p>Let <var title="">x-position</var> be <var title="">x-position-reverse</var> subtracted from 100.</p>
@@ -86609,7 +86599,6 @@
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a></dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a></dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> minus half of <var title="">size</var>.</p>
        </dd>
@@ -86624,14 +86613,12 @@
 
       <dl class=switch><dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is set</dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be zero.</p>
        </dd>
 
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is not set</dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <a href=#timed-track-cue-line-position>timed track cue line position</a>.</p>
        </dd>
@@ -86640,7 +86627,6 @@
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is set</dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is set</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be zero.</p>
        </dd>
@@ -86649,7 +86635,6 @@
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is not set</dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is not set</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <a href=#timed-track-cue-line-position>timed track cue line position</a>.</p>
        </dd>
@@ -86712,6 +86697,9 @@
 
      </li>
 
+     <li><p>If there are no line boxes in <var title="">boxes</var>,
+     skip the remainder of these substeps for <var title="">cue</var>. The cue is ignored.</li>
+
      <li>
 
       <p>Adjust the positions of <var title="">boxes</var> according
@@ -86721,30 +86709,208 @@
 
        <dd>
 
-        <p class=XXX>determine the block-direction position of the
-        first line, then slide the line away from the reference edge
-        until it fits, or if that goes off the edge slide it in the
-        other direction; sliding must snap to multiples of the height
-        of the first line box.</p>
+        <p>Many of the steps in this algorithm vary according to the
+        <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a>. Steps labeled
+        "<strong>Horizontal</strong>" must be followed only when the
+        <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing
+        direction">horizontal</a>, steps labeled
+        "<strong>Vertical</strong>" must be followed when the
+        <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is either <a href=#timed-track-cue-vertical-growing-left-writing-direction title="timed track cue vertical growing left writing
+        direction">vertical growing left</a> or <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed
+        track cue vertical growing right writing direction">vertical
+        growing right</a>, steps labeled "<strong>Vertical Growing
+        Left</strong>" must be followed only when the <a href=#timed-track-cue-writing-direction>timed
+        track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-left-writing-direction title="timed track
+        cue vertical growing left writing direction">vertical growing
+        left</a>, and steps labeled "<strong>Vertical Growing
+        Right</strong>" must be followed only when the <a href=#timed-track-cue-writing-direction>timed
+        track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track
+        cue vertical growing right writing direction">vertical growing
+        right</a>.</p>
 
-       </dd>
+        <ol><li>
 
+          <p><strong>Horizontal</strong>: Let <var title="">step</var>
+          be the height of the first line box in <var title="">boxes</var>.</p>
+
+          <p><strong>Vertical</strong>: Let <var title="">step</var>
+          be the width of the first line box in <var title="">boxes</var>.</p>
+
+         </li>
+
+         <li><p>If <var title="">step</var> is zero, then jump to the
+         step labeled <i>done positioning</i> below.</li>
+
+         <li><p>Let <var title="">line position</var> be the
+         <a href=#timed-track-cue-line-position>timed track cue line position</a>.</li>
+
+         <li><p><strong>Vertical Growing Left</strong>: Add one to
+         <var title="">line position</var> then negate it.</li>
+
+         <li><p>Let <var title="">position</var> be the result of
+         multiplying <var title="">step</var> and <var title="">line
+         position</var>.</li>
+
+         <li><p><strong>Vertical Growing Left</strong>: Decrease <var title="">position</var> by the width of the bounding box of
+         the boxes in <var title="">boxes</var>, then increase <var title="">position</var> by <var title="">step</var>.</li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: If <var title="">line
+          position</var> is less than zero then increase <var title="">position</var> by the height of the <var title="">video</var>'s rendering area, and negate <var title="">step</var> (so its value is now minus the height of
+          the first line box in <var title="">boxes</var>).</p>
+
+          <p><strong>Vertical</strong>: If <var title="">line
+          position</var> is less than zero then increase <var title="">position</var> by the width of the <var title="">video</var>'s rendering area, and negate <var title="">step</var>.</p>
+
+         </li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: Move all the boxes in <var title="">boxes</var> down by the distance given by <var title="">position</var>.</p>
+
+          <p><strong>Vertical</strong>: Move all the boxes in <var title="">boxes</var> right by the distance given by <var title="">position</var>.</p>
+
+         </li>
+
+         <li><p><i>Default</i>: Remember the position of all the boxes in
+         <var title="">boxes</var> as their <var title="">default
+         position</var>.</li>
+
+         <li><p>Let <var title="">switched</var> be false.</li>
+
+         <li><p><i>Step loop</i>: If none of the boxes in <var title="">boxes</var> would overlap any of the boxes in <var title="">output</var>, and all the boxes in <var title="">output</var> are within the <var title="">video</var>'s rendering area, then jump to the step
+         labeled <i>done positioning</i> below.</li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: If <var title="">step</var>
+          is negative and the top of the first line box in <var title="">boxes</var> is now above the top of the <var title="">video</var>'s rendering area, or if <var title="">step</var> is positive and the bottom of the first
+          line box in <var title="">boxes</var> is now below the
+          bottom of the <var title="">video</var>'s rendering area,
+          jump to the step labeled <i>switch direction</i>.</p>
+
+          <p><strong>Vertical</strong>: If <var title="">step</var> is
+          negative and the left edge of the first line box in <var title="">boxes</var> is now to the left of the left edge of
+          the <var title="">video</var>'s rendering area, or if <var title="">step</var> is positive and the right edge of the
+          first line box in <var title="">boxes</var> is now to the
+          right of the right edge of the <var title="">video</var>'s
+          rendering area, jump to the step labeled <i>switch
+          direction</i>.</p>
+
+         </li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: Move all the boxes in <var title="">boxes</var> down by the distance given by <var title="">step</var>. (If <var title="">step</var> is
+          negative, then this will actually result in an upwards
+          movement of the boxes in absolute terms.)</p>
+
+          <p><strong>Vertical</strong>: Move all the boxes in <var title="">boxes</var> right by the distance given by <var title="">step</var>. (If <var title="">step</var> is
+          negative, then this will actually result in a leftwards
+          movement of the boxes in absolute terms.)</p>
+
+         </li>
+
+         <li><p>Jump back to the step labeled <i>step
+         loop</i>.</li>
+
+         <li><p><i>Switch direction</i>: Move all the boxes in <var title="">boxes</var> back to their <var title="">default
+         position</var> as determined in the step above labeled
+         <i>default</i>.</li>
+
+         <li><p>If <var title="">switched</var> is true, jump to the step
+         labeled <i>done positioning</i> below.</li>
+
+         <li><p>Negate <var title="">step</var>.</li>
+
+         <li><p>Set <var title="">switched</var> to true.</li>
+
+         <li><p>Jump back to the step labeled <i>step
+         loop</i>.</li>
+
+        </ol></dd>
+
        <dt>If <var title="">cue</var>'s <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is not set</dt>
-
        <dd>
 
-        <p class=XXX>position the box according to the given
-        position information, and then spiral around clockwise until
-        no overlap is found</p>
+        <ol><li>
 
-       </dd>
+          <p>Set up <var title="">x</var> and <var title="">y</var> as
+          follows:</p>
 
+          <dl class=switch><dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
+                  and <var title="">direction</var> is 'ltr'</dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <a href=#timed-track-cue-text-position>timed track cue text position</a>, and let <var title="">y</var> be a percentage given by the <a href=#timed-track-cue-line-position>timed
+            track cue line position</a>.</p>
+           </dd>
+
+           <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
+                  and <var title="">direction</var> is 'rtl'</dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <a href=#timed-track-cue-text-position>timed track cue text position</a> subtracted from
+            100, and let <var title="">y</var> be a percentage given
+            by the <a href=#timed-track-cue-line-position>timed track cue line position</a>.</p>
+           </dd>
+
+           <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-left-writing-direction title="timed track cue vertical growing left writing direction">vertical growing left</a></dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <a href=#timed-track-cue-line-position>timed track cue line position</a> subtracted from
+            100, and let <var title="">y</var> be a percentage given
+            by the <a href=#timed-track-cue-text-position>timed track cue text position</a>.</p>
+           </dd>
+
+           <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a></dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <a href=#timed-track-cue-line-position>timed track cue line position</a>, and let <var title="">y</var> be a percentage given by the <a href=#timed-track-cue-text-position>timed
+            track cue text position</a>.</p>
+           </dd>
+
+          </dl></li>
+
+         <li><p>Position the boxes in <var title="">boxes</var> such
+         that the point <var title="">x</var>% along the width of the
+         bounding box of the boxes in <var title="">boxes</var> is
+         <var title="">x</var>% of the way across the width of the
+         <var title="">video</var>'s rendering area, and the point
+         <var title="">y</var>% along the height of the bounding box
+         of the boxes in <var title="">boxes</var> is <var title="">y</var>% of the way across the height of the <var title="">video</var>'s rendering area, while maintaining the
+         relative positions of the boxes in <var title="">boxes</var>
+         to each other.</li>
+
+         <li><p>If none of the boxes in <var title="">boxes</var>
+         would overlap any of the boxes in <var title="">output</var>,
+         and all the boxes in <var title="">output</var> are within
+         the <var title="">video</var>'s rendering area, then jump to
+         the step labeled <i>done positioning</i> below.</li>
+
+         <li><p>If there is a position to which the boxes in <var title="">boxes</var> can be moved while maintaining the
+         relative positions of the boxes in <var title="">boxes</var>
+         to each other such that none of the boxes in <var title="">boxes</var> would overlap any of the boxes in <var title="">output</var>, and all the boxes in <var title="">output</var> would be within the <var title="">video</var>'s rendering area, then move the boxes in
+         <var title="">boxes</var> to the closest such position to
+         their current position, and then jump to the step labeled
+         <i>done positioning</i> below. If there are multiple such
+         positions that are equidistant from their current position,
+         use the highest one amongst them; if there are several at
+         that height, then use the leftmost one amongst them.</li>
+
+         <li><p>Otherwise, jump to the step labeled <i>done
+         positioning</i> below. (The boxes will unfortunately
+         overlap.)</li>
+
+        </ol></dd>
+
       </dl></li>
 
-     <li><p>If there are any line boxes in the (possibly now
-     repositioned) <var title="">boxes</var> that do not completely
-     fit inside <var title="">video</var>'s rendering area, remove
-     those offending line boxes from <var title="">boxes</var>.</li>
+     <li><p><i>Done positioning</i>: If there are any line boxes in
+     the (possibly now repositioned) <var title="">boxes</var> that do
+     not completely fit inside <var title="">video</var>'s rendering
+     area, remove those offending line boxes from <var title="">boxes</var>.</li>
 
      <li><p>Let <var title="">cue</var>'s <a href=#timed-track-cue-display-state>timed track cue
      display state</a> have the CSS boxes in <var title="">boxes</var>.</li>

Modified: index
===================================================================
--- index	2010-07-13 01:30:15 UTC (rev 5152)
+++ index	2010-07-13 08:19:18 UTC (rev 5153)
@@ -79713,7 +79713,6 @@
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-start-alignment title="timed track cue start alignment">start</a></dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-start-alignment title="timed track cue start alignment">start</a></dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> subtracted from 100.</p>
        </dd>
@@ -79728,7 +79727,6 @@
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-end-alignment title="timed track cue end alignment">end</a></dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-end-alignment title="timed track cue end alignment">end</a></dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a>.</p>
        </dd>
@@ -79747,7 +79745,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a>,
               and the <a href=#timed-track-cue-text-position>timed track cue text position</a> is less than or equal to 50</dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> multiplied by two.</p>
        </dd>
@@ -79766,7 +79763,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a>,
               and the <a href=#timed-track-cue-text-position>timed track cue text position</a> is greater than <!-- or equal to --> 50</dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the result of subtracting <a href=#timed-track-cue-text-position>timed track cue text position</a> from 100 and then multiplying the result by two.</p>
        </dd>
@@ -79795,7 +79791,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-end-alignment title="timed track cue end alignment">end</a>,
               and <var title="">direction</var> is 'rtl'</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a>.</p>
        </dd>
@@ -79806,7 +79801,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-start-alignment title="timed track cue start alignment">start</a>,
               and <var title="">direction</var> is 'rtl'</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> subtracted from 100.</p>
        </dd>
@@ -79815,7 +79809,6 @@
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-start-alignment title="timed track cue start alignment">start</a></dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-start-alignment title="timed track cue start alignment">start</a></dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a>.</p>
        </dd>
@@ -79824,7 +79817,6 @@
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-end-alignment title="timed track cue end alignment">end</a></dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-end-alignment title="timed track cue end alignment">end</a></dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> subtracted from 100.</p>
        </dd>
@@ -79832,7 +79824,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a>,
               and <var title="">direction</var> is 'ltr'</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> minus half of <var title="">size</var>.</p>
        </dd>
@@ -79840,7 +79831,6 @@
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a>,
               and <var title="">direction</var> is 'rtl'</dt>
-
        <dd>
         <p>Let <var title="">x-position-reverse</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> minus half of <var title="">size</var>.</p>
         <p>Let <var title="">x-position</var> be <var title="">x-position-reverse</var> subtracted from 100.</p>
@@ -79850,7 +79840,6 @@
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a></dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-alignment>timed track cue alignment</a> is <a href=#timed-track-cue-middle-alignment title="timed track cue middle alignment">middle</a></dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <a href=#timed-track-cue-text-position>timed track cue text position</a> minus half of <var title="">size</var>.</p>
        </dd>
@@ -79865,14 +79854,12 @@
 
       <dl class=switch><dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is set</dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be zero.</p>
        </dd>
 
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is not set</dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <a href=#timed-track-cue-line-position>timed track cue line position</a>.</p>
        </dd>
@@ -79881,7 +79868,6 @@
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is set</dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is set</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be zero.</p>
        </dd>
@@ -79890,7 +79876,6 @@
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is not set</dt>
        <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a>,
               and the <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is not set</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <a href=#timed-track-cue-line-position>timed track cue line position</a>.</p>
        </dd>
@@ -79953,6 +79938,9 @@
 
      </li>
 
+     <li><p>If there are no line boxes in <var title="">boxes</var>,
+     skip the remainder of these substeps for <var title="">cue</var>. The cue is ignored.</li>
+
      <li>
 
       <p>Adjust the positions of <var title="">boxes</var> according
@@ -79962,30 +79950,208 @@
 
        <dd>
 
-        <p class=XXX>determine the block-direction position of the
-        first line, then slide the line away from the reference edge
-        until it fits, or if that goes off the edge slide it in the
-        other direction; sliding must snap to multiples of the height
-        of the first line box.</p>
+        <p>Many of the steps in this algorithm vary according to the
+        <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a>. Steps labeled
+        "<strong>Horizontal</strong>" must be followed only when the
+        <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing
+        direction">horizontal</a>, steps labeled
+        "<strong>Vertical</strong>" must be followed when the
+        <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is either <a href=#timed-track-cue-vertical-growing-left-writing-direction title="timed track cue vertical growing left writing
+        direction">vertical growing left</a> or <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed
+        track cue vertical growing right writing direction">vertical
+        growing right</a>, steps labeled "<strong>Vertical Growing
+        Left</strong>" must be followed only when the <a href=#timed-track-cue-writing-direction>timed
+        track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-left-writing-direction title="timed track
+        cue vertical growing left writing direction">vertical growing
+        left</a>, and steps labeled "<strong>Vertical Growing
+        Right</strong>" must be followed only when the <a href=#timed-track-cue-writing-direction>timed
+        track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track
+        cue vertical growing right writing direction">vertical growing
+        right</a>.</p>
 
-       </dd>
+        <ol><li>
 
+          <p><strong>Horizontal</strong>: Let <var title="">step</var>
+          be the height of the first line box in <var title="">boxes</var>.</p>
+
+          <p><strong>Vertical</strong>: Let <var title="">step</var>
+          be the width of the first line box in <var title="">boxes</var>.</p>
+
+         </li>
+
+         <li><p>If <var title="">step</var> is zero, then jump to the
+         step labeled <i>done positioning</i> below.</li>
+
+         <li><p>Let <var title="">line position</var> be the
+         <a href=#timed-track-cue-line-position>timed track cue line position</a>.</li>
+
+         <li><p><strong>Vertical Growing Left</strong>: Add one to
+         <var title="">line position</var> then negate it.</li>
+
+         <li><p>Let <var title="">position</var> be the result of
+         multiplying <var title="">step</var> and <var title="">line
+         position</var>.</li>
+
+         <li><p><strong>Vertical Growing Left</strong>: Decrease <var title="">position</var> by the width of the bounding box of
+         the boxes in <var title="">boxes</var>, then increase <var title="">position</var> by <var title="">step</var>.</li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: If <var title="">line
+          position</var> is less than zero then increase <var title="">position</var> by the height of the <var title="">video</var>'s rendering area, and negate <var title="">step</var> (so its value is now minus the height of
+          the first line box in <var title="">boxes</var>).</p>
+
+          <p><strong>Vertical</strong>: If <var title="">line
+          position</var> is less than zero then increase <var title="">position</var> by the width of the <var title="">video</var>'s rendering area, and negate <var title="">step</var>.</p>
+
+         </li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: Move all the boxes in <var title="">boxes</var> down by the distance given by <var title="">position</var>.</p>
+
+          <p><strong>Vertical</strong>: Move all the boxes in <var title="">boxes</var> right by the distance given by <var title="">position</var>.</p>
+
+         </li>
+
+         <li><p><i>Default</i>: Remember the position of all the boxes in
+         <var title="">boxes</var> as their <var title="">default
+         position</var>.</li>
+
+         <li><p>Let <var title="">switched</var> be false.</li>
+
+         <li><p><i>Step loop</i>: If none of the boxes in <var title="">boxes</var> would overlap any of the boxes in <var title="">output</var>, and all the boxes in <var title="">output</var> are within the <var title="">video</var>'s rendering area, then jump to the step
+         labeled <i>done positioning</i> below.</li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: If <var title="">step</var>
+          is negative and the top of the first line box in <var title="">boxes</var> is now above the top of the <var title="">video</var>'s rendering area, or if <var title="">step</var> is positive and the bottom of the first
+          line box in <var title="">boxes</var> is now below the
+          bottom of the <var title="">video</var>'s rendering area,
+          jump to the step labeled <i>switch direction</i>.</p>
+
+          <p><strong>Vertical</strong>: If <var title="">step</var> is
+          negative and the left edge of the first line box in <var title="">boxes</var> is now to the left of the left edge of
+          the <var title="">video</var>'s rendering area, or if <var title="">step</var> is positive and the right edge of the
+          first line box in <var title="">boxes</var> is now to the
+          right of the right edge of the <var title="">video</var>'s
+          rendering area, jump to the step labeled <i>switch
+          direction</i>.</p>
+
+         </li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: Move all the boxes in <var title="">boxes</var> down by the distance given by <var title="">step</var>. (If <var title="">step</var> is
+          negative, then this will actually result in an upwards
+          movement of the boxes in absolute terms.)</p>
+
+          <p><strong>Vertical</strong>: Move all the boxes in <var title="">boxes</var> right by the distance given by <var title="">step</var>. (If <var title="">step</var> is
+          negative, then this will actually result in a leftwards
+          movement of the boxes in absolute terms.)</p>
+
+         </li>
+
+         <li><p>Jump back to the step labeled <i>step
+         loop</i>.</li>
+
+         <li><p><i>Switch direction</i>: Move all the boxes in <var title="">boxes</var> back to their <var title="">default
+         position</var> as determined in the step above labeled
+         <i>default</i>.</li>
+
+         <li><p>If <var title="">switched</var> is true, jump to the step
+         labeled <i>done positioning</i> below.</li>
+
+         <li><p>Negate <var title="">step</var>.</li>
+
+         <li><p>Set <var title="">switched</var> to true.</li>
+
+         <li><p>Jump back to the step labeled <i>step
+         loop</i>.</li>
+
+        </ol></dd>
+
        <dt>If <var title="">cue</var>'s <a href=#timed-track-cue-snap-to-lines-flag>timed track cue snap-to-lines flag</a> is not set</dt>
-
        <dd>
 
-        <p class=XXX>position the box according to the given
-        position information, and then spiral around clockwise until
-        no overlap is found</p>
+        <ol><li>
 
-       </dd>
+          <p>Set up <var title="">x</var> and <var title="">y</var> as
+          follows:</p>
 
+          <dl class=switch><dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
+                  and <var title="">direction</var> is 'ltr'</dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <a href=#timed-track-cue-text-position>timed track cue text position</a>, and let <var title="">y</var> be a percentage given by the <a href=#timed-track-cue-line-position>timed
+            track cue line position</a>.</p>
+           </dd>
+
+           <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-horizontal-writing-direction title="timed track cue horizontal writing direction">horizontal</a>,
+                  and <var title="">direction</var> is 'rtl'</dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <a href=#timed-track-cue-text-position>timed track cue text position</a> subtracted from
+            100, and let <var title="">y</var> be a percentage given
+            by the <a href=#timed-track-cue-line-position>timed track cue line position</a>.</p>
+           </dd>
+
+           <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-left-writing-direction title="timed track cue vertical growing left writing direction">vertical growing left</a></dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <a href=#timed-track-cue-line-position>timed track cue line position</a> subtracted from
+            100, and let <var title="">y</var> be a percentage given
+            by the <a href=#timed-track-cue-text-position>timed track cue text position</a>.</p>
+           </dd>
+
+           <dt>If the <a href=#timed-track-cue-writing-direction>timed track cue writing direction</a> is <a href=#timed-track-cue-vertical-growing-right-writing-direction title="timed track cue vertical growing right writing direction">vertical growing right</a></dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <a href=#timed-track-cue-line-position>timed track cue line position</a>, and let <var title="">y</var> be a percentage given by the <a href=#timed-track-cue-text-position>timed
+            track cue text position</a>.</p>
+           </dd>
+
+          </dl></li>
+
+         <li><p>Position the boxes in <var title="">boxes</var> such
+         that the point <var title="">x</var>% along the width of the
+         bounding box of the boxes in <var title="">boxes</var> is
+         <var title="">x</var>% of the way across the width of the
+         <var title="">video</var>'s rendering area, and the point
+         <var title="">y</var>% along the height of the bounding box
+         of the boxes in <var title="">boxes</var> is <var title="">y</var>% of the way across the height of the <var title="">video</var>'s rendering area, while maintaining the
+         relative positions of the boxes in <var title="">boxes</var>
+         to each other.</li>
+
+         <li><p>If none of the boxes in <var title="">boxes</var>
+         would overlap any of the boxes in <var title="">output</var>,
+         and all the boxes in <var title="">output</var> are within
+         the <var title="">video</var>'s rendering area, then jump to
+         the step labeled <i>done positioning</i> below.</li>
+
+         <li><p>If there is a position to which the boxes in <var title="">boxes</var> can be moved while maintaining the
+         relative positions of the boxes in <var title="">boxes</var>
+         to each other such that none of the boxes in <var title="">boxes</var> would overlap any of the boxes in <var title="">output</var>, and all the boxes in <var title="">output</var> would be within the <var title="">video</var>'s rendering area, then move the boxes in
+         <var title="">boxes</var> to the closest such position to
+         their current position, and then jump to the step labeled
+         <i>done positioning</i> below. If there are multiple such
+         positions that are equidistant from their current position,
+         use the highest one amongst them; if there are several at
+         that height, then use the leftmost one amongst them.</li>
+
+         <li><p>Otherwise, jump to the step labeled <i>done
+         positioning</i> below. (The boxes will unfortunately
+         overlap.)</li>
+
+        </ol></dd>
+
       </dl></li>
 
-     <li><p>If there are any line boxes in the (possibly now
-     repositioned) <var title="">boxes</var> that do not completely
-     fit inside <var title="">video</var>'s rendering area, remove
-     those offending line boxes from <var title="">boxes</var>.</li>
+     <li><p><i>Done positioning</i>: If there are any line boxes in
+     the (possibly now repositioned) <var title="">boxes</var> that do
+     not completely fit inside <var title="">video</var>'s rendering
+     area, remove those offending line boxes from <var title="">boxes</var>.</li>
 
      <li><p>Let <var title="">cue</var>'s <a href=#timed-track-cue-display-state>timed track cue
      display state</a> have the CSS boxes in <var title="">boxes</var>.</li>

Modified: source
===================================================================
--- source	2010-07-13 01:30:15 UTC (rev 5152)
+++ source	2010-07-13 08:19:18 UTC (rev 5153)
@@ -98649,7 +98649,6 @@
               and the <span>timed track cue alignment</span> is <span title="timed track cue start alignment">start</span></dt>
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing right writing direction">vertical growing right</span>,
               and the <span>timed track cue alignment</span> is <span title="timed track cue start alignment">start</span></dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the <span>timed track cue text position</span> subtracted from 100.</p>
        </dd>
@@ -98664,7 +98663,6 @@
               and the <span>timed track cue alignment</span> is <span title="timed track cue end alignment">end</span></dt>
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing right writing direction">vertical growing right</span>,
               and the <span>timed track cue alignment</span> is <span title="timed track cue end alignment">end</span></dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the <span>timed track cue text position</span>.</p>
        </dd>
@@ -98683,7 +98681,6 @@
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing right writing direction">vertical growing right</span>,
               the <span>timed track cue alignment</span> is <span title="timed track cue middle alignment">middle</span>,
               and the <span>timed track cue text position</span> is less than or equal to 50</dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the <span>timed track cue text position</span> multiplied by two.</p>
        </dd>
@@ -98702,7 +98699,6 @@
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing right writing direction">vertical growing right</span>,
               the <span>timed track cue alignment</span> is <span title="timed track cue middle alignment">middle</span>,
               and the <span>timed track cue text position</span> is greater than <!-- or equal to --> 50</dt>
-
        <dd>
         <p>Let <var title="">maximum size</var> be the result of subtracting <span>timed track cue text position</span> from 100 and then multiplying the result by two.</p>
        </dd>
@@ -98739,7 +98735,6 @@
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue horizontal writing direction">horizontal</span>,
               the <span>timed track cue alignment</span> is <span title="timed track cue end alignment">end</span>,
               and <var title="">direction</var> is 'rtl'</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <span>timed track cue text position</span>.</p>
        </dd>
@@ -98750,7 +98745,6 @@
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue horizontal writing direction">horizontal</span>,
               the <span>timed track cue alignment</span> is <span title="timed track cue start alignment">start</span>,
               and <var title="">direction</var> is 'rtl'</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <span>timed track cue text position</span> subtracted from 100.</p>
        </dd>
@@ -98759,7 +98753,6 @@
               and the <span>timed track cue alignment</span> is <span title="timed track cue start alignment">start</span></dt>
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing right writing direction">vertical growing right</span>,
               and the <span>timed track cue alignment</span> is <span title="timed track cue start alignment">start</span></dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <span>timed track cue text position</span>.</p>
        </dd>
@@ -98768,7 +98761,6 @@
               and the <span>timed track cue alignment</span> is <span title="timed track cue end alignment">end</span></dt>
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing right writing direction">vertical growing right</span>,
               and the <span>timed track cue alignment</span> is <span title="timed track cue end alignment">end</span></dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <span>timed track cue text position</span> subtracted from 100.</p>
        </dd>
@@ -98776,7 +98768,6 @@
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue horizontal writing direction">horizontal</span>,
               the <span>timed track cue alignment</span> is <span title="timed track cue middle alignment">middle</span>,
               and <var title="">direction</var> is 'ltr'</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <span>timed track cue text position</span> minus half of <var title="">size</var>.</p>
        </dd>
@@ -98784,7 +98775,6 @@
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue horizontal writing direction">horizontal</span>,
               the <span>timed track cue alignment</span> is <span title="timed track cue middle alignment">middle</span>,
               and <var title="">direction</var> is 'rtl'</dt>
-
        <dd>
         <p>Let <var title="">x-position-reverse</var> be the <span>timed track cue text position</span> minus half of <var title="">size</var>.</p>
         <p>Let <var title="">x-position</var> be <var title="">x-position-reverse</var> subtracted from 100.</p>
@@ -98794,7 +98784,6 @@
               and the <span>timed track cue alignment</span> is <span title="timed track cue middle alignment">middle</span></dt>
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing right writing direction">vertical growing right</span>,
               and the <span>timed track cue alignment</span> is <span title="timed track cue middle alignment">middle</span></dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <span>timed track cue text position</span> minus half of <var title="">size</var>.</p>
        </dd>
@@ -98814,14 +98803,12 @@
 
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue horizontal writing direction">horizontal</span>,
               and the <span>timed track cue snap-to-lines flag</span> is set</dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be zero.</p>
        </dd>
 
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue horizontal writing direction">horizontal</span>,
               and the <span>timed track cue snap-to-lines flag</span> is not set</dt>
-
        <dd>
         <p>Let <var title="">y-position</var> be the <span>timed track cue line position</span>.</p>
        </dd>
@@ -98830,7 +98817,6 @@
               and the <span>timed track cue snap-to-lines flag</span> is set</dt>
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing right writing direction">vertical growing right</span>,
               and the <span>timed track cue snap-to-lines flag</span> is set</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be zero.</p>
        </dd>
@@ -98839,7 +98825,6 @@
               and the <span>timed track cue snap-to-lines flag</span> is not set</dt>
        <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing right writing direction">vertical growing right</span>,
               and the <span>timed track cue snap-to-lines flag</span> is not set</dt>
-
        <dd>
         <p>Let <var title="">x-position</var> be the <span>timed track cue line position</span>.</p>
        </dd>
@@ -98913,6 +98898,10 @@
 
      </li>
 
+     <li><p>If there are no line boxes in <var title="">boxes</var>,
+     skip the remainder of these substeps for <var
+     title="">cue</var>. The cue is ignored.</p></li>
+
      <li>
 
       <p>Adjust the positions of <var title="">boxes</var> according
@@ -98924,32 +98913,261 @@
 
        <dd>
 
-        <p class="XXX">determine the block-direction position of the
-        first line, then slide the line away from the reference edge
-        until it fits, or if that goes off the edge slide it in the
-        other direction; sliding must snap to multiples of the height
-        of the first line box.</p>
+        <p>Many of the steps in this algorithm vary according to the
+        <span>timed track cue writing direction</span>. Steps labeled
+        "<strong>Horizontal</strong>" must be followed only when the
+        <span>timed track cue writing direction</span> is <span
+        title="timed track cue horizontal writing
+        direction">horizontal</span>, steps labeled
+        "<strong>Vertical</strong>" must be followed when the
+        <span>timed track cue writing direction</span> is either <span
+        title="timed track cue vertical growing left writing
+        direction">vertical growing left</span> or <span title="timed
+        track cue vertical growing right writing direction">vertical
+        growing right</span>, steps labeled "<strong>Vertical Growing
+        Left</strong>" must be followed only when the <span>timed
+        track cue writing direction</span> is <span title="timed track
+        cue vertical growing left writing direction">vertical growing
+        left</span>, and steps labeled "<strong>Vertical Growing
+        Right</strong>" must be followed only when the <span>timed
+        track cue writing direction</span> is <span title="timed track
+        cue vertical growing right writing direction">vertical growing
+        right</span>.</p>
 
+        <ol>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: Let <var title="">step</var>
+          be the height of the first line box in <var
+          title="">boxes</var>.</p>
+
+          <p><strong>Vertical</strong>: Let <var title="">step</var>
+          be the width of the first line box in <var
+          title="">boxes</var>.</p>
+
+         </li>
+
+         <li><p>If <var title="">step</var> is zero, then jump to the
+         step labeled <i>done positioning</i> below.</p></li>
+
+         <li><p>Let <var title="">line position</var> be the
+         <span>timed track cue line position</span>.</p></li>
+
+         <li><p><strong>Vertical Growing Left</strong>: Add one to
+         <var title="">line position</var> then negate it.</p></li>
+
+         <li><p>Let <var title="">position</var> be the result of
+         multiplying <var title="">step</var> and <var title="">line
+         position</var>.</p></li>
+
+         <li><p><strong>Vertical Growing Left</strong>: Decrease <var
+         title="">position</var> by the width of the bounding box of
+         the boxes in <var title="">boxes</var>, then increase <var
+         title="">position</var> by <var title="">step</var>.</p></li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: If <var title="">line
+          position</var> is less than zero then increase <var
+          title="">position</var> by the height of the <var
+          title="">video</var>'s rendering area, and negate <var
+          title="">step</var> (so its value is now minus the height of
+          the first line box in <var title="">boxes</var>).</p>
+
+          <p><strong>Vertical</strong>: If <var title="">line
+          position</var> is less than zero then increase <var
+          title="">position</var> by the width of the <var
+          title="">video</var>'s rendering area, and negate <var
+          title="">step</var>.</p>
+
+         </li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: Move all the boxes in <var
+          title="">boxes</var> down by the distance given by <var
+          title="">position</var>.</p>
+
+          <p><strong>Vertical</strong>: Move all the boxes in <var
+          title="">boxes</var> right by the distance given by <var
+          title="">position</var>.</p>
+
+         </li>
+
+         <li><p><i>Default</i>: Remember the position of all the boxes in
+         <var title="">boxes</var> as their <var title="">default
+         position</var>.</p></li>
+
+         <li><p>Let <var title="">switched</var> be false.</p></li>
+
+         <li><p><i>Step loop</i>: If none of the boxes in <var
+         title="">boxes</var> would overlap any of the boxes in <var
+         title="">output</var>, and all the boxes in <var
+         title="">output</var> are within the <var
+         title="">video</var>'s rendering area, then jump to the step
+         labeled <i>done positioning</i> below.</p></li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: If <var title="">step</var>
+          is negative and the top of the first line box in <var
+          title="">boxes</var> is now above the top of the <var
+          title="">video</var>'s rendering area, or if <var
+          title="">step</var> is positive and the bottom of the first
+          line box in <var title="">boxes</var> is now below the
+          bottom of the <var title="">video</var>'s rendering area,
+          jump to the step labeled <i>switch direction</i>.</p>
+
+          <p><strong>Vertical</strong>: If <var title="">step</var> is
+          negative and the left edge of the first line box in <var
+          title="">boxes</var> is now to the left of the left edge of
+          the <var title="">video</var>'s rendering area, or if <var
+          title="">step</var> is positive and the right edge of the
+          first line box in <var title="">boxes</var> is now to the
+          right of the right edge of the <var title="">video</var>'s
+          rendering area, jump to the step labeled <i>switch
+          direction</i>.</p>
+
+         </li>
+
+         <li>
+
+          <p><strong>Horizontal</strong>: Move all the boxes in <var
+          title="">boxes</var> down by the distance given by <var
+          title="">step</var>. (If <var title="">step</var> is
+          negative, then this will actually result in an upwards
+          movement of the boxes in absolute terms.)</p>
+
+          <p><strong>Vertical</strong>: Move all the boxes in <var
+          title="">boxes</var> right by the distance given by <var
+          title="">step</var>. (If <var title="">step</var> is
+          negative, then this will actually result in a leftwards
+          movement of the boxes in absolute terms.)</p>
+
+         </li>
+
+         <li><p>Jump back to the step labeled <i>step
+         loop</i>.</p></li>
+
+         <li><p><i>Switch direction</i>: Move all the boxes in <var
+         title="">boxes</var> back to their <var title="">default
+         position</var> as determined in the step above labeled
+         <i>default</i>.</p></li>
+
+         <li><p>If <var title="">switched</var> is true, jump to the step
+         labeled <i>done positioning</i> below.</p></li>
+
+         <li><p>Negate <var title="">step</var>.</p></li>
+
+         <li><p>Set <var title="">switched</var> to true.</p></li>
+
+         <li><p>Jump back to the step labeled <i>step
+         loop</i>.</p></li>
+
+        </ol>
+
        </dd>
 
        <dt>If <var title="">cue</var>'s <span>timed track cue snap-to-lines flag</span> is not set</dt>
-
        <dd>
 
-        <p class="XXX">position the box according to the given
-        position information, and then spiral around clockwise until
-        no overlap is found</p>
+        <ol>
 
+         <li>
+
+          <p>Set up <var title="">x</var> and <var title="">y</var> as
+          follows:</p>
+
+          <dl class="switch">
+
+           <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue horizontal writing direction">horizontal</span>,
+                  and <var title="">direction</var> is 'ltr'</dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <span>timed track cue text position</span>, and let <var
+            title="">y</var> be a percentage given by the <span>timed
+            track cue line position</span>.</p>
+           </dd>
+
+           <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue horizontal writing direction">horizontal</span>,
+                  and <var title="">direction</var> is 'rtl'</dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <span>timed track cue text position</span> subtracted from
+            100, and let <var title="">y</var> be a percentage given
+            by the <span>timed track cue line position</span>.</p>
+           </dd>
+
+           <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing left writing direction">vertical growing left</span></dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <span>timed track cue line position</span> subtracted from
+            100, and let <var title="">y</var> be a percentage given
+            by the <span>timed track cue text position</span>.</p>
+           </dd>
+
+           <dt>If the <span>timed track cue writing direction</span> is <span title="timed track cue vertical growing right writing direction">vertical growing right</span></dt>
+           <dd>
+            <p>Let <var title="">x</var> be a percentage given by the
+            <span>timed track cue line position</span>, and let <var
+            title="">y</var> be a percentage given by the <span>timed
+            track cue text position</span>.</p>
+           </dd>
+
+          </dl>
+
+         </li>
+
+         <li><p>Position the boxes in <var title="">boxes</var> such
+         that the point <var title="">x</var>% along the width of the
+         bounding box of the boxes in <var title="">boxes</var> is
+         <var title="">x</var>% of the way across the width of the
+         <var title="">video</var>'s rendering area, and the point
+         <var title="">y</var>% along the height of the bounding box
+         of the boxes in <var title="">boxes</var> is <var
+         title="">y</var>% of the way across the height of the <var
+         title="">video</var>'s rendering area, while maintaining the
+         relative positions of the boxes in <var title="">boxes</var>
+         to each other.</p></li>
+
+         <li><p>If none of the boxes in <var title="">boxes</var>
+         would overlap any of the boxes in <var title="">output</var>,
+         and all the boxes in <var title="">output</var> are within
+         the <var title="">video</var>'s rendering area, then jump to
+         the step labeled <i>done positioning</i> below.</p></li>
+
+         <li><p>If there is a position to which the boxes in <var
+         title="">boxes</var> can be moved while maintaining the
+         relative positions of the boxes in <var title="">boxes</var>
+         to each other such that none of the boxes in <var
+         title="">boxes</var> would overlap any of the boxes in <var
+         title="">output</var>, and all the boxes in <var
+         title="">output</var> would be within the <var
+         title="">video</var>'s rendering area, then move the boxes in
+         <var title="">boxes</var> to the closest such position to
+         their current position, and then jump to the step labeled
+         <i>done positioning</i> below. If there are multiple such
+         positions that are equidistant from their current position,
+         use the highest one amongst them; if there are several at
+         that height, then use the leftmost one amongst them.</p></li>
+
+         <li><p>Otherwise, jump to the step labeled <i>done
+         positioning</i> below. (The boxes will unfortunately
+         overlap.)</p></li>
+
+        </ol>
+
        </dd>
 
       </dl>
 
      </li>
 
-     <li><p>If there are any line boxes in the (possibly now
-     repositioned) <var title="">boxes</var> that do not completely
-     fit inside <var title="">video</var>'s rendering area, remove
-     those offending line boxes from <var
+     <li><p><i>Done positioning</i>: If there are any line boxes in
+     the (possibly now repositioned) <var title="">boxes</var> that do
+     not completely fit inside <var title="">video</var>'s rendering
+     area, remove those offending line boxes from <var
      title="">boxes</var>.</p></li>
 
      <li><p>Let <var title="">cue</var>'s <span>timed track cue




More information about the Commit-Watchers mailing list