Changeset 241608 in webkit
- Timestamp:
- Feb 15, 2019, 1:13:06 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/media/track/captions-webvtt/css-styling.vtt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/track/WebVTTParser.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r241600 r241608 1 2019-02-15 Per Arne Vollan <pvollan@apple.com> 2 3 [WebVTT] Inline WebVTT styles should start with '::cue' 4 https://bugs.webkit.org/show_bug.cgi?id=194227 5 6 Reviewed by Eric Carlson. 7 8 Add invalid 'STYLE' blocks which the WebVTT parser should reject. 9 10 * media/track/captions-webvtt/css-styling.vtt: 11 1 12 2019-02-15 Per Arne Vollan <pvollan@apple.com> 2 13 -
trunk/LayoutTests/media/track/captions-webvtt/css-styling.vtt
r241203 r241608 32 32 } 33 33 34 NOTE the following style block should be discarded since it has a 'video::cue' selector. 35 36 STYLE 37 ::cue { 38 color: blue 39 font-size: 25px; 40 } 41 video::cue { 42 color: blue; 43 font-size: 25px; 44 } 45 46 NOTE the following style blocks should be discarded since they are invalid in WebVTT files. 47 48 STYLE 49 ::cue,video::cue { 50 color: blue; 51 font-size: 25px; 52 } 53 54 STYLE 55 color: yellow; 56 57 NOTE @import and @namespace CSS rules should not be allowed in WebVTT files. 58 NOTE TODO: create a proper testcase for this, see https://bugs.webkit.org/show_bug.cgi?id=194708. 59 60 STYLE 61 @import url('test.css'); 62 63 STYLE 64 @namespace Foo "test"; 65 66 34 67 hello 35 68 00:00:00.000 --> 00:00:10.000 -
trunk/Source/WebCore/ChangeLog
r241607 r241608 1 2019-02-15 Per Arne Vollan <pvollan@apple.com> 2 3 [WebVTT] Inline WebVTT styles should start with '::cue' 4 https://bugs.webkit.org/show_bug.cgi?id=194227 5 6 Reviewed by Eric Carlson. 7 8 The original fix in r241203 is not sufficient, since it only checks if the CSS string starts 9 with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that 10 all selectors starts with '::cue'. 11 12 Test: media/track/track-cue-css.html 13 14 * html/track/WebVTTParser.cpp: 15 (WebCore::WebVTTParser::checkAndStoreStyleSheet): 16 1 17 2019-02-15 Youenn Fablet <youenn@apple.com> 2 18 -
trunk/Source/WebCore/html/track/WebVTTParser.cpp
r241203 r241608 40 40 #include "ISOVTTCue.h" 41 41 #include "ProcessingInstruction.h" 42 #include "StyleRule.h" 43 #include "StyleRuleImport.h" 42 44 #include "StyleSheetContents.h" 43 45 #include "Text.h" … … 370 372 return false; 371 373 372 auto styleSheet = m_currentStyleSheet.stripWhiteSpace(); 373 374 // Inline VTT styles must start with ::cue. 375 if (!styleSheet.startsWith("::cue")) { 376 m_currentStyleSheet = emptyString(); 374 auto styleSheet = WTFMove(m_currentStyleSheet); 375 376 auto contents = StyleSheetContents::create(); 377 if (!contents->parseString(styleSheet)) 377 378 return true; 378 } 379 380 auto contents = StyleSheetContents::create(); 381 if (!contents->parseString(styleSheet)) { 382 m_currentStyleSheet = emptyString(); 379 380 auto& namespaceRules = contents->namespaceRules(); 381 if (namespaceRules.size()) 383 382 return true; 384 } 385 386 m_styleSheets.append(WTFMove(m_currentStyleSheet)); 383 384 auto& importRules = contents->importRules(); 385 if (importRules.size()) 386 return true; 387 388 auto& childRules = contents->childRules(); 389 if (!childRules.size()) 390 return true; 391 392 for (auto rule : childRules) { 393 if (!rule->isStyleRule()) 394 return true; 395 const auto& styleRule = downcast<StyleRule>(rule.get()); 396 397 const auto& selectorList = styleRule->selectorList(); 398 if (selectorList.listSize() != 1) 399 return true; 400 auto selector = selectorList.selectorAt(0); 401 if (selector->selectorText() != "::cue") 402 return true; 403 } 404 405 m_styleSheets.append(styleSheet); 387 406 return true; 388 407 }
Note:
See TracChangeset
for help on using the changeset viewer.