<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>23404</bug_id>
          
          <creation_ts>2013-10-01 02:30:14 +0000</creation_ts>
          <short_desc>Redesign cue box position settings</short_desc>
          <delta_ts>2014-02-13 07:51:31 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>TextTracks CG</product>
          <component>WebVTT</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>v1</status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Silvia Pfeiffer">silviapfeiffer1</reporter>
          <assigned_to name="Silvia Pfeiffer">silviapfeiffer1</assigned_to>
          <cc>lorettaguarino</cc>
    
    <cc>mike</cc>
    
    <cc>philipj</cc>
    
    <cc>public-texttracks</cc>
    
    <cc>rick.eyre</cc>
          
          <qa_contact name="This bug has no owner yet - up for the taking">dave.null</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94057</commentid>
    <comment_count>0</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-10-01 02:30:14 +0000</bug_when>
    <thetext>In bug 20037 we&apos;ve redesigned text position settings.

This bug is about the &quot;line&quot; cue setting.

&quot;line&quot; settings position lines of text off the top of the video. With snap-to-lines set (i.e. non-percentage values) the video viewport is divided into lines and the positioning is by line number.

With percentage, users expect 0% to refer to the top of the cue box, 50% refer to the center of the cue box, and 100% refer to the bottom of the cue box.

Right now the rendering algorithm does so by positioning the x% point of the cue box at x% of the video viewport&apos;s height (for horizontal cues; width for vertical cues).

However, this leads to hard to authoring content, e.g. to position the top of a cue box exactly 20% down the video viewport, an author needs to make complicated calculations to determine the &quot;line&quot; value that position equates to.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94058</commentid>
    <comment_count>1</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-10-01 02:30:51 +0000</bug_when>
    <thetext>Proposal:

In addition to having line:x% specified, we also need to specify what end of the cue box the line position refers to.

I&apos;m therefore suggesting introduction of a box-align setting to contain &quot;top&quot;, &quot;middle&quot; and &quot;bottom&quot; as values. I&apos;m not sure about the name of the setting yet. Suggestions welcome.

We could also extend the meaning of &quot;align&quot; to become a double value setting, something like &quot;align:middle,top&quot; to mean:
* main direction: middle align
* cross direction: top align

Main direction being horizontal by default and vertical if the cue has a &quot;vertical&quot; cue setting; cross direction being the other direction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94063</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-10-01 08:21:52 +0000</bug_when>
    <thetext>Would the order matter? It would have to for align:start,end to mean something...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94159</commentid>
    <comment_count>3</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-10-02 07:49:46 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #2)
&gt; Would the order matter? It would have to for align:start,end to mean
&gt; something...

Yes it would.

After looking at bug 20037 yesterday, I further thought that maybe we should leave &quot;align&quot; to represent the text-align withing the box, and then have a new cue-align property to do the position/line alignments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94359</commentid>
    <comment_count>4</comment_count>
    <who name="Loretta Guarino Reid">lorettaguarino</who>
    <bug_when>2013-10-05 00:38:55 +0000</bug_when>
    <thetext>I like the proposal in https://www.w3.org/Bugs/Public/show_bug.cgi?id=20037#c57, which would allow a top/middle/bottom value to be specified with the line percentage, to indicate which anchor position is being specified.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95650</commentid>
    <comment_count>5</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-11-01 00:23:31 +0000</bug_when>
    <thetext>Spec proposal:

Keep align for text alignment and add a second value (comma-separated) each to &quot;position&quot; and &quot;line&quot; (for percentage-values of line), which signifies the cue alignment.

E.g. position:20%,left line:30%,top .

Default would be the way in which background-position works currently, which is backwards compatible.

Values would be: left, middle, right, top, bottom.
Possibly also: auto</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95659</commentid>
    <comment_count>6</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-11-01 08:59:11 +0000</bug_when>
    <thetext>What would the DOM API look like? Having to read and write the comma-separated values as strings wouldn&apos;t be awesome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95732</commentid>
    <comment_count>7</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-11-02 21:08:48 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #6)
&gt; What would the DOM API look like? Having to read and write the
&gt; comma-separated values as strings wouldn&apos;t be awesome.

