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

Unified Diff: Source/core/editing/MarkupAccumulator.cpp

Issue 114103005: Use StringBuilder::appendLiteral() when possible in MarkupAccumulator (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months 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/editing/markup.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/MarkupAccumulator.cpp
diff --git a/Source/core/editing/MarkupAccumulator.cpp b/Source/core/editing/MarkupAccumulator.cpp
index 09bd7fe3c4f9ee273823cfee7c14d2c2a73efe6a..fa40fe32d30d6686d00af997d4c1df5205a931df 100644
--- a/Source/core/editing/MarkupAccumulator.cpp
+++ b/Source/core/editing/MarkupAccumulator.cpp
@@ -289,8 +289,7 @@ void MarkupAccumulator::appendNamespace(StringBuilder& result, const AtomicStrin
result.append(prefix);
}
- result.append('=');
- result.append('"');
+ result.appendLiteral("=\"");
appendAttributeValue(result, namespaceURI, false);
result.append('"');
}
@@ -358,8 +357,7 @@ void MarkupAccumulator::appendDocumentType(StringBuilder& result, const Document
result.append(n->publicId());
result.append('"');
if (!n->systemId().isEmpty()) {
- result.append(' ');
- result.append('"');
+ result.appendLiteral(" \"");
result.append(n->systemId());
result.append('"');
}
@@ -369,8 +367,7 @@ void MarkupAccumulator::appendDocumentType(StringBuilder& result, const Document
result.append('"');
}
if (!n->internalSubset().isEmpty()) {
- result.append(' ');
- result.append('[');
+ result.appendLiteral(" [");
result.append(n->internalSubset());
result.append(']');
}
@@ -380,13 +377,11 @@ void MarkupAccumulator::appendDocumentType(StringBuilder& result, const Document
void MarkupAccumulator::appendProcessingInstruction(StringBuilder& result, const String& target, const String& data)
{
// FIXME: PI data is not escaped, but XMLSerializer (and possibly other callers) this should raise an exception if it includes "?>".
- result.append('<');
- result.append('?');
+ result.appendLiteral("<?");
result.append(target);
result.append(' ');
result.append(data);
- result.append('?');
- result.append('>');
+ result.appendLiteral("?>");
}
void MarkupAccumulator::appendElement(StringBuilder& result, Element* element, Namespaces* namespaces)
@@ -543,8 +538,7 @@ void MarkupAccumulator::appendEndMarkup(StringBuilder& result, const Node* node)
if (!node->isElementNode() || shouldSelfClose(node) || (!node->hasChildNodes() && elementCannotHaveEndTag(node)))
return;
- result.append('<');
- result.append('/');
+ result.appendLiteral("</");
result.append(toElement(node)->nodeNamePreservingCase());
result.append('>');
}
« no previous file with comments | « no previous file | Source/core/editing/markup.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698