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

Unified Diff: Source/core/html/track/vtt/VTTParser.cpp

Issue 81113003: Turn VTTToken into an immutable object (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/html/track/vtt/VTTToken.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 77e314a733f07acf3ec2a0c8e2e8a8feb06c5114..eeb0c9f0cfa7c74a2df86191e076d01773de0d30 100644
--- a/Source/core/html/track/vtt/VTTParser.cpp
+++ b/Source/core/html/track/vtt/VTTParser.cpp
@@ -386,7 +386,6 @@ PassRefPtr<DocumentFragment> VTTTreeBuilder::buildFromString(const String& cueTe
m_currentNode = fragment;
VTTTokenizer tokenizer(cueText);
- m_token.clear();
m_languageStack.clear();
while (tokenizer.nextToken(m_token))
@@ -538,8 +537,7 @@ void VTTTreeBuilder::constructTreeFromToken(Document& document)
switch (m_token.type()) {
case VTTTokenTypes::Character: {
- String content = m_token.characters().toString();
- RefPtr<Text> child = Text::create(document, content);
+ RefPtr<Text> child = Text::create(document, m_token.characters());
m_currentNode->parserAppendChild(child);
break;
}
@@ -550,12 +548,12 @@ void VTTTreeBuilder::constructTreeFromToken(Document& document)
child = VTTElement::create(nodeType, &document);
if (child) {
if (!m_token.classes().isEmpty())
- child->setAttribute(classAttr, m_token.classes().toAtomicString());
+ child->setAttribute(classAttr, m_token.classes());
if (child->webVTTNodeType() == VTTNodeTypeVoice) {
- child->setAttribute(VTTElement::voiceAttributeName(), m_token.annotation().toAtomicString());
+ child->setAttribute(VTTElement::voiceAttributeName(), m_token.annotation());
} else if (child->webVTTNodeType() == VTTNodeTypeLanguage) {
- m_languageStack.append(m_token.annotation().toAtomicString());
+ m_languageStack.append(m_token.annotation());
child->setAttribute(VTTElement::langAttributeName(), m_languageStack.last());
}
if (!m_languageStack.isEmpty())
@@ -577,7 +575,7 @@ void VTTTreeBuilder::constructTreeFromToken(Document& document)
}
case VTTTokenTypes::TimestampTag: {
unsigned position = 0;
- String charactersString = m_token.characters().toString();
+ String charactersString = m_token.characters();
double time = VTTParser::collectTimeStamp(charactersString, &position);
if (time != malformedTime)
m_currentNode->parserAppendChild(ProcessingInstruction::create(document, "timestamp", charactersString));
@@ -586,7 +584,6 @@ void VTTTreeBuilder::constructTreeFromToken(Document& document)
default:
break;
}
- m_token.clear();
}
void VTTParser::skipWhiteSpace(const String& line, unsigned* position)
« no previous file with comments | « no previous file | Source/core/html/track/vtt/VTTToken.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698