Good point. Maybe two new fields called positionAlign and lineAlign?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95733</commentid>
    <comment_count>8</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-11-02 22:41:15 +0000</bug_when>
    <thetext>(In reply to Silvia Pfeiffer from comment #7)
&gt; (In reply to Philip Jägenstedt from comment #6)
&gt; &gt; What would the DOM API look like? Having to read and write the
&gt; &gt; comma-separated values as strings wouldn&apos;t be awesome.
&gt; 
&gt; Good point. Maybe two new fields called positionAlign and lineAlign?

Do you mean a comma-separated value in the file format but two (or three?) properties in the DOM API? That doesn&apos;t sound ideal, TBH.

Given that there&apos;s both horizontal and vertical alignment, wouldn&apos;t there need to be positionHorizontalAlign and positionVerticalAlign, or is the idea that one can only pick one dimension?

The initial comment in this bug only argues for the need for line alignment, are we sure that position alignment is currently hard enough to warrant more settings? Left, center and right alignment is already easy (0%, 50%, 100%), is something like &quot;make this box 50% of the video width with its left edge inset 20% into the video&quot;.

I suppose I should ask the same about line positioning. I don&apos;t dispute that it&apos;s hard to do exact positioning right now, but are we sure that&apos;s a problem for authors?

(Playing the devil&apos;s advocate here so we don&apos;t complicate things prematurely.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95737</commentid>
    <comment_count>9</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-11-03 09:13:50 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #8)
&gt; 
&gt; Do you mean a comma-separated value in the file format but two (or three?)
&gt; properties in the DOM API? That doesn&apos;t sound ideal, TBH.

Yes, I was thinking that. Similar to how CSS sometimes has aggregate values, but individual DOM style attributes for it, e.g. background and backgroundColor. 

&gt; 
&gt; Given that there&apos;s both horizontal and vertical alignment, wouldn&apos;t there
&gt; need to be positionHorizontalAlign and positionVerticalAlign, or is the idea
&gt; that one can only pick one dimension?

Every cue has only one dimension, i.e. either horizontal (the default) or vertical (through the &quot;vertical&quot; cue setting). The &quot;position&quot; cue setting goes with the main dimension (i.e. horizontal by default), while the &quot;line&quot; cue setting goes with the orthogonal dimension (i.e. vertical by default). Thus, there is positionAlign and lineAlign - no need for Horizonal/Vertical on position.


&gt; The initial comment in this bug only argues for the need for line alignment,
&gt; are we sure that position alignment is currently hard enough to warrant more
&gt; settings? Left, center and right alignment is already easy (0%, 50%, 100%),
&gt; is something like &quot;make this box 50% of the video width with its left edge
&gt; inset 20% into the video&quot;.

There&apos;s a difference between the alignment of the box into which the text is rendered and the alignment of the text inside the box for &quot;position&quot;. For the &quot;line&quot; direction we only care about the box alignment. We need to care about that for the &quot;position&quot; direction too.


&gt; I suppose I should ask the same about line positioning. I don&apos;t dispute that
&gt; it&apos;s hard to do exact positioning right now, but are we sure that&apos;s a
&gt; problem for authors?
&gt; 
&gt; (Playing the devil&apos;s advocate here so we don&apos;t complicate things
&gt; prematurely.)

It&apos;s a big problem for authors, because it&apos;s not possible to position cues accurately, e.g. if you want middle aligned text in a box that is left aligned at, say, 20%. I know Loretta has several more examples.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95742</commentid>
    <comment_count>10</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-11-03 22:36:29 +0000</bug_when>
    <thetext>To be clear what this means, here are some examples:

Cue setting: align:end
implies: position:100%,right
Also: line:-1 unless changed by overlap avoidance

Cue setting: align:start
implies: position:0%,left
Also: line:-1 unless changed by overlap avoidance

Cue setting: align:middle
implies: position:50%,middle
Also: line:-1 unless changed by overlap avoidance

Cue setting: line:20%
implies: line:20%,top
i.e. the top of the box is at the 20% mark - this is backwards compatible.

Cue setting: line:100%,bottom
This allows authors to specify cues to always sit at the bottom of the video viewport (e.g. even if a cue gets broken into muliple lines.)


Here&apos;s where we need to make a decision:

Cue setting: align:middle position:20%
implies: position:20%,auto

Now, how do we interpret &quot;auto&quot;?

Here are some options:
1.) &quot;auto&quot; follows &quot;align&quot; - in this case: &quot;middle&quot; - (and is by default &quot;middle&quot;) -&gt; this would be backwards compatible with the previous spec
2.) &quot;auto&quot; positions the 20% mark of the cue box at the 20% mark of the video viewport -&gt; I proposed this earlier, but am not a fan of it any longer.
3.) &quot;auto&quot; is always &quot;left&quot; -&gt; this is compatible with how the &quot;line&quot; cue setting also always interprets the percentage as a percentage offset from the top of the video


