Bug 190369 - [WebVTT] Support inline WebVTT styles
Summary: [WebVTT] Support inline WebVTT styles
Status: NEW
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-10-08 13:10 PDT by Per Arne Vollan
Modified: 2018-11-02 11:04 PDT (History)
6 users (show)

See Also:


Attachments
Patch (19.70 KB, patch)
2018-10-08 14:00 PDT, Per Arne Vollan
no flags Details | Formatted Diff | Diff
Patch (18.47 KB, patch)
2018-10-15 10:48 PDT, Per Arne Vollan
eric.carlson: review+
Details | Formatted Diff | Diff
Patch (18.47 KB, patch)
2018-10-16 09:46 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-10-08 13:10:18 PDT
Inline WebVTT styles are currently not supported in WebKit, see https://w3c.github.io/webvtt/#styling.
Comment 1 Per Arne Vollan 2018-10-08 13:10:59 PDT
rdar://problem/29265907
Comment 2 Per Arne Vollan 2018-10-08 14:00:27 PDT
Created attachment 351812 [details]
Patch
Comment 3 Eric Carlson 2018-10-09 06:27:56 PDT
Comment on attachment 351812 [details]
Patch

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

> Source/WebCore/dom/ExtensionStyleSheets.cpp:151
> +        for (auto styleSheet : *owningPage->webVTTStyleSheets()) {

const auto&

> Source/WebCore/dom/ExtensionStyleSheets.cpp:154
> +            m_injectedAuthorStyleSheets.append(WTFMove(sheet));

Won't this make the style apply to *every* <track> in the document? Styles in a WebVTT file should only apply to the cues in one track.

> Source/WebCore/html/track/LoadableTextTrack.cpp:137
> +void LoadableTextTrack::newStyleSheetsAvailable(TextTrackLoader* loader)

TextTrackLoader&, and please file a bug about changing all TextTrackLoader* method parameters in this class.

> Source/WebCore/html/track/LoadableTextTrack.cpp:142
> +    for (auto cssString : newStyleSheets)

const auto& cssString

> Source/WebCore/html/track/LoadableTextTrack.cpp:144
> +    if (!newStyleSheets.isEmpty())

You could return immediately above if the vector is empty.

> Source/WebCore/html/track/WebVTTParser.cpp:359
> +    if (line.startsWith("STYLE") && line.substring(regionIdentifierLength).isAllSpecialCharacters<isASpace>())

You need a new constant, "regionIdentifierLength" is wrong for STYLE

> LayoutTests/media/track/track-cue-css.html:19
> +            waitForEvent('seeked', seeked);

Nit: this could be simplified to "waitForEvent('seeked', endTest);"
Comment 4 Per Arne Vollan 2018-10-15 10:48:28 PDT
Created attachment 352345 [details]
Patch
Comment 5 Eric Carlson 2018-10-15 13:56:45 PDT
Comment on attachment 352345 [details]
Patch

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

> Source/WebCore/html/track/WebVTTParser.h:176
> +    ParseState collectStyleSheet(const String& line);

Nit: "line" isn't necessary.

> Source/WebCore/loader/TextTrackLoader.h:75
> +    void newStyleSheetsParsed() override;

Nit: override -> final
Comment 6 Per Arne Vollan 2018-10-16 09:46:54 PDT
Created attachment 352464 [details]
Patch
Comment 7 Per Arne Vollan 2018-10-16 10:25:06 PDT
(In reply to Eric Carlson from comment #5)
> Comment on attachment 352345 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=352345&action=review
> 
> > Source/WebCore/html/track/WebVTTParser.h:176
> > +    ParseState collectStyleSheet(const String& line);
> 
> Nit: "line" isn't necessary.
> 
> > Source/WebCore/loader/TextTrackLoader.h:75
> > +    void newStyleSheetsParsed() override;
> 
> Nit: override -> final

Thanks for reviewing!
Comment 8 WebKit Commit Bot 2018-10-16 10:29:41 PDT
Comment on attachment 352464 [details]
Patch

Clearing flags on attachment: 352464

Committed r237187: <https://trac.webkit.org/changeset/237187>