Changeset 242851 in webkit
- Timestamp:
- Mar 13, 2019, 1:24:20 AM (7 years ago)
- Location:
- branches/safari-607-branch
- 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
-
branches/safari-607-branch/LayoutTests/ChangeLog
r242258 r242851 1 2019-03-13 Babak Shafiei <bshafiei@apple.com> 2 3 Cherry-pick r241608. rdar://problem/48839277 4 5 [WebVTT] Inline WebVTT styles should start with '::cue' 6 https://bugs.webkit.org/show_bug.cgi?id=194227 7 8 Reviewed by Eric Carlson. 9 10 Source/WebCore: 11 12 The original fix in r241203 is not sufficient, since it only checks if the CSS string starts 13 with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that 14 all selectors starts with '::cue'. 15 16 Test: media/track/track-cue-css.html 17 18 * html/track/WebVTTParser.cpp: 19 (WebCore::WebVTTParser::checkAndStoreStyleSheet): 20 21 LayoutTests: 22 23 Add invalid 'STYLE' blocks which the WebVTT parser should reject. 24 25 * media/track/captions-webvtt/css-styling.vtt: 26 27 28 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241608 268f45cc-cd09-0410-ab3c-d52691b4dbfc 29 30 2019-02-15 Per Arne Vollan <pvollan@apple.com> 31 32 [WebVTT] Inline WebVTT styles should start with '::cue' 33 https://bugs.webkit.org/show_bug.cgi?id=194227 34 35 Reviewed by Eric Carlson. 36 37 Add invalid 'STYLE' blocks which the WebVTT parser should reject. 38 39 * media/track/captions-webvtt/css-styling.vtt: 40 1 41 2019-03-01 Babak Shafiei <bshafiei@apple.com> 2 42 -
branches/safari-607-branch/LayoutTests/media/track/captions-webvtt/css-styling.vtt
r241456 r242851 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 -
branches/safari-607-branch/Source/WebCore/ChangeLog
r242850 r242851 1 2019-03-13 Babak Shafiei <bshafiei@apple.com> 2 3 Cherry-pick r241608. rdar://problem/48839277 4 5 [WebVTT] Inline WebVTT styles should start with '::cue' 6 https://bugs.webkit.org/show_bug.cgi?id=194227 7 8 Reviewed by Eric Carlson. 9 10 Source/WebCore: 11 12 The original fix in r241203 is not sufficient, since it only checks if the CSS string starts 13 with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that 14 all selectors starts with '::cue'. 15 16 Test: media/track/track-cue-css.html 17 18 * html/track/WebVTTParser.cpp: 19 (WebCore::WebVTTParser::checkAndStoreStyleSheet): 20 21 LayoutTests: 22 23 Add invalid 'STYLE' blocks which the WebVTT parser should reject. 24 25 * media/track/captions-webvtt/css-styling.vtt: 26 27 28 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241608 268f45cc-cd09-0410-ab3c-d52691b4dbfc 29 30 2019-02-15 Per Arne Vollan <pvollan@apple.com> 31 32 [WebVTT] Inline WebVTT styles should start with '::cue' 33 https://bugs.webkit.org/show_bug.cgi?id=194227 34 35 Reviewed by Eric Carlson. 36 37 The original fix in r241203 is not sufficient, since it only checks if the CSS string starts 38 with '::cue'. Before accepting a CSS string from a WebVTT file, it should be checked that 39 all selectors starts with '::cue'. 40 41 Test: media/track/track-cue-css.html 42 43 * html/track/WebVTTParser.cpp: 44 (WebCore::WebVTTParser::checkAndStoreStyleSheet): 45 1 46 2019-03-13 Babak Shafiei <bshafiei@apple.com> 2 47 -
branches/safari-607-branch/Source/WebCore/html/track/WebVTTParser.cpp
r241456 r242851 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.