Diff
Modified: trunk/LayoutTests/ChangeLog (166079 => 166080)
--- trunk/LayoutTests/ChangeLog 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/LayoutTests/ChangeLog 2014-03-21 18:41:08 UTC (rev 166080)
@@ -1,3 +1,32 @@
+2014-03-21 Brent Fulgham <bfulg...@apple.com>
+
+ Handle recovery on "timestamp-looking" lines in the WebVTT parser
+ https://bugs.webkit.org/show_bug.cgi?id=130610
+
+ Reviewed by Eric Carlson.
+
+ Merged from Blink (patch by f...@opera.com):
+ https://chromium.googlesource.com/chromium/blink/+/b669a380efbffe25f3b154b026b57b9822ce08e2
+ http://crbug.com/75273002
+
+ * media/track/captions-webvtt/tc006-cue-id-error.vtt:
+ * media/track/captions-webvtt/tc007-cue-no-id-error.vtt:
+ * media/track/captions-webvtt/tc011-cues-no-separation.vtt:
+ * media/track/captions-webvtt/tc031-cue-recovery-cuetext.vtt: Added.
+ * media/track/captions-webvtt/tc031-cue-recovery-header.vtt: Added.
+ * media/track/captions-webvtt/tc031-cue-recovery-note.vtt: Added.
+ * media/track/captions-webvtt/tc032-degenerate-cues.vtt: Added.
+ * media/track/track-webvtt-tc006-cue-identifiers-expected.txt:
+ * media/track/track-webvtt-tc006-cue-identifiers.html:
+ * media/track/track-webvtt-tc007-cue-no-id-expected.txt:
+ * media/track/track-webvtt-tc007-cue-no-id.html:
+ * media/track/track-webvtt-tc011-blank-lines-expected.txt:
+ * media/track/track-webvtt-tc011-blank-lines.html:
+ * media/track/track-webvtt-tc031-cue-recovery-expected.txt: Added.
+ * media/track/track-webvtt-tc031-cue-recovery.html: Added.
+ * media/track/track-webvtt-tc032-degenerate-cues-expected.txt: Added.
+ * media/track/track-webvtt-tc032-degenerate-cues.html: Added.
+
2014-03-21 David Hyatt <hy...@apple.com>
Crash in RenderBlock::addChildIgnoringAnonymousColumnBlocks.
Modified: trunk/LayoutTests/media/track/captions-webvtt/tc006-cue-id-error.vtt (166079 => 166080)
--- trunk/LayoutTests/media/track/captions-webvtt/tc006-cue-id-error.vtt 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/LayoutTests/media/track/captions-webvtt/tc006-cue-id-error.vtt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -1,5 +1,5 @@
WEBVTT
-Cue identifiers cannot contain the string "-->".
+Cue identifiers may contain the string "-->", but are treated as blanks
-->random_id
00:00:00.000 --> 00:00:30.500
Modified: trunk/LayoutTests/media/track/captions-webvtt/tc007-cue-no-id-error.vtt (166079 => 166080)
--- trunk/LayoutTests/media/track/captions-webvtt/tc007-cue-no-id-error.vtt 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/LayoutTests/media/track/captions-webvtt/tc007-cue-no-id-error.vtt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -1,5 +1,5 @@
WEBVTT
-Cue identifiers cannot contain "-->". Whole cue is ignored.
+Cue identifiers may contain "-->", but are treated as blank.
-->
00:00:00.000 --> 00:00:30.500
Modified: trunk/LayoutTests/media/track/captions-webvtt/tc011-cues-no-separation.vtt (166079 => 166080)
--- trunk/LayoutTests/media/track/captions-webvtt/tc011-cues-no-separation.vtt 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/LayoutTests/media/track/captions-webvtt/tc011-cues-no-separation.vtt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -1,5 +1,5 @@
WEBVTT
-Cues must be separated by at least one blank line, otherwise treated like one big cue.
+Cues do not need to be separated.
1
00:00:00.000 --> 00:00:30.500
Added: trunk/LayoutTests/media/track/captions-webvtt/tc031-cue-recovery-cuetext.vtt (0 => 166080)
--- trunk/LayoutTests/media/track/captions-webvtt/tc031-cue-recovery-cuetext.vtt (rev 0)
+++ trunk/LayoutTests/media/track/captions-webvtt/tc031-cue-recovery-cuetext.vtt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -0,0 +1,6 @@
+WEBVTT
+
+00:00.000 --> 00:01.000
+Valid cue 1
+00:02.000 --> 00:03.000
+Valid cue 2
Added: trunk/LayoutTests/media/track/captions-webvtt/tc031-cue-recovery-header.vtt (0 => 166080)
--- trunk/LayoutTests/media/track/captions-webvtt/tc031-cue-recovery-header.vtt (rev 0)
+++ trunk/LayoutTests/media/track/captions-webvtt/tc031-cue-recovery-header.vtt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -0,0 +1,6 @@
+WEBVTT
+00:00.000 --> 00:01.000
+Valid cue 1
+
+00:02.000 --> 00:03.000
+Valid cue 2
Added: trunk/LayoutTests/media/track/captions-webvtt/tc031-cue-recovery-note.vtt (0 => 166080)
--- trunk/LayoutTests/media/track/captions-webvtt/tc031-cue-recovery-note.vtt (rev 0)
+++ trunk/LayoutTests/media/track/captions-webvtt/tc031-cue-recovery-note.vtt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -0,0 +1,9 @@
+WEBVTT
+
+00:00.000 --> 00:01.000
+Valid cue 1
+
+NOTE about something
+NOTE or something else - maybe an identifier
+00:02.000 --> 00:03.000
+Valid cue 2
Added: trunk/LayoutTests/media/track/captions-webvtt/tc032-degenerate-cues.vtt (0 => 166080)
--- trunk/LayoutTests/media/track/captions-webvtt/tc032-degenerate-cues.vtt (rev 0)
+++ trunk/LayoutTests/media/track/captions-webvtt/tc032-degenerate-cues.vtt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -0,0 +1,5 @@
+WEBVTT
+
+00:00.000 --> 00:01.000
+00:02.000 --> 00:03.000
+00:04.000 --> 00:05.000
Modified: trunk/LayoutTests/media/track/track-webvtt-tc006-cue-identifiers-expected.txt (166079 => 166080)
--- trunk/LayoutTests/media/track/track-webvtt-tc006-cue-identifiers-expected.txt 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/LayoutTests/media/track/track-webvtt-tc006-cue-identifiers-expected.txt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -1,4 +1,4 @@
-Tests that any text other than "-->" is recognized as optional cue identifier.
+Tests that any text (including "-->") is recognized as optional cue identifier.
@@ -22,6 +22,15 @@
EXPECTED (cues[3].text == 'Duplicate identifier') OK
*** Testing text track 1
-EXPECTED (cues.length == '0') OK
+EXPECTED (cues.length == '3') OK
+EXPECTED (cues[0].id == '') OK
+EXPECTED (cues[0].startTime == '0') OK
+EXPECTED (cues[0].endTime == '30.5') OK
+EXPECTED (cues[1].id == '') OK
+EXPECTED (cues[1].startTime == '31') OK
+EXPECTED (cues[1].endTime == '60.5') OK
+EXPECTED (cues[2].id == '') OK
+EXPECTED (cues[2].startTime == '61') OK
+EXPECTED (cues[2].endTime == '1200.5') OK
END OF TEST
Modified: trunk/LayoutTests/media/track/track-webvtt-tc006-cue-identifiers.html (166079 => 166080)
--- trunk/LayoutTests/media/track/track-webvtt-tc006-cue-identifiers.html 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/LayoutTests/media/track/track-webvtt-tc006-cue-identifiers.html 2014-03-21 18:41:08 UTC (rev 166080)
@@ -55,9 +55,22 @@
findMediaElement();
var expected =
{
- length : 0,
+ length : 3,
tests:
- [],
+ [
+ {
+ property : "id",
+ values : ["", "", ""],
+ },
+ {
+ property : "startTime",
+ values : [0.0, 31.0, 61.0],
+ },
+ {
+ property : "endTime",
+ values : [30.5, 60.5, 1200.5],
+ },
+ ],
};
testCues(1, expected);
@@ -66,7 +79,7 @@
</script>
</head>
<body _onload_="enableAllTextTracks()">
- <p>Tests that any text other than "-->" is recognized as optional cue identifier.</p>
+ <p>Tests that any text (including "-->") is recognized as optional cue identifier.</p>
<video>
<track src="" _onload_="trackLoaded()">
<track src="" _onload_="trackLoaded()">
Modified: trunk/LayoutTests/media/track/track-webvtt-tc007-cue-no-id-expected.txt (166079 => 166080)
--- trunk/LayoutTests/media/track/track-webvtt-tc007-cue-no-id-expected.txt 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/LayoutTests/media/track/track-webvtt-tc007-cue-no-id-expected.txt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -1,4 +1,4 @@
-Tests empty cue identifiers (they are optional), but makes sure "-->" found leads to discarded cue.
+Tests empty cue identifiers (they are optional), including cues with "-->", which are treated as empty.
@@ -18,6 +18,18 @@
EXPECTED (cues[2].text == 'I said Bear is coming now!!!!') OK
*** Testing text track 1
-EXPECTED (cues.length == '0') OK
+EXPECTED (cues.length == '3') OK
+EXPECTED (cues[0].id == '') OK
+EXPECTED (cues[0].startTime == '0') OK
+EXPECTED (cues[0].endTime == '30.5') OK
+EXPECTED (cues[0].text == 'Bear is Coming!!!!!') OK
+EXPECTED (cues[1].id == '') OK
+EXPECTED (cues[1].startTime == '31') OK
+EXPECTED (cues[1].endTime == '60.5') OK
+EXPECTED (cues[1].text == 'I said Bear is coming!!!!') OK
+EXPECTED (cues[2].id == '') OK
+EXPECTED (cues[2].startTime == '61') OK
+EXPECTED (cues[2].endTime == '1200.5') OK
+EXPECTED (cues[2].text == 'I said Bear is coming now!!!!') OK
END OF TEST
Modified: trunk/LayoutTests/media/track/track-webvtt-tc007-cue-no-id.html (166079 => 166080)
--- trunk/LayoutTests/media/track/track-webvtt-tc007-cue-no-id.html 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/LayoutTests/media/track/track-webvtt-tc007-cue-no-id.html 2014-03-21 18:41:08 UTC (rev 166080)
@@ -55,9 +55,26 @@
findMediaElement();
var expected =
{
- length : 0,
+ length : 3,
tests:
- [],
+ [
+ {
+ property : "id",
+ values : ["", "", ""],
+ },
+ {
+ property : "startTime",
+ values : [0.0, 31.0, 61.0],
+ },
+ {
+ property : "endTime",
+ values : [30.5, 60.5, 1200.5],
+ },
+ {
+ property : "text",
+ values : ["Bear is Coming!!!!!", "I said Bear is coming!!!!", "I said Bear is coming now!!!!"],
+ },
+ ],
};
testCues(1, expected);
@@ -66,7 +83,7 @@
</script>
</head>
<body _onload_="enableAllTextTracks()">
- <p>Tests empty cue identifiers (they are optional), but makes sure "-->" found leads to discarded cue.</p>
+ <p>Tests empty cue identifiers (they are optional), including cues with "-->", which are treated as empty.</p>
<video>
<track src="" _onload_="trackLoaded()">
<track src="" _onload_="trackLoaded()">
Modified: trunk/LayoutTests/media/track/track-webvtt-tc011-blank-lines-expected.txt (166079 => 166080)
--- trunk/LayoutTests/media/track/track-webvtt-tc011-blank-lines-expected.txt 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/LayoutTests/media/track/track-webvtt-tc011-blank-lines-expected.txt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -1,7 +1,9 @@
-Tests that cues are not affected by multiple newlines \n, \r, and \r\n and that cue not properly separated are treated as one big cue.
+Tests that cues are not affected by multiple newlines \n, \r, and \r\n and that cues that are not separated by whitespace are handled properly.
+Note that cues not separated by whitespace will merge portions of the following cue (e.g., the '2' from the unseparated cue in the second track becomes part of the prior cue.)
+
*** Testing text track 0
EXPECTED (cues.length == '3') OK
EXPECTED (cues[0].id == '1') OK
@@ -18,6 +20,18 @@
EXPECTED (cues[2].text == 'I said Bear is coming now!!!!') OK
*** Testing text track 1
-EXPECTED (cues.length == '1') OK
+EXPECTED (cues.length == '3') OK
+EXPECTED (cues[0].id == '1') OK
+EXPECTED (cues[0].startTime == '0') OK
+EXPECTED (cues[0].endTime == '30.5') OK
+EXPECTED (cues[0].text == 'Bear is Coming!!!!! 2') OK
+EXPECTED (cues[1].id == '') OK
+EXPECTED (cues[1].startTime == '31') OK
+EXPECTED (cues[1].endTime == '60.5') OK
+EXPECTED (cues[1].text == 'I said Bear is coming!!!!') OK
+EXPECTED (cues[2].id == '') OK
+EXPECTED (cues[2].startTime == '61') OK
+EXPECTED (cues[2].endTime == '361200.5') OK
+EXPECTED (cues[2].text == 'I said Bear is coming now!!!!') OK
END OF TEST
Modified: trunk/LayoutTests/media/track/track-webvtt-tc011-blank-lines.html (166079 => 166080)
--- trunk/LayoutTests/media/track/track-webvtt-tc011-blank-lines.html 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/LayoutTests/media/track/track-webvtt-tc011-blank-lines.html 2014-03-21 18:41:08 UTC (rev 166080)
@@ -54,9 +54,26 @@
findMediaElement();
var expected =
{
- length : 1,
+ length : 3,
tests:
- [],
+ [
+ {
+ property : "id",
+ values : ["1", "", ""],
+ },
+ {
+ property : "startTime",
+ values : [0.0, 31.0, 61.0],
+ },
+ {
+ property : "endTime",
+ values : [30.5, 60.5, 361200.5],
+ },
+ {
+ property : "text",
+ values : ["Bear is Coming!!!!!\n2", "I said Bear is coming!!!!", "I said Bear is coming now!!!!"],
+ },
+ ],
};
testCues(1, expected);
@@ -65,7 +82,8 @@
</script>
</head>
<body _onload_="enableAllTextTracks()">
- <p>Tests that cues are not affected by multiple newlines \n, \r, and \r\n and that cue not properly separated are treated as one big cue.</p>
+ <p>Tests that cues are not affected by multiple newlines \n, \r, and \r\n and that cues that are not separated by whitespace are handled properly.</p>
+ <p>Note that cues not separated by whitespace will merge portions of the following cue (e.g., the '2' from the unseparated cue in the second track becomes part of the prior cue.)</p>
<video>
<track src="" _onload_="trackLoaded()">
<track src="" _onload_="trackLoaded()">
Added: trunk/LayoutTests/media/track/track-webvtt-tc031-cue-recovery-expected.txt (0 => 166080)
--- trunk/LayoutTests/media/track/track-webvtt-tc031-cue-recovery-expected.txt (rev 0)
+++ trunk/LayoutTests/media/track/track-webvtt-tc031-cue-recovery-expected.txt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -0,0 +1,32 @@
+Tests that a cue is recovered when a line with a "-->" is encountered (missing blank line separator).
+
+
+
+*** Testing text track 0
+EXPECTED (cues.length == '2') OK
+EXPECTED (cues[0].startTime == '0') OK
+EXPECTED (cues[0].endTime == '1') OK
+EXPECTED (cues[0].text == 'Valid cue 1') OK
+EXPECTED (cues[1].startTime == '2') OK
+EXPECTED (cues[1].endTime == '3') OK
+EXPECTED (cues[1].text == 'Valid cue 2') OK
+
+*** Testing text track 1
+EXPECTED (cues.length == '2') OK
+EXPECTED (cues[0].startTime == '0') OK
+EXPECTED (cues[0].endTime == '1') OK
+EXPECTED (cues[0].text == 'Valid cue 1') OK
+EXPECTED (cues[1].startTime == '2') OK
+EXPECTED (cues[1].endTime == '3') OK
+EXPECTED (cues[1].text == 'Valid cue 2') OK
+
+*** Testing text track 2
+EXPECTED (cues.length == '2') OK
+EXPECTED (cues[0].startTime == '0') OK
+EXPECTED (cues[0].endTime == '1') OK
+EXPECTED (cues[0].text == 'Valid cue 1') OK
+EXPECTED (cues[1].startTime == '2') OK
+EXPECTED (cues[1].endTime == '3') OK
+EXPECTED (cues[1].text == 'Valid cue 2') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/track/track-webvtt-tc031-cue-recovery.html (0 => 166080)
--- trunk/LayoutTests/media/track/track-webvtt-tc031-cue-recovery.html (rev 0)
+++ trunk/LayoutTests/media/track/track-webvtt-tc031-cue-recovery.html 2014-03-21 18:41:08 UTC (rev 166080)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <script src=""
+ <script src=""
+ <script>
+
+ numberOfTrackTests = 3;
+
+ function trackLoaded()
+ {
+ numberOfTracksLoaded++;
+ if (numberOfTracksLoaded == numberOfTrackTests) {
+ testTrack(0);
+ testTrack(1);
+ testTrack(2);
+ }
+ }
+
+ function testTrack(i)
+ {
+ findMediaElement();
+ var expected =
+ {
+ length: 2,
+ tests:
+ [
+ {
+ property: "startTime",
+ values: [ "0", "2" ],
+ },
+ {
+ property: "endTime",
+ values: [ "1", "3" ],
+ },
+ {
+ property: "text",
+ values:
+ [
+ 'Valid cue 1',
+ 'Valid cue 2',
+ ],
+ },
+ ],
+ };
+
+ testCues(i, expected);
+
+ allTestsEnded();
+ }
+ </script>
+ </head>
+ <body _onload_="enableAllTextTracks()">
+ <p>Tests that a cue is recovered when a line with a "-->" is encountered (missing blank line separator).</p>
+ <video>
+ <track src="" _onload_="trackLoaded()">
+ <track src="" _onload_="trackLoaded()">
+ <track src="" _onload_="trackLoaded()">
+ </video>
+ </body>
+</html>
Added: trunk/LayoutTests/media/track/track-webvtt-tc032-degenerate-cues-expected.txt (0 => 166080)
--- trunk/LayoutTests/media/track/track-webvtt-tc032-degenerate-cues-expected.txt (rev 0)
+++ trunk/LayoutTests/media/track/track-webvtt-tc032-degenerate-cues-expected.txt 2014-03-21 18:41:08 UTC (rev 166080)
@@ -0,0 +1,17 @@
+Tests that a degenerate cues without separating blank lines are parsed correctly.
+
+
+
+*** Testing text track 0
+EXPECTED (cues.length == '3') OK
+EXPECTED (cues[0].startTime == '0') OK
+EXPECTED (cues[0].endTime == '1') OK
+EXPECTED (cues[0].text == '') OK
+EXPECTED (cues[1].startTime == '2') OK
+EXPECTED (cues[1].endTime == '3') OK
+EXPECTED (cues[1].text == '') OK
+EXPECTED (cues[2].startTime == '4') OK
+EXPECTED (cues[2].endTime == '5') OK
+EXPECTED (cues[2].text == '') OK
+END OF TEST
+
Added: trunk/LayoutTests/media/track/track-webvtt-tc032-degenerate-cues.html (0 => 166080)
--- trunk/LayoutTests/media/track/track-webvtt-tc032-degenerate-cues.html (rev 0)
+++ trunk/LayoutTests/media/track/track-webvtt-tc032-degenerate-cues.html 2014-03-21 18:41:08 UTC (rev 166080)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+ <script src=""
+ <script src=""
+ <script>
+
+ numberOfTrackTests = 1;
+
+ function trackLoaded()
+ {
+ numberOfTracksLoaded++;
+ if (numberOfTracksLoaded == numberOfTrackTests) {
+ testTrack0();
+ }
+ }
+
+ function testTrack0()
+ {
+ findMediaElement();
+ var expected =
+ {
+ length: 3,
+ tests:
+ [
+ {
+ property: "startTime",
+ values: [ "0", "2", "4" ],
+ },
+ {
+ property: "endTime",
+ values: [ "1", "3", "5" ],
+ },
+ {
+ property: "text",
+ values: [ '', '', '' ],
+ },
+ ],
+ };
+
+ testCues(0, expected);
+
+ allTestsEnded();
+ }
+ </script>
+ </head>
+ <body _onload_="enableAllTextTracks()">
+ <p>Tests that a degenerate cues without separating blank lines are parsed correctly.</p>
+ <video>
+ <track src="" _onload_="trackLoaded()">
+ </video>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (166079 => 166080)
--- trunk/Source/WebCore/ChangeLog 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/Source/WebCore/ChangeLog 2014-03-21 18:41:08 UTC (rev 166080)
@@ -1,3 +1,24 @@
+2014-03-21 Brent Fulgham <bfulg...@apple.com>
+
+ Handle recovery on "timestamp-looking" lines in the WebVTT parser
+ https://bugs.webkit.org/show_bug.cgi?id=130610
+
+ Reviewed by Eric Carlson.
+
+ Merged from Blink (patch by f...@opera.com):
+ https://chromium.googlesource.com/chromium/blink/+/b669a380efbffe25f3b154b026b57b9822ce08e2
+ http://crbug.com/75273002
+
+ Tests: media/track/track-webvtt-tc031-cue-recovery.html
+ media/track/track-webvtt-tc032-degenerate-cues.html
+
+ * html/track/WebVTTParser.cpp:
+ (WebCore::WebVTTParser::parse):
+ (WebCore::WebVTTParser::collectCueText):
+ (WebCore::WebVTTParser::recoverCue):
+ (WebCore::WebVTTParser::ignoreBadCue):
+ * html/track/WebVTTParser.h:
+
2014-03-21 Andreas Kling <akl...@apple.com>
Remove unused RenderView::repaintRectangleInViewAndCompositedLayers().
Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (166079 => 166080)
--- trunk/Source/WebCore/html/track/WebVTTParser.cpp 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp 2014-03-21 18:41:08 UTC (rev 166080)
@@ -211,6 +211,10 @@
m_state = Id;
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;
@@ -355,10 +359,19 @@
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);
@@ -366,11 +379,22 @@
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.
Modified: trunk/Source/WebCore/html/track/WebVTTParser.h (166079 => 166080)
--- trunk/Source/WebCore/html/track/WebVTTParser.h 2014-03-21 18:28:06 UTC (rev 166079)
+++ trunk/Source/WebCore/html/track/WebVTTParser.h 2014-03-21 18:41:08 UTC (rev 166080)
@@ -165,6 +165,7 @@
ParseState collectCueId(const String&);
ParseState collectTimingsAndSettings(const String&);
ParseState collectCueText(const String&);
+ ParseState recoverCue(const String&);
ParseState ignoreBadCue(const String&);
void createNewCue();