-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix for TTML alignment (non-centered) in Firefox #588
Conversation
… defaults to centered position which causes problem when TTML alignment is left-adjusted for example
Testing in progress... |
All tests passed! |
@ismena, this looks reasonable to me, but you have more experience here. Any objections? |
@@ -332,12 +343,15 @@ shaka.media.TtmlTextParser.addStyle_ = function( | |||
cueElement, region, styles, 'tts:textAlign'); | |||
if (align) { | |||
cue.align = align; | |||
if (align == 'center' && cue.align != 'center') { | |||
// Workaround for a Chrome bug http://crbug.com/663797 | |||
// Chrome does not support align = 'center' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little lost here. Did something change in terms of logic on lines 335-351?
I suspect you might be working off an older version of the file (we refactored it a bit since your last commit). If that's the case, let's stick to the newer version.
Looks good otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually an intentional change as setting the cue.position to auto when textAlign is center is not because of a bug in Chrome but rather due to the differences between TTML and VTT. It should not impose any logical change from previous commit but make it more clear that it is not related to the Chrome bug so it will risk to be removed when that cue.align bug is fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see. In that case we are good to go.
This commit fixes non-centered TTML alignment issues in Firefox which defaults to centered position which causes problem when TTML alignment is left-adjusted for example.
It was discovered that TTML alignments that is not centered (e.g. left) was shown incorrectly in Firefox. The reason I discovered was that the cue.positionAlign was not set and defaulted to "center". This caused the subtitles to be positioned on the left (when tts:textAlign=left) but with the text center aligned.
Note that for Firefox v48 or lower the implementation of cue.positionAlign did not fully follow the spec and was corrected in v49 and above.