Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: Source/core/html/track/WebVTTParser.cpp

Issue 62833005: The WebVTT parsing algorithm allows empty cue text (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 365 }
366 366
367 PassRefPtr<DocumentFragment> WebVTTParser::createDocumentFragmentFromCueText(Doc ument& document, const String& cueText) 367 PassRefPtr<DocumentFragment> WebVTTParser::createDocumentFragmentFromCueText(Doc ument& document, const String& cueText)
368 { 368 {
369 WebVTTTreeBuilder treeBuilder(document); 369 WebVTTTreeBuilder treeBuilder(document);
370 return treeBuilder.buildFromString(cueText); 370 return treeBuilder.buildFromString(cueText);
371 } 371 }
372 372
373 void WebVTTParser::createNewCue() 373 void WebVTTParser::createNewCue()
374 { 374 {
375 if (!m_currentContent.length())
376 return;
377
378 RefPtr<TextTrackCue> cue = TextTrackCue::create(*m_document, m_currentStartT ime, m_currentEndTime, m_currentContent.toString()); 375 RefPtr<TextTrackCue> cue = TextTrackCue::create(*m_document, m_currentStartT ime, m_currentEndTime, m_currentContent.toString());
379 cue->setId(m_currentId); 376 cue->setId(m_currentId);
380 cue->setCueSettings(m_currentSettings); 377 cue->setCueSettings(m_currentSettings);
381 378
382 m_cuelist.append(cue); 379 m_cuelist.append(cue);
383 if (m_client) 380 if (m_client)
384 m_client->newCuesParsed(); 381 m_client->newCuesParsed();
385 } 382 }
386 383
387 void WebVTTParser::resetCueValues() 384 void WebVTTParser::resetCueValues()
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 558 }
562 559
563 void WebVTTParser::skipWhiteSpace(const String& line, unsigned* position) 560 void WebVTTParser::skipWhiteSpace(const String& line, unsigned* position)
564 { 561 {
565 while (*position < line.length() && isASpace(line[*position])) 562 while (*position < line.length() && isASpace(line[*position]))
566 (*position)++; 563 (*position)++;
567 } 564 }
568 565
569 } 566 }
570 567
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698