Index: Source/core/html/track/vtt/VTTTokenizer.cpp |
diff --git a/Source/core/html/track/vtt/VTTTokenizer.cpp b/Source/core/html/track/vtt/VTTTokenizer.cpp |
index 0d84269f9a0dcba757cd064e0eab6ec0a8f81b9d..5bb06112a987fc794b159ba5aeedac7a6b812c91 100644 |
--- a/Source/core/html/track/vtt/VTTTokenizer.cpp |
+++ b/Source/core/html/track/vtt/VTTTokenizer.cpp |
@@ -106,6 +106,7 @@ bool VTTTokenizer::nextToken(VTTToken& token) |
StartTagAnnotationState, |
EndTagState, |
TimestampTagState, |
+ EscapeCharacterState, |
} state = DataState; |
// 4.8.10.13.4 WebVTT cue text tokenizer |
@@ -151,6 +152,9 @@ bool VTTTokenizer::nextToken(VTTToken& token) |
} |
buffer.clear(); |
WEBVTT_ADVANCE_TO(DataState); |
+ } else if (cc == '#') { |
+ buffer.clear(); |
+ WEBVTT_ADVANCE_TO(EscapeCharacterState); |
} else if (isASCIIAlphanumeric(cc)) { |
buffer.append(static_cast<LChar>(cc)); |
WEBVTT_ADVANCE_TO(EscapeState); |
@@ -174,6 +178,22 @@ bool VTTTokenizer::nextToken(VTTToken& token) |
} |
END_STATE() |
+ WEBVTT_BEGIN_STATE(EscapeCharacterState) { |
+ if (cc == ';') { |
+ unsigned charCode = buffer.toString().toUIntStrict(); |
+ result.append(static_cast<UChar>(charCode)); |
+ buffer.clear(); |
+ WEBVTT_ADVANCE_TO(DataState); |
+ } else if (WTF::isASCIIDigit(cc)) { |
+ buffer.append(static_cast<LChar>(cc)); |
+ WEBVTT_ADVANCE_TO(EscapeCharacterState); |
+ } else { |
+ buffer.clear(); |
+ WEBVTT_ADVANCE_TO(DataState); |
+ } |
+ } |
+ END_STATE() |
+ |
WEBVTT_BEGIN_STATE(TagState) { |
if (isTokenizerWhitespace(cc)) { |
ASSERT(result.isEmpty()); |