I&apos;m inclined to pick 3.) and not have an &quot;auto&quot; value. While this breaks backwards compatibility in the few cases where authors have used &quot;align:{middle,end}&quot; with &quot;position&quot;, I like that it makes &quot;line&quot; and &quot;position&quot; work the same.

Opinions?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95748</commentid>
    <comment_count>11</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-11-04 02:44:43 +0000</bug_when>
    <thetext>As it turns out - I can do 1.) easily.

I just started by patching the data model and introducing an examle, see
https://dvcs.w3.org/hg/text-tracks/rev/74c7166d0199
and
https://dvcs.w3.org/hg/text-tracks/raw-file/default/webvtt/webvtt.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95749</commentid>
    <comment_count>12</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-11-04 02:48:17 +0000</bug_when>
    <thetext>Sorry, had to fix the example to use the actual values I defined:
start - for alignment to either left or top of the cue box
middle - for center alignment
end - for alignment to either right or bottom

See: https://dvcs.w3.org/hg/text-tracks/rev/1760787c4037</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95755</commentid>
    <comment_count>13</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-11-04 08:13:58 +0000</bug_when>
    <thetext>(In reply to Silvia Pfeiffer from comment #9)
&gt; (In reply to Philip Jägenstedt from comment #8)
&gt; &gt; 
&gt; &gt; Do you mean a comma-separated value in the file format but two (or three?)
&gt; &gt; properties in the DOM API? That doesn&apos;t sound ideal, TBH.
&gt; 
&gt; Yes, I was thinking that. Similar to how CSS sometimes has aggregate values,
&gt; but individual DOM style attributes for it, e.g. background and
&gt; backgroundColor. 

Well, except that a CSS shorthand foo usually expand to two or more foo-bar/baz properties, not foo and foo-bar which is the case here. I guess it still works, though.

&gt; &gt; Given that there&apos;s both horizontal and vertical alignment, wouldn&apos;t there
&gt; &gt; need to be positionHorizontalAlign and positionVerticalAlign, or is the idea
&gt; &gt; that one can only pick one dimension?
&gt; 
&gt; Every cue has only one dimension, i.e. either horizontal (the default) or
&gt; vertical (through the &quot;vertical&quot; cue setting). The &quot;position&quot; cue setting
&gt; goes with the main dimension (i.e. horizontal by default), while the &quot;line&quot;
&gt; cue setting goes with the orthogonal dimension (i.e. vertical by default).
&gt; Thus, there is positionAlign and lineAlign - no need for Horizonal/Vertical
&gt; on position.

Oh, right :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95756</commentid>
    <comment_count>14</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-11-04 08:25:47 +0000</bug_when>
    <thetext>So it looks like &quot;text track cue position alignment&quot; is the new concept introduced by this change, but it looks like it doesn&apos;t actually do anything?

Assuming that the default behavior of position:20% with no specified alignment is still aligning the 20% mark of the cue box with the 20% mark of the video, what is position:20%,middle supposed to do? Is it just to align the 50% mark of the cue box with the 20% mark of the video? I don&apos;t think that maps to anything (simple) in CSS, is it really useful?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95759</commentid>
    <comment_count>15</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-11-04 12:25:19 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #14)
&gt; So it looks like &quot;text track cue position alignment&quot; is the new concept
&gt; introduced by this change,

Yes, and also line position alignment.


&gt; but it looks like it doesn&apos;t actually do anything?

I haven&apos;t written the syntax and parsing part yet.

 
&gt; Assuming that the default behavior of position:20% with no specified
&gt; alignment is still aligning the 20% mark of the cue box with the 20% mark of
&gt; the video,

No, that&apos;s not the default behavior actually (not in the old spec either - I actually had to check that today). The default behavior of position:20% is to align the center of the cue text (because the text is by default align:middle) with the 20% mark of the video.

&gt; what is position:20%,middle supposed to do? Is it just to align
&gt; the 50% mark of the cue box with the 20% mark of the video?

Yes, and that&apos;s identical to what is currently implemented in webkit &amp; blink.

&gt; I don&apos;t think
&gt; that maps to anything (simple) in CSS, is it really useful?

It&apos;s simple in CSS, because all you need is to calculate the left offset by using the size of the cue box.

Apart from providing backwards compatible, it&apos;s also useful for when you have a person on the left and you want to center text underneath that person (say: at the 20% mark of video width).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95762</commentid>
    <comment_count>16</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-11-04 13:49:53 +0000</bug_when>
    <thetext>I seem to misremember how things used to work, but testing in Opera (Presto) indeed shows that position:1% tries to fit a cue into a tiny column at the left edge, which wouldn&apos;t be the case if positioning worked the way I thought it did.

Will there be an align value which makes things work the way I thought they already did?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95781</commentid>
    <comment_count>17</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-11-05 01:10:54 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #16)
&gt;
&gt; Will there be an align value which makes things work the way I thought they
&gt; already did?

You mean 2.) in https://www.w3.org/Bugs/Public/show_bug.cgi?id=23404#c10 ?

While that&apos;s what I considered doing first, I don&apos;t actually think it&apos;s that useful in practice. Do you have a use case that is not covered by start, middle or end alignment of the cue box to the position value?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95790</commentid>
    <comment_count>18</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-11-05 07:46:25 +0000</bug_when>
    <thetext>(In reply to Silvia Pfeiffer from comment #17)
&gt; (In reply to Philip Jägenstedt from comment #16)
&gt; &gt;
&gt; &gt; Will there be an align value which makes things work the way I thought they
&gt; &gt; already did?
&gt; 
&gt; You mean 2.) in https://www.w3.org/Bugs/Public/show_bug.cgi?id=23404#c10 ?
&gt; 
&gt; While that&apos;s what I considered doing first, I don&apos;t actually think it&apos;s that
&gt; useful in practice. Do you have a use case that is not covered by start,
&gt; middle or end alignment of the cue box to the position value?

At first I thought it should make right-aligning a box of size 50% easier, but only if it was the default so that &quot;size:50% position:100%&quot; would have that effect. If it&apos;s not the default and additional settings are needed, then &quot;size:50% position:100%,right&quot; works just fine I think, no need for an additional mode.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95835</commentid>
    <comment_count>19</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2013-11-06 03:04:17 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #18)
&gt;
&gt; At first I thought it should make right-aligning a box of size 50% easier,
&gt; but only if it was the default so that &quot;size:50% position:100%&quot; would have
&gt; that effect. If it&apos;s not the default and additional settings are needed,
&gt; then &quot;size:50% position:100%,right&quot; works just fine I think, no need for an
&gt; additional mode.

Yes, that would be it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95850</commentid>
    <comment_count>20</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2013-11-06 09:43:47 +0000</bug_when>
    <thetext>OK, please go forth and spec what you think is good, and I&apos;ll complain later if I&apos;ve misunderstood something :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100468</commentid>
    <comment_count>21</comment_count>
    <who name="Silvia Pfeiffer">silviapfeiffer1</who>
    <bug_when>2014-02-13 07:51:31 +0000</bug_when>
    <thetext>The following patches introduced a new line positioning mechanism:

Examples:
https://dvcs.w3.org/hg/text-tracks/rev/74c7166d0199

Syntax:
https://dvcs.w3.org/hg/text-tracks/rev/cf22782db631

Parsing:
https://dvcs.w3.org/hg/text-tracks/rev/886e55d6a733
https://dvcs.w3.org/hg/text-tracks/rev/cc5c4041bc4e

VTTCue API:
https://dvcs.w3.org/hg/text-tracks/rev/7db213a21a17

Rendering:
https://dvcs.w3.org/hg/text-tracks/rev/06fb21f577f4

Further changes to the rendering section are being discussed on list.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>