[WebVTT] Support inline WebVTT styles
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Oct 2018 17:29:34 +0000 (17:29 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Oct 2018 17:29:34 +0000 (17:29 +0000)
commitd7425c5bf9acb316ad4f9bae0e6cdfbb68a7a302
tree3e123337776274a64cfadab215b377b1f4110350
parent29fc5c9cf7f9da9582676d739ddc61d1cf4a5356
[WebVTT] Support inline WebVTT styles
https://bugs.webkit.org/show_bug.cgi?id=190369

Reviewed by Eric Carlson.

Source/WebCore:

Add support for inline WebVTT styles, see https://w3c.github.io/webvtt/#styling. The parsed
style strings from the VTT file are added to an optional vector of style strings in the
TextTrack class. These styles are then added as HTMLStyleElement children to the parent of
the cue span element.

Test: media/track/track-cue-css.html

* html/track/InbandGenericTextTrack.cpp:
(WebCore::InbandGenericTextTrack::newStyleSheetsParsed):
* html/track/InbandGenericTextTrack.h:
* html/track/InbandWebVTTTextTrack.cpp:
(WebCore::InbandWebVTTTextTrack::newStyleSheetsParsed):
* html/track/InbandWebVTTTextTrack.h:
* html/track/LoadableTextTrack.cpp:
(WebCore::LoadableTextTrack::newStyleSheetsAvailable):
* html/track/LoadableTextTrack.h:
* html/track/TextTrack.h:
(WebCore::TextTrack::styleSheets const):
* html/track/VTTCue.cpp:
(WebCore::VTTCue::getDisplayTree):
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::getNewCues):
(WebCore::WebVTTParser::getStyleSheets):
(WebCore::WebVTTParser::parse):
(WebCore::WebVTTParser::collectWebVTTBlock):
(WebCore::WebVTTParser::collectStyleSheet):
(WebCore::WebVTTParser::checkStyleSheet):
(WebCore::WebVTTParser::checkAndStoreStyleSheet):
* html/track/WebVTTParser.h:
* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::newStyleSheetsParsed):
(WebCore::TextTrackLoader::getNewStyleSheets):
* loader/TextTrackLoader.h:

LayoutTests:

* media/track/captions-webvtt/css-styling.vtt: Added.
* media/track/captions-webvtt/no-css-styling.vtt: Added.
* media/track/track-cue-css-expected.html: Added.
* media/track/track-cue-css.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237187 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/media/track/captions-webvtt/css-styling.vtt [new file with mode: 0644]
LayoutTests/media/track/captions-webvtt/no-css-styling.vtt [new file with mode: 0644]
LayoutTests/media/track/track-cue-css-expected.html [new file with mode: 0644]
LayoutTests/media/track/track-cue-css.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/track/InbandGenericTextTrack.cpp
Source/WebCore/html/track/InbandGenericTextTrack.h
Source/WebCore/html/track/InbandWebVTTTextTrack.cpp
Source/WebCore/html/track/InbandWebVTTTextTrack.h
Source/WebCore/html/track/LoadableTextTrack.cpp
Source/WebCore/html/track/LoadableTextTrack.h
Source/WebCore/html/track/TextTrack.h
Source/WebCore/html/track/VTTCue.cpp
Source/WebCore/html/track/WebVTTParser.cpp
Source/WebCore/html/track/WebVTTParser.h
Source/WebCore/loader/TextTrackLoader.cpp
Source/WebCore/loader/TextTrackLoader.h