-
Notifications
You must be signed in to change notification settings - Fork 31
position, text_alignment issue #413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@silviapfeiffer @foolip @zcorpan comments? can you help clarify here? |
Dunno, I haven't thought about WebVTT in a while. @fsoder may have it more recently in cache. |
This came up when we implemented support for position (and line) alignment in Blink. (I'm not sure that "Problem 2" is an issue - x-position=0 seems fairly reasonable?) I suspect it's kind of related to what's mentioned at the end of https://w3c.github.io/webvtt/#webvtt-cue-position :
(there are some additional notes around that paragraph too) So auto position alignment don't go too well together with the logical (text) alignment values. I think this was done intentionally when the spec was changed to not resolve alignment based on the content of the cue. I could have misunderstood or misremembered (that was a while ago now...) Maybe the computed position alignment algorithm should have a paragraph similar to the one for position (above), or refer to it? |
Your analysis is slightly mistaken, which is why this is a "works for me". About problem 1: If instead you were to set align:center by hand, then yes, the computed position alignment would be center and the cue_size would indeed be 0. That's correct, because you're trying to center a cue at 0% position (the left edge of the video) with no possibility to extend the size to the left, therefore it ends up being 0. About problem 2: |
Maybe a clarification that the 'start' and 'end' values should be resolved (using the paragraph direction of the cue text) would be in order then. |
@fsoder you're right - I'll add something to that effect. |
Please review patch |
thanks! |
According to spec "https://w3c.github.io/webvtt/"
problem 1:
if cue contains "position:0% align:start"
https://w3c.github.io/webvtt/#webvtt-cue-position =>computed position is 0,
https://w3c.github.io/webvtt/#webvtt-cue-position-alignment =>computed position alignment is center
https://w3c.github.io/webvtt/#processing-model
If the computed position alignment is center, and the computed position is less than or equal to 50
maximum_size = computed position * 2; which is 0
cue_size is minimum of (cue_size or maxium_size). From this cue_size is 0.
In spec it is not specified what should be done if cue_size is zero.
Problem 2:
if cue contains "position:10% align:start"
https://w3c.github.io/webvtt/#webvtt-cue-position =>computed position is 10,
https://w3c.github.io/webvtt/#webvtt-cue-position-alignment =>computed position alignment is center
https://w3c.github.io/webvtt/#processing-model
If the computed position alignment is center, and the computed position is less than or equal to 50
maximum_size = computed position * 2; which is 20
cue_size is minimum of (cue_size or maxium_size). From this cue_size is 20.
Determine the value of x-position for horizontal writing direction
If the computed position alignment is center alignment
Let x-position be the computed position minus half of size. => 10-20/2 =0;
Here position whichever specified in cue is not considered.
Same problem is there for
position> 50 && align:end;
position< 50 && align:start; cases
The text was updated successfully, but these errors were encountered: