How (horizontal) cue positioning works, or used to

Hi all,

There was a question off-list that I think is worth clarifying
on-list. This is how cue positioning used to work, for horizontal
left-to-right text, at the time it was implemented in Presto, which
also matches the current Blink/WebKit behavior:

There are three settings that control the position and size of the cue
in the horizontal direction: position, size and align.

The position is a point between the left edge (0%) and the right edge
(100%) at which the cue is anchored.

The cue extends from the anchor point in a different direction
depending on the alignment:
 * align:left means that the text begins at the anchor point and
extends to the right of it.
 * align:middle means that the text is centered at the anchor points
and extends to both sides.
 * align:right means that the text ends at the anchor point and
extends to the left of it.

Finally, size limits the width of the cue, so that you can for example
have a left-aligned cue that will never extend into the right half of
the screen by using position:0% size:50% align:left. If the size is
too large, the largest possible size is used instead.

The defaults are position:50% size:100% align:middle

Here's an image I made long ago illustrating this:
http://people.opera.com/philipj/2012/08/webvtt/position-opera-next.png

While this model allows full flexibility in positioning the cue box
and the cue text within it, it has a problem: because position:50% is
the default just using align:left will not result in a left-aligned
text anchored at the left edge, instead it is a left-aligned text
starting at the middle of the viewport.

This and many other issues was the topic of
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20037

Some changes were made to the spec, including the introduction of
positionAlign. Silvia, can you explain what the new model is?

It doesn't seem to me that positionAlign actually adds any new
functionality, so I would like to propose an alternative change to
solve the only problem with the old model that I am aware of:

Change the default position from 50% to "auto", which would maps to 0%
for align:start, 50% for align:middle and 100% for align:right.

I've created a bug for tracking this:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=25632

Philip

Received on Friday, 9 May 2014 13:47:09 UTC