This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 14575 - <track> Spec is confused about which edge the text position starts from
Summary: <track> Spec is confused about which edge the text position starts from
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 blocker
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-27 15:34 UTC by contributor
Modified: 2012-07-18 18:39 UTC (History)
5 users (show)

See Also:


Attachments

Description contributor 2011-10-27 15:34:42 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html
Multipage: http://www.whatwg.org/C#webvtt-cue-text-rendering-rules
Complete: http://www.whatwg.org/c#webvtt-cue-text-rendering-rules

Comment:
The computed x-position should use the computed size when aligning - not 100

Posted from: 2001:4c28:a030:30:72f3:95ff:fe00:4501
User agent: Opera/9.80 (X11; Linux x86_64; U; sv) Presto/2.9.168 Version/11.51
Comment 1 Fredrik S 2011-10-27 15:42:09 UTC
Section 15.4.2.1, step 10.8:

"If the text track cue writing direction is horizontal, the text track cue  alignment is end, and direction is 'ltr'
...

Let x-position be the text track cue text position subtracted from 100."

Considering an example with text position 75, size 100, alignment 'end', writing direction 'horizontal' and direction 'ltr':

Step 5 computes 'maximum size' as 75.
Step 6 computes 'size' as 75.
Step 8 computes 'x-position' as 100 - 75 = 25

---

I would've expected 'x-position' to be computed to 0 - i.e, 'text position' - 'size' - which seems more in line with for instance the handling of 'middle'.
Comment 2 Ian 'Hixie' Hickson 2011-11-01 16:43:32 UTC
The position always overrides the size. As far as I can tell, this is acting as expected.
Comment 3 Fredrik S 2011-11-01 17:36:25 UTC
(In reply to comment #2)
> The position always overrides the size. As far as I can tell, this is acting as
> expected.

So the position should be considered from the right edge? That feels a bit unintuitive for LTR text.

I also note that the syntax section of the spec has a note:

"The WebVTT text position cue setting is given as a percentage, calculated from the edge of the frame that the text begins (so for left-to-right English text, the left edge)."

Which in a way indicates that positions should be considered from the left for LTR text.
Comment 4 Ian 'Hixie' Hickson 2011-11-02 21:00:33 UTC
Hm, well, clearly if the spec contradicts itself _something_ is wrong!

The intent was to have the position start from the alignment edge, which is why text with end alignment that is ltr starts from the right, and vice versa.

I'll fix the note to be more precise.
Comment 5 Fredrik S 2011-11-04 11:44:58 UTC
A related thing that sprung to mind... If the position starts from the alignment edge - will that position align with the same "alignment edge" on the cue box? I.e, using the same example (values) would the right edge or the left edge of the cue box be at 25? This would seem to impact the max-size calculation.

Something like: |<--+            | vs. |   +----------->|

('+' is the position)

The current spec text has it as on the right above IIUC.

This may be the intended behavior too, just thought I'd point it out... and show that I find it confusing, so wouldn't mind additional text about it. Non-normative would be fine.
Comment 6 Ian 'Hixie' Hickson 2012-01-30 20:44:59 UTC
> will that position align with the same "alignment edge" on the cue box? 

I am not sure what you mean here.
Comment 7 Fredrik S 2012-01-31 08:00:48 UTC
(In reply to comment #6)
> > will that position align with the same "alignment edge" on the cue box? 
> 
> I am not sure what you mean here.

I think (it's been a while) that this was about whether the computed position would be the start-edge or the end-edge of the box - i.e, in the (ltr) example used previously, would the start-edge (the left edge) be at the computed (x-)position, or would the end-edge (the right edge) - because of the end alignment.

Another way to put it may be:

"pos" is computed position,
"." is outside cue box,
"-" is inside cue box,
[] is viewport edge,
| is cue edge.

dir:ltr, pos:25, align:start ->
start-edge at 25, text "grows" to the right : [...|Text--------]

dir:ltr, pos:25, align:end ->
start-edge at 25, text "grows" to the right : [...|--------Text]

OR

dir:ltr, pos:25, align:end ->
end-edge at 25, text starts at start-edge (25-size) and "grows" to the right : 
|--------T[ext|...........]

Better? Worse?
Comment 8 Ian 'Hixie' Hickson 2012-04-19 22:51:28 UTC
So I looked at this more closely, and you are right that the algorithm was wrong. The note was right. The idea is that the position gives the alignment edge, relative to the 'start' side of the video. (Start side as in left side for for ltr text, right side for rtl text.) And 'x-position' in the algorithm is always from the left side.

So text position 75, size 100, alignment 'end', writing direction 'horizontal' and direction 'ltr' should render as a 75%-wide box that goes from left:0 to left:75%, with text right-aligned in that box.
Comment 9 contributor 2012-04-19 22:54:28 UTC
Checked in as WHATWG revision r7059.
Check-in comment: fix the alignment of end-aligned text cues
http://html5.org/tools/web-apps-tracker?from=7058&to=7059