Bug 190004 - WebVTT cue alignment broken
Summary: WebVTT cue alignment broken
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Per Arne Vollan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-09-26 11:06 PDT by Per Arne Vollan
Modified: 2018-12-03 09:20 PST (History)
6 users (show)

See Also:


Attachments
Patch (37.72 KB, patch)
2018-09-26 11:52 PDT, Per Arne Vollan
eric.carlson: review+
Details | Formatted Diff | Diff
Patch (37.41 KB, patch)
2018-09-26 12:39 PDT, Per Arne Vollan
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-sierra (2.40 MB, application/zip)
2018-09-26 13:46 PDT, EWS Watchlist
no flags Details
Archive of layout-test-results from ews113 for mac-sierra (3.09 MB, application/zip)
2018-09-26 14:34 PDT, EWS Watchlist
no flags Details
Patch (37.44 KB, patch)
2018-09-26 14:47 PDT, Per Arne Vollan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Per Arne Vollan 2018-09-26 11:06:44 PDT
Closed caption rendering of proper cue alignment from a WebVTT file is broken. Left alignment is rendered on the right, right alignment is rendered on the left.
Comment 1 Per Arne Vollan 2018-09-26 11:07:03 PDT
rdar://problem/32788929
Comment 2 Per Arne Vollan 2018-09-26 11:52:48 PDT
Created attachment 350876 [details]
Patch
Comment 3 Eric Carlson 2018-09-26 12:24:02 PDT
Comment on attachment 350876 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=350876&action=review

> Source/WebCore/html/track/TextTrackCueGeneric.cpp:173
> +ExceptionOr<void> TextTrackCueGeneric::setPosition(const Variant<double, AutoKeyword>& position)

Nit: "Variant<double, AutoKeyword>" is used often enough that it would be good to define a type for it:  

using LineAndPositionSetting = Variant<double, AutoKeyword>;

> Source/WebCore/html/track/VTTCue.cpp:401
> +    Variant<double, AutoKeyword> pos;
> +    if (textPositionIsAuto())
> +        pos = Auto;
> +    else
> +        pos = m_textPosition;
> +    return pos;

Nit: this can be reduced to something like:

return textPositionIsAuto() ? Auto : m_textPosition;

> Source/WebCore/html/track/VTTCue.cpp:412
> +    if (position.index() == 1) {

I think WTF::holds_alternative<> would be cleaner: 

WTF::holds_alternative<AutoKeyword>(position)
Comment 4 Per Arne Vollan 2018-09-26 12:26:28 PDT
(In reply to Eric Carlson from comment #3)
> Comment on attachment 350876 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=350876&action=review
> 
> > Source/WebCore/html/track/TextTrackCueGeneric.cpp:173
> > +ExceptionOr<void> TextTrackCueGeneric::setPosition(const Variant<double, AutoKeyword>& position)
> 
> Nit: "Variant<double, AutoKeyword>" is used often enough that it would be
> good to define a type for it:  
> 
> using LineAndPositionSetting = Variant<double, AutoKeyword>;
> 
> > Source/WebCore/html/track/VTTCue.cpp:401
> > +    Variant<double, AutoKeyword> pos;
> > +    if (textPositionIsAuto())
> > +        pos = Auto;
> > +    else
> > +        pos = m_textPosition;
> > +    return pos;
> 
> Nit: this can be reduced to something like:
> 
> return textPositionIsAuto() ? Auto : m_textPosition;
> 
> > Source/WebCore/html/track/VTTCue.cpp:412
> > +    if (position.index() == 1) {
> 
> I think WTF::holds_alternative<> would be cleaner: 
> 
> WTF::holds_alternative<AutoKeyword>(position)

Thanks for reviewing! I will update the patch.
Comment 5 Per Arne Vollan 2018-09-26 12:39:29 PDT
Created attachment 350883 [details]
Patch
Comment 6 EWS Watchlist 2018-09-26 13:46:11 PDT
Comment on attachment 350883 [details]
Patch

Attachment 350883 [details] did not pass mac-ews (mac):
Output: https://webkit-queues.webkit.org/results/9359332

New failing tests:
media/track/track-webvtt-tc016-align-positioning.html
media/track/track-cue-mutable.html
media/track/track-vttcue.html
media/track/track-webvtt-tc021-valign.html
media/track/track-webvtt-tc018-align-text-line-position.html
media/track/track-add-remove-cue.html
media/track/track-webvtt-tc015-positioning.html
media/track/track-webvtt-tc013-settings.html
Comment 7 EWS Watchlist 2018-09-26 13:46:13 PDT
Created attachment 350895 [details]
Archive of layout-test-results from ews103 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 8 EWS Watchlist 2018-09-26 14:34:56 PDT
Comment on attachment 350883 [details]
Patch

Attachment 350883 [details] did not pass mac-debug-ews (mac):
Output: https://webkit-queues.webkit.org/results/9359515

New failing tests:
media/track/track-webvtt-tc018-align-text-line-position.html
media/track/track-cue-mutable.html
media/track/track-vttcue.html
media/track/track-webvtt-tc021-valign.html
media/track/track-webvtt-tc016-align-positioning.html
media/track/track-add-remove-cue.html
media/track/track-webvtt-tc015-positioning.html
media/track/track-webvtt-tc013-settings.html
Comment 9 EWS Watchlist 2018-09-26 14:34:58 PDT
Created attachment 350901 [details]
Archive of layout-test-results from ews113 for mac-sierra

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-sierra  Platform: Mac OS X 10.12.6
Comment 10 Per Arne Vollan 2018-09-26 14:47:43 PDT
Created attachment 350905 [details]
Patch
Comment 11 WebKit Commit Bot 2018-09-26 16:10:48 PDT
Comment on attachment 350905 [details]
Patch

Clearing flags on attachment: 350905

Committed r236531: <https://trac.webkit.org/changeset/236531>