[macOS] Inline WebVTT styles should override styles from Captions settings in System...
authorpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Dec 2018 23:06:49 +0000 (23:06 +0000)
committerpvollan@apple.com <pvollan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Dec 2018 23:06:49 +0000 (23:06 +0000)
commit2e00dc572a6be3c8ecb0ca36ddfa956e0ef13722
tree7cb91557e247c6ea24a1a8a347245fe4dc6f6b6b
parenta69cbafbc2c3a98bcf55abc1deda96d3db2770dd
[macOS] Inline WebVTT styles should override styles from Captions settings in System Preferences
https://bugs.webkit.org/show_bug.cgi?id=192638

Reviewed by Eric Carlson.

Source/WebCore:

It is currently not possible to override caption styles generated from System Preferences with inline
WebVTT styles without adding !important. The reason for this is that the generated styles from
System preferences are author styles which have higher priority than the inline WebVTT styles, which
are user agent styles in the video user agent shadow tree. This can be fixed by moving the generated
styles to the video user agent shadow tree. Inline WebVTT styles will then have higher priority since
they are added after the generated styles. This patch also fixes a problem where inline styles could be
added twice to the video user agent shadow root.

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

* dom/ExtensionStyleSheets.cpp:
(WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const):
* html/track/VTTCue.cpp:
(WebCore::VTTCue::getDisplayTree):
* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride):
* page/Page.cpp:
(WebCore::Page::setCaptionUserPreferencesStyleSheet):

LayoutTests:

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239181 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/media/track/captions-webvtt/css-styling.vtt
LayoutTests/media/track/captions-webvtt/no-css-styling.vtt
LayoutTests/media/track/track-css-user-override-expected.txt
LayoutTests/media/track/track-css-user-override.html
LayoutTests/media/track/track-cue-css-expected.html
Source/WebCore/ChangeLog
Source/WebCore/dom/ExtensionStyleSheets.cpp
Source/WebCore/html/track/VTTCue.cpp
Source/WebCore/page/CaptionUserPreferences.cpp
Source/WebCore/page/Page.cpp