Title: [241203] trunk
- Revision
- 241203
- Author
- pvol...@apple.com
- Date
- 2019-02-08 11:48:04 -0800 (Fri, 08 Feb 2019)
Log Message
[WebVTT] Inline WebVTT styles should start with '::cue'
https://bugs.webkit.org/show_bug.cgi?id=194227
<rdar://problem/47791087>
Reviewed by Eric Carlson.
Source/WebCore:
Check that the CSS string starts with '::cue' and is successfully parsed before adding it
to the CSS stylesheet list. Also, the caption preferences CSS string should start with
'::cue', since it is added inside the video shadow root element.
Test: media/track/track-cue-css.html
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::checkAndStoreStyleSheet):
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const):
LayoutTests:
* media/track/captions-webvtt/css-styling.vtt:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (241202 => 241203)
--- trunk/LayoutTests/ChangeLog 2019-02-08 19:46:11 UTC (rev 241202)
+++ trunk/LayoutTests/ChangeLog 2019-02-08 19:48:04 UTC (rev 241203)
@@ -1,3 +1,13 @@
+2019-02-08 Per Arne Vollan <pvol...@apple.com>
+
+ [WebVTT] Inline WebVTT styles should start with '::cue'
+ https://bugs.webkit.org/show_bug.cgi?id=194227
+ <rdar://problem/47791087>
+
+ Reviewed by Eric Carlson.
+
+ * media/track/captions-webvtt/css-styling.vtt:
+
2019-02-08 Youenn Fablet <you...@apple.com>
Running RTCRtpSender.getCapabilities("video") before initial offer breaks VP8
Modified: trunk/LayoutTests/media/track/captions-webvtt/css-styling.vtt (241202 => 241203)
--- trunk/LayoutTests/media/track/captions-webvtt/css-styling.vtt 2019-02-08 19:46:11 UTC (rev 241202)
+++ trunk/LayoutTests/media/track/captions-webvtt/css-styling.vtt 2019-02-08 19:48:04 UTC (rev 241203)
@@ -12,11 +12,25 @@
}
STYLE
-video::cue {
+::cue {
color: green;
font-size: 15px;
}
+NOTE the following style block has a syntax error.
+
+STYLE
+::cue {
+color: blue
+font-size: 25px;
+}
+
+STYLE
+video::cue {
+color: blue;
+font-size: 25px;
+}
+
hello
00:00:00.000 --> 00:00:10.000
<b>Hello</b> first cue.
Modified: trunk/Source/WebCore/ChangeLog (241202 => 241203)
--- trunk/Source/WebCore/ChangeLog 2019-02-08 19:46:11 UTC (rev 241202)
+++ trunk/Source/WebCore/ChangeLog 2019-02-08 19:48:04 UTC (rev 241203)
@@ -1,3 +1,22 @@
+2019-02-08 Per Arne Vollan <pvol...@apple.com>
+
+ [WebVTT] Inline WebVTT styles should start with '::cue'
+ https://bugs.webkit.org/show_bug.cgi?id=194227
+ <rdar://problem/47791087>
+
+ Reviewed by Eric Carlson.
+
+ Check that the CSS string starts with '::cue' and is successfully parsed before adding it
+ to the CSS stylesheet list. Also, the caption preferences CSS string should start with
+ '::cue', since it is added inside the video shadow root element.
+
+ Test: media/track/track-cue-css.html
+
+ * html/track/WebVTTParser.cpp:
+ (WebCore::WebVTTParser::checkAndStoreStyleSheet):
+ * page/CaptionUserPreferencesMediaAF.cpp:
+ (WebCore::CaptionUserPreferencesMediaAF::captionsStyleSheetOverride const):
+
2019-02-08 Youenn Fablet <you...@apple.com>
Running RTCRtpSender.getCapabilities("video") before initial offer breaks VP8
Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (241202 => 241203)
--- trunk/Source/WebCore/html/track/WebVTTParser.cpp 2019-02-08 19:46:11 UTC (rev 241202)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp 2019-02-08 19:48:04 UTC (rev 241203)
@@ -39,6 +39,7 @@
#include "HTMLParserIdioms.h"
#include "ISOVTTCue.h"
#include "ProcessingInstruction.h"
+#include "StyleSheetContents.h"
#include "Text.h"
#include "VTTScanner.h"
#include "WebVTTElement.h"
@@ -368,6 +369,20 @@
if (!line.isEmpty() && !line.contains("-->"))
return false;
+ auto styleSheet = m_currentStyleSheet.stripWhiteSpace();
+
+ // Inline VTT styles must start with ::cue.
+ if (!styleSheet.startsWith("::cue")) {
+ m_currentStyleSheet = emptyString();
+ return true;
+ }
+
+ auto contents = StyleSheetContents::create();
+ if (!contents->parseString(styleSheet)) {
+ m_currentStyleSheet = emptyString();
+ return true;
+ }
+
m_styleSheets.append(WTFMove(m_currentStyleSheet));
return true;
}
Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (241202 => 241203)
--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2019-02-08 19:46:11 UTC (rev 241202)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2019-02-08 19:48:04 UTC (rev 241203)
@@ -567,7 +567,7 @@
String fontName = captionsDefaultFontCSS();
String background = ""
if (!background.isEmpty() || !captionsColor.isEmpty() || !edgeStyle.isEmpty() || !fontName.isEmpty()) {
- captionsOverrideStyleSheet.appendLiteral(" video::");
+ captionsOverrideStyleSheet.appendLiteral(" ::");
captionsOverrideStyleSheet.append(TextTrackCue::cueShadowPseudoId());
captionsOverrideStyleSheet.append('{');
@@ -586,7 +586,7 @@
String windowColor = captionsWindowCSS();
String windowCornerRadius = windowRoundedCornerRadiusCSS();
if (!windowColor.isEmpty() || !windowCornerRadius.isEmpty()) {
- captionsOverrideStyleSheet.appendLiteral(" video::");
+ captionsOverrideStyleSheet.appendLiteral(" ::");
captionsOverrideStyleSheet.append(VTTCue::cueBackdropShadowPseudoId());
captionsOverrideStyleSheet.append('{');
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes