Skip to content
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(WebVTT): Fix support for line:0 vertical alignment #5632

Merged
merged 3 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/text/ui_text_displayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,15 @@ shaka.text.UITextDisplayer = class {
// TODO: Implement line alignment with line number.
// TODO: Implement lineAlignment of 'CENTER'.
if (cue.line != null) {
if (cue.lineInterpretation == Cue.lineInterpretation.PERCENTAGE) {
let lineInterpretation = cue.lineInterpretation;
// HACK: the current implementation of UITextDisplayer only handled
// PERCENTAGE, as cue.line=0 is zero, we can interpret it as percentage
// safely.
if (cue.line == 0 &&
lineInterpretation == Cue.lineInterpretation.LINE_NUMBER) {
lineInterpretation = Cue.lineInterpretation.PERCENTAGE;
}
if (lineInterpretation == Cue.lineInterpretation.PERCENTAGE) {
style.position = 'absolute';
if (cue.writingMode == Cue.writingMode.HORIZONTAL_TOP_TO_BOTTOM) {
style.width = '100%';
Expand Down
Binary file modified test/test/assets/screenshots/chrome-Android/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/test/assets/screenshots/chrome-Linux/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/test/assets/screenshots/chrome-Mac/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/test/assets/screenshots/chrome-Windows/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/test/assets/screenshots/firefox-Linux/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/test/assets/screenshots/firefox-Mac/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/test/assets/screenshots/firefox-Windows/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/test/assets/screenshots/msedge-Linux/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/test/assets/screenshots/msedge-Mac/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/test/assets/screenshots/msedge-Windows/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/test/assets/screenshots/safari-Mac/webvtt-ui-line-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion test/text/web_vtt_layout_integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ filterDescribe('WebVTT layout', shaka.test.TextLayoutTests.supported, () => {
await helper.checkScreenshot('line-negative-2');
});

// FIXME: UI version is wrong: not positioned by line
it('line 0', async () => {
parseAndDisplay([
'WEBVTT\n',
Expand Down
Loading