WebKit Bugzilla
Attachment 362120 Details for
Bug 194227
: [WebVTT] Inline WebVTT styles should start with '::cue'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194227-20190215094530.patch (text/plain), 4.53 KB, created by
Per Arne Vollan
on 2019-02-15 09:45:31 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Per Arne Vollan
Created:
2019-02-15 09:45:31 PST
Size:
4.53 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 241590) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,19 @@ >+2019-02-15 Per Arne Vollan <pvollan@apple.com> >+ >+ [WebVTT] Inline WebVTT styles should start with '::cue' >+ https://bugs.webkit.org/show_bug.cgi?id=194227 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The original fix in r241203 is not sufficient, since it only checks if the CSS string starts >+ with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that >+ all selectors starts with '::cue'. >+ >+ Test: media/track/track-cue-css.html >+ >+ * html/track/WebVTTParser.cpp: >+ (WebCore::WebVTTParser::checkAndStoreStyleSheet): >+ > 2019-02-15 Philippe Normand <pnormand@igalia.com> > > [GStreamer] Simplify GObject class name check >Index: Source/WebCore/html/track/WebVTTParser.cpp >=================================================================== >--- Source/WebCore/html/track/WebVTTParser.cpp (revision 241590) >+++ Source/WebCore/html/track/WebVTTParser.cpp (working copy) >@@ -39,6 +39,8 @@ > #include "HTMLParserIdioms.h" > #include "ISOVTTCue.h" > #include "ProcessingInstruction.h" >+#include "StyleRule.h" >+#include "StyleRuleImport.h" > #include "StyleSheetContents.h" > #include "Text.h" > #include "VTTScanner.h" >@@ -369,21 +371,38 @@ bool WebVTTParser::checkAndStoreStyleShe > if (!line.isEmpty() && !line.contains("-->")) > return false; > >- auto styleSheet = m_currentStyleSheet.stripWhiteSpace(); >+ auto styleSheet = WTFMove(m_currentStyleSheet); > >- // Inline VTT styles must start with ::cue. >- if (!styleSheet.startsWith("::cue")) { >- m_currentStyleSheet = emptyString(); >+ auto contents = StyleSheetContents::create(); >+ if (!contents->parseString(styleSheet)) > return true; >- } > >- auto contents = StyleSheetContents::create(); >- if (!contents->parseString(styleSheet)) { >- m_currentStyleSheet = emptyString(); >+ auto& namespaceRules = contents->namespaceRules(); >+ if (namespaceRules.size()) >+ return true; >+ >+ auto& importRules = contents->importRules(); >+ if (importRules.size()) >+ return true; >+ >+ auto& childRules = contents->childRules(); >+ if (!childRules.size()) > return true; >- } > >- m_styleSheets.append(WTFMove(m_currentStyleSheet)); >+ for (auto rule : childRules) { >+ if (!rule->isStyleRule()) >+ return true; >+ const auto& styleRule = downcast<StyleRule>(rule.get()); >+ >+ const auto& selectorList = styleRule->selectorList(); >+ if (selectorList.listSize() != 1) >+ return true; >+ auto selector = selectorList.selectorAt(0); >+ if (selector->selectorText() != "::cue") >+ return true; >+ } >+ >+ m_styleSheets.append(styleSheet); > return true; > } > >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 241590) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,14 @@ >+2019-02-15 Per Arne Vollan <pvollan@apple.com> >+ >+ [WebVTT] Inline WebVTT styles should start with '::cue' >+ https://bugs.webkit.org/show_bug.cgi?id=194227 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add invalid 'STYLE' blocks which the WebVTT parser should reject. >+ >+ * media/track/captions-webvtt/css-styling.vtt: >+ > 2019-02-14 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r241497. >Index: LayoutTests/media/track/captions-webvtt/css-styling.vtt >=================================================================== >--- LayoutTests/media/track/captions-webvtt/css-styling.vtt (revision 241590) >+++ LayoutTests/media/track/captions-webvtt/css-styling.vtt (working copy) >@@ -31,6 +31,39 @@ color: blue; > font-size: 25px; > } > >+NOTE the following style block should be discarded since it has a 'video::cue' selector. >+ >+STYLE >+::cue { >+color: blue >+font-size: 25px; >+} >+video::cue { >+color: blue; >+font-size: 25px; >+} >+ >+NOTE the following style blocks should be discarded since they are invalid in WebVTT files. >+ >+STYLE >+::cue,video::cue { >+color: blue; >+font-size: 25px; >+} >+ >+STYLE >+color: yellow; >+ >+NOTE @import and @namespace CSS rules should not be allowed in WebVTT files. >+NOTE TODO: create a proper testcase for this, see https://bugs.webkit.org/show_bug.cgi?id=194708. >+ >+STYLE >+@import url('test.css'); >+ >+STYLE >+@namespace Foo "test"; >+ >+ > hello > 00:00:00.000 --> 00:00:10.000 > <b>Hello</b> first cue.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194227
:
361081
|
361083
|
361514
|
361516
|
361956
|
361959
|
362030
|
362045
|
362069
| 362120