Index: Source/core/html/track/vtt/VTTParser.cpp |
diff --git a/Source/core/html/track/vtt/VTTParser.cpp b/Source/core/html/track/vtt/VTTParser.cpp |
index cddec3461f1916dfc75893afe5b7998e3809b204..0ba5e36700f5feb11c7a93ba54fe087b880394bb 100644 |
--- a/Source/core/html/track/vtt/VTTParser.cpp |
+++ b/Source/core/html/track/vtt/VTTParser.cpp |
@@ -179,6 +179,10 @@ void WebVTTParser::parse() |
break; |
} |
+ // Step 15 - Break out of header loop if the line could be a timestamp line. |
+ if (line.contains("-->")) |
+ m_state = recoverCue(line); |
+ |
// Step 16 - Line is not the empty string and does not contain "-->". |
break; |
@@ -307,10 +311,19 @@ WebVTTParser::ParseState WebVTTParser::collectTimingsAndSettings(const String& l |
WebVTTParser::ParseState WebVTTParser::collectCueText(const String& line) |
{ |
+ // Step 34. |
if (line.isEmpty()) { |
createNewCue(); |
return Id; |
} |
+ // Step 35. |
+ if (line.contains("-->")) { |
+ // Step 39-40. |
+ createNewCue(); |
+ |
+ // Step 41 - New iteration of the cue loop. |
+ return recoverCue(line); |
+ } |
if (!m_currentContent.isEmpty()) |
m_currentContent.append("\n"); |
m_currentContent.append(line); |
@@ -318,11 +331,22 @@ WebVTTParser::ParseState WebVTTParser::collectCueText(const String& line) |
return CueText; |
} |
+WebVTTParser::ParseState WebVTTParser::recoverCue(const String& line) |
+{ |
+ // Step 17 and 21. |
+ resetCueValues(); |
+ |
+ // Step 22. |
+ return collectTimingsAndSettings(line); |
+} |
+ |
WebVTTParser::ParseState WebVTTParser::ignoreBadCue(const String& line) |
{ |
- if (!line.isEmpty()) |
- return BadCue; |
- return Id; |
+ if (line.isEmpty()) |
+ return Id; |
+ if (line.contains("-->")) |
+ return recoverCue(line); |
+ return BadCue; |
} |
// A helper class for the construction of a "cue fragment" from the cue text. |