Use StringBuilder append(char) and appendLiteral in more places
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Sep 2014 18:42:54 +0000 (18:42 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Sep 2014 18:42:54 +0000 (18:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136470

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-09-03
Reviewed by Andreas Kling.

* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::loggingString):
* Modules/websockets/WebSocket.cpp:
(WebCore::encodeProtocolString):
* Modules/websockets/WebSocketExtensionDispatcher.cpp:
(WebCore::WebSocketExtensionDispatcher::createHeaderValue):
(WebCore::WebSocketExtensionDispatcher::appendAcceptedExtension):
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::clientLocation):
(WebCore::WebSocketHandshake::clientHandshakeMessage):
* css/CSSCalculationValue.cpp:
(WebCore::buildCssText):
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::cssText):
* css/CSSMediaRule.cpp:
(WebCore::CSSMediaRule::cssText):
* css/CSSSelectorList.cpp:
(WebCore::CSSSelectorList::selectorsText):
* css/CSSSupportsRule.cpp:
(WebCore::CSSSupportsRule::cssText):
* css/MediaQuery.cpp:
(WebCore::MediaQuery::serialize):
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::generateUniquePrefix):
* editing/markup.cpp:
(WebCore::urlToMarkup):
* fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::convertToDataURL):
* html/EmailInputType.cpp:
(WebCore::EmailInputType::sanitizeValue):
* html/FormController.cpp:
(WebCore::recordFormStructure):
* html/parser/XSSAuditorDelegate.cpp:
(WebCore::buildConsoleError):
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::collectCueText):
* mathml/MathMLMencloseElement.cpp:
(WebCore::MathMLMencloseElement::longDivLeftPadding):
* page/PageSerializer.cpp:
(WebCore::SerializerMarkupAccumulator::appendElement):
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::toRawString):
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::logThreadedScrollingMode):
* platform/PODInterval.h:
(WebCore::PODInterval::toString):
* platform/PODRedBlackTree.h:
(WebCore::PODRedBlackTree::dumpFromNode):
* platform/UUID.cpp:
(WebCore::createCanonicalUUIDString):
* platform/network/ProxyServer.cpp:
(WebCore::appendProxyServerString):
(WebCore::toString):
* platform/text/DateTimeFormat.cpp:
(WebCore::DateTimeFormat::quoteAndAppendLiteral):
* platform/text/PlatformLocale.cpp:
(WebCore::DateTimeStringBuilder::zeroPadString):
(WebCore::Locale::convertFromLocalizedNumber):
* platform/text/TextStream.cpp:
(WebCore::TextStream::operator<<):
* rendering/RenderListMarker.cpp:
(WebCore::listMarkerText):
* testing/Internals.cpp:
(WebCore::Internals::parserMetaData):
(WebCore::Internals::getCurrentCursorInfo):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173212 268f45cc-cd09-0410-ab3c-d52691b4dbfc

32 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBKeyData.cpp
Source/WebCore/Modules/websockets/WebSocket.cpp
Source/WebCore/Modules/websockets/WebSocketExtensionDispatcher.cpp
Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSMediaRule.cpp
Source/WebCore/css/CSSSelectorList.cpp
Source/WebCore/css/CSSSupportsRule.cpp
Source/WebCore/css/MediaQuery.cpp
Source/WebCore/editing/MarkupAccumulator.cpp
Source/WebCore/editing/markup.cpp
Source/WebCore/fileapi/FileReaderLoader.cpp
Source/WebCore/html/EmailInputType.cpp
Source/WebCore/html/FormController.cpp
Source/WebCore/html/parser/XSSAuditorDelegate.cpp
Source/WebCore/html/track/WebVTTParser.cpp
Source/WebCore/mathml/MathMLMencloseElement.cpp
Source/WebCore/page/PageSerializer.cpp
Source/WebCore/page/SecurityOrigin.cpp
Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
Source/WebCore/platform/PODInterval.h
Source/WebCore/platform/PODRedBlackTree.h
Source/WebCore/platform/UUID.cpp
Source/WebCore/platform/network/ProxyServer.cpp
Source/WebCore/platform/text/DateTimeFormat.cpp
Source/WebCore/platform/text/PlatformLocale.cpp
Source/WebCore/platform/text/TextStream.cpp
Source/WebCore/rendering/RenderListMarker.cpp
Source/WebCore/testing/Internals.cpp

index 3cf2a37..75f3ba7 100644 (file)
@@ -1,3 +1,78 @@
+2014-09-03  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Use StringBuilder append(char) and appendLiteral in more places
+        https://bugs.webkit.org/show_bug.cgi?id=136470
+
+        Reviewed by Andreas Kling.
+
+        * Modules/indexeddb/IDBKeyData.cpp:
+        (WebCore::IDBKeyData::loggingString):
+        * Modules/websockets/WebSocket.cpp:
+        (WebCore::encodeProtocolString):
+        * Modules/websockets/WebSocketExtensionDispatcher.cpp:
+        (WebCore::WebSocketExtensionDispatcher::createHeaderValue):
+        (WebCore::WebSocketExtensionDispatcher::appendAcceptedExtension):
+        * Modules/websockets/WebSocketHandshake.cpp:
+        (WebCore::WebSocketHandshake::clientLocation):
+        (WebCore::WebSocketHandshake::clientHandshakeMessage):
+        * css/CSSCalculationValue.cpp:
+        (WebCore::buildCssText):
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::cssText):
+        * css/CSSMediaRule.cpp:
+        (WebCore::CSSMediaRule::cssText):
+        * css/CSSSelectorList.cpp:
+        (WebCore::CSSSelectorList::selectorsText):
+        * css/CSSSupportsRule.cpp:
+        (WebCore::CSSSupportsRule::cssText):
+        * css/MediaQuery.cpp:
+        (WebCore::MediaQuery::serialize):
+        * editing/MarkupAccumulator.cpp:
+        (WebCore::MarkupAccumulator::generateUniquePrefix):
+        * editing/markup.cpp:
+        (WebCore::urlToMarkup):
+        * fileapi/FileReaderLoader.cpp:
+        (WebCore::FileReaderLoader::convertToDataURL):
+        * html/EmailInputType.cpp:
+        (WebCore::EmailInputType::sanitizeValue):
+        * html/FormController.cpp:
+        (WebCore::recordFormStructure):
+        * html/parser/XSSAuditorDelegate.cpp:
+        (WebCore::buildConsoleError):
+        * html/track/WebVTTParser.cpp:
+        (WebCore::WebVTTParser::collectCueText):
+        * mathml/MathMLMencloseElement.cpp:
+        (WebCore::MathMLMencloseElement::longDivLeftPadding):
+        * page/PageSerializer.cpp:
+        (WebCore::SerializerMarkupAccumulator::appendElement):
+        * page/SecurityOrigin.cpp:
+        (WebCore::SecurityOrigin::toRawString):
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
+        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
+        (WebCore::logThreadedScrollingMode):
+        * platform/PODInterval.h:
+        (WebCore::PODInterval::toString):
+        * platform/PODRedBlackTree.h:
+        (WebCore::PODRedBlackTree::dumpFromNode):
+        * platform/UUID.cpp:
+        (WebCore::createCanonicalUUIDString):
+        * platform/network/ProxyServer.cpp:
+        (WebCore::appendProxyServerString):
+        (WebCore::toString):
+        * platform/text/DateTimeFormat.cpp:
+        (WebCore::DateTimeFormat::quoteAndAppendLiteral):
+        * platform/text/PlatformLocale.cpp:
+        (WebCore::DateTimeStringBuilder::zeroPadString):
+        (WebCore::Locale::convertFromLocalizedNumber):
+        * platform/text/TextStream.cpp:
+        (WebCore::TextStream::operator<<):
+        * rendering/RenderListMarker.cpp:
+        (WebCore::listMarkerText):
+        * testing/Internals.cpp:
+        (WebCore::Internals::parserMetaData):
+        (WebCore::Internals::getCurrentCursorInfo):
+
 2014-09-03  Bear Travis  <betravis@adobe.com>
 
         [CSS Font Loading] Enable Page Caching
index 7961cce..044b147 100644 (file)
@@ -266,9 +266,9 @@ String IDBKeyData::loggingString() const
             for (size_t i = 0; i < arrayValue.size(); ++i) {
                 result.append(arrayValue[i].loggingString());
                 if (i < arrayValue.size() - 1)
-                    result.append(", ");
+                    result.appendLiteral(", ");
             }
-            result.append(" }");
+            result.appendLiteral(" }");
             return result.toString();
         }
     case IDBKey::StringType:
index 0dcd389..ec26a5e 100644 (file)
@@ -97,7 +97,7 @@ static String encodeProtocolString(const String& protocol)
         if (protocol[i] < 0x20 || protocol[i] > 0x7E)
             builder.append(String::format("\\u%04X", protocol[i]));
         else if (protocol[i] == 0x5c)
-            builder.append("\\\\");
+            builder.appendLiteral("\\\\");
         else
             builder.append(protocol[i]);
     }
index 06b7194..8daa69c 100644 (file)
@@ -69,7 +69,7 @@ const String WebSocketExtensionDispatcher::createHeaderValue() const
     StringBuilder builder;
     builder.append(m_processors[0]->handshakeString());
     for (size_t i = 1; i < numProcessors; ++i) {
-        builder.append(", ");
+        builder.appendLiteral(", ");
         builder.append(m_processors[i]->handshakeString());
     }
     return builder.toString();
@@ -78,14 +78,14 @@ const String WebSocketExtensionDispatcher::createHeaderValue() const
 void WebSocketExtensionDispatcher::appendAcceptedExtension(const String& extensionToken, HashMap<String, String>& extensionParameters)
 {
     if (!m_acceptedExtensionsBuilder.isEmpty())
-        m_acceptedExtensionsBuilder.append(", ");
+        m_acceptedExtensionsBuilder.appendLiteral(", ");
     m_acceptedExtensionsBuilder.append(extensionToken);
     // FIXME: Should use ListHashSet to keep the order of the parameters.
     for (HashMap<String, String>::const_iterator iterator = extensionParameters.begin(); iterator != extensionParameters.end(); ++iterator) {
-        m_acceptedExtensionsBuilder.append("; ");
+        m_acceptedExtensionsBuilder.appendLiteral("; ");
         m_acceptedExtensionsBuilder.append(iterator->key);
         if (!iterator->value.isNull()) {
-            m_acceptedExtensionsBuilder.append("=");
+            m_acceptedExtensionsBuilder.append('=');
             m_acceptedExtensionsBuilder.append(iterator->value);
         }
     }
index 33fdcba..cce332b 100644 (file)
@@ -172,7 +172,7 @@ String WebSocketHandshake::clientLocation() const
 {
     StringBuilder builder;
     builder.append(m_secure ? "wss" : "ws");
-    builder.append("://");
+    builder.appendLiteral("://");
     builder.append(hostName(m_url, m_secure));
     builder.append(resourceName(m_url));
     return builder.toString();
@@ -183,9 +183,9 @@ CString WebSocketHandshake::clientHandshakeMessage() const
     // Keep the following consistent with clientHandshakeRequest().
     StringBuilder builder;
 
-    builder.append("GET ");
+    builder.appendLiteral("GET ");
     builder.append(resourceName(m_url));
-    builder.append(" HTTP/1.1\r\n");
+    builder.appendLiteral(" HTTP/1.1\r\n");
 
     Vector<String> fields;
     fields.append("Upgrade: websocket");
@@ -226,10 +226,10 @@ CString WebSocketHandshake::clientHandshakeMessage() const
 
     for (size_t i = 0; i < fields.size(); i++) {
         builder.append(fields[i]);
-        builder.append("\r\n");
+        builder.appendLiteral("\r\n");
     }
 
-    builder.append("\r\n");
+    builder.appendLiteral("\r\n");
 
     return builder.toString().utf8();
 }
index 0887260..37a8171 100644 (file)
@@ -159,7 +159,7 @@ static bool hasDoubleValue(CSSPrimitiveValue::UnitTypes type)
 static String buildCssText(const String& expression)
 {
     StringBuilder result;
-    result.append("calc");
+    result.appendLiteral("calc");
     bool expressionHasSingleTerm = expression[0] != '(';
     if (expressionHasSingleTerm)
         result.append('(');
index 6273e1a..7bcd34a 100644 (file)
@@ -1278,7 +1278,7 @@ String CSSComputedStyleDeclaration::cssText() const
         if (i)
             result.append(' ');
         result.append(getPropertyName(computedProperties[i]));
-        result.append(": ", 2);
+        result.appendLiteral(": ");
         result.append(getPropertyValue(computedProperties[i]));
         result.append(';');
     }
index a2c07d6..5e96e41 100644 (file)
@@ -51,7 +51,7 @@ MediaQuerySet* CSSMediaRule::mediaQueries() const
 String CSSMediaRule::cssText() const
 {
     StringBuilder result;
-    result.append("@media ");
+    result.appendLiteral("@media ");
     if (mediaQueries()) {
         result.append(mediaQueries()->mediaText());
         result.append(' ');
index 62aa276..037641c 100644 (file)
@@ -125,7 +125,7 @@ String CSSSelectorList::selectorsText() const
 
     for (const CSSSelector* s = first(); s; s = next(s)) {
         if (s != first())
-            result.append(", ");
+            result.appendLiteral(", ");
         result.append(s->selectorText());
     }
 
index fe2fad9..a66ffa2 100644 (file)
@@ -50,9 +50,9 @@ String CSSSupportsRule::cssText() const
 {
     StringBuilder result;
 
-    result.append("@supports ");
+    result.appendLiteral("@supports ");
     result.append(conditionText());
-    result.append(" {\n");
+    result.appendLiteral(" {\n");
     appendCssTextForItems(result);
     result.append('}');
 
index c6dd52a..93d88f3 100644 (file)
@@ -41,10 +41,10 @@ String MediaQuery::serialize() const
     if (!m_ignored) {
         switch (m_restrictor) {
         case MediaQuery::Only:
-            result.append("only ");
+            result.appendLiteral("only ");
             break;
         case MediaQuery::Not:
-            result.append("not ");
+            result.appendLiteral("not ");
             break;
         case MediaQuery::None:
             break;
@@ -57,17 +57,17 @@ String MediaQuery::serialize() const
 
         if (m_mediaType != "all" || m_restrictor != None) {
             result.append(m_mediaType);
-            result.append(" and ");
+            result.appendLiteral(" and ");
         }
 
         result.append(m_expressions->at(0)->serialize());
         for (size_t i = 1; i < m_expressions->size(); ++i) {
-            result.append(" and ");
+            result.appendLiteral(" and ");
             result.append(m_expressions->at(i)->serialize());
         }
     } else {
         // If query is invalid, serialized text should turn into "not all".
-        result.append("not all");
+        result.appendLiteral("not all");
     }
     return result.toString();
 }
index 172b85c..17ce3a3 100644 (file)
@@ -493,7 +493,7 @@ void MarkupAccumulator::generateUniquePrefix(QualifiedName& prefixedName, const
     StringBuilder builder;
     do {
         builder.clear();
-        builder.append("NS");
+        builder.appendLiteral("NS");
         builder.appendNumber(++m_prefixLevel);
         const AtomicString& name = builder.toAtomicString();
         if (!namespaces.get(name.impl())) {
index d7e42f9..af7ff4e 100644 (file)
@@ -858,11 +858,11 @@ String createFullMarkup(const Range& range)
 String urlToMarkup(const URL& url, const String& title)
 {
     StringBuilder markup;
-    markup.append("<a href=\"");
+    markup.appendLiteral("<a href=\"");
     markup.append(url.string());
-    markup.append("\">");
+    markup.appendLiteral("\">");
     MarkupAccumulator::appendCharactersReplacingEntities(markup, title, 0, title.length(), EntityMaskInPCDATA);
-    markup.append("</a>");
+    markup.appendLiteral("</a>");
     return markup.toString();
 }
 
index 4505755..4d7687d 100644 (file)
@@ -326,7 +326,7 @@ void FileReaderLoader::convertToText()
 void FileReaderLoader::convertToDataURL()
 {
     StringBuilder builder;
-    builder.append("data:");
+    builder.appendLiteral("data:");
 
     if (!m_bytesLoaded) {
         m_stringResult = builder.toString();
@@ -334,7 +334,7 @@ void FileReaderLoader::convertToDataURL()
     }
 
     builder.append(m_dataType);
-    builder.append(";base64,");
+    builder.appendLiteral(";base64,");
 
     Vector<char> out;
     base64Encode(m_rawData->data(), m_bytesLoaded, out);
index b01209a..68f35db 100644 (file)
@@ -102,7 +102,7 @@ String EmailInputType::sanitizeValue(const String& proposedValue) const
     StringBuilder strippedValue;
     for (unsigned i = 0; i < addresses.size(); ++i) {
         if (i > 0)
-            strippedValue.append(",");
+            strippedValue.append(',');
         strippedValue.append(stripLeadingAndTrailingHTMLSpaces(addresses[i]));
     }
     return strippedValue.toString();
index 45100d1..b7df2d4 100644 (file)
@@ -302,7 +302,7 @@ static inline void recordFormStructure(const HTMLFormElement& form, StringBuilde
     // 2 is enough to distinguish forms in webkit.org/b/91209#c0
     const size_t namedControlsToBeRecorded = 2;
     const Vector<FormAssociatedElement*>& controls = form.associatedElements();
-    builder.append(" [");
+    builder.appendLiteral(" [");
     for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) {
         if (!controls[i]->isFormControlElementWithState())
             continue;
@@ -314,9 +314,9 @@ static inline void recordFormStructure(const HTMLFormElement& form, StringBuilde
             continue;
         namedControls++;
         builder.append(name);
-        builder.append(" ");
+        builder.append(' ');
     }
-    builder.append("]");
+    builder.append(']');
 }
 
 static inline String formSignature(const HTMLFormElement& form)
index 804c0e5..a32fa08 100644 (file)
@@ -53,20 +53,20 @@ XSSAuditorDelegate::XSSAuditorDelegate(Document& document)
 static inline String buildConsoleError(const XSSInfo& xssInfo)
 {
     StringBuilder message;
-    message.append("The XSS Auditor ");
+    message.appendLiteral("The XSS Auditor ");
     message.append(xssInfo.m_didBlockEntirePage ? "blocked access to" : "refused to execute a script in");
-    message.append(" '");
+    message.appendLiteral(" '");
     message.append(xssInfo.m_originalURL);
-    message.append("' because ");
+    message.appendLiteral("' because ");
     message.append(xssInfo.m_didBlockEntirePage ? "the source code of a script" : "its source code");
-    message.append(" was found within the request.");
+    message.appendLiteral(" was found within the request.");
 
     if (xssInfo.m_didSendCSPHeader)
-        message.append(" The server sent a 'Content-Security-Policy' header requesting this behavior.");
+        message.appendLiteral(" The server sent a 'Content-Security-Policy' header requesting this behavior.");
     else if (xssInfo.m_didSendXSSProtectionHeader)
-        message.append(" The server sent an 'X-XSS-Protection' header requesting this behavior.");
+        message.appendLiteral(" The server sent an 'X-XSS-Protection' header requesting this behavior.");
     else
-        message.append(" The auditor was enabled as the server sent neither an 'X-XSS-Protection' nor 'Content-Security-Policy' header.");
+        message.appendLiteral(" The auditor was enabled as the server sent neither an 'X-XSS-Protection' nor 'Content-Security-Policy' header.");
 
     return message.toString();
 }
index 20652e8..60717a1 100644 (file)
@@ -349,7 +349,7 @@ WebVTTParser::ParseState WebVTTParser::collectCueText(const String& line)
         return recoverCue(line);
     }
     if (!m_currentContent.isEmpty())
-        m_currentContent.append("\n");
+        m_currentContent.append('\n');
     m_currentContent.append(line);
 
     return CueText;
index d2f9e4a..e576304 100755 (executable)
@@ -129,15 +129,13 @@ void MathMLMencloseElement::collectStyleForPresentationAttribute(const Qualified
 String MathMLMencloseElement::longDivLeftPadding() const
 {
     StringBuilder padding;
-    float fontSize = 0;
     String closingBrace = ")";
     TextRun run(closingBrace.impl(), closingBrace.length());
     Node* node = parentNode();
     if (node && node->renderer()) {
         const Font& font = node->renderer()->style().font();
-        fontSize = font.width(run);
-        padding.append(String::number(fontSize));
-        padding.append("px");
+        padding.appendNumber(font.width(run));
+        padding.appendLiteral("px");
     }
     return padding.toString();
 }
index c80259c..2c9d0ff 100644 (file)
@@ -136,9 +136,9 @@ void SerializerMarkupAccumulator::appendElement(StringBuilder& out, const Elemen
         MarkupAccumulator::appendElement(out, element, namespaces);
 
     if (element.hasTagName(HTMLNames::headTag)) {
-        out.append("<meta charset=\"");
+        out.appendLiteral("<meta charset=\"");
         out.append(m_document.charset());
-        out.append("\">");
+        out.appendLiteral("\">");
     }
 
     // FIXME: For object (plugins) tags and video tag we could replace them by an image of their current contents.
index f3a9bf2..9b08e51 100644 (file)
@@ -477,7 +477,7 @@ String SecurityOrigin::toRawString() const
     StringBuilder result;
     result.reserveCapacity(m_protocol.length() + m_host.length() + 10);
     result.append(m_protocol);
-    result.append("://");
+    result.appendLiteral("://");
     result.append(m_host);
 
     if (m_port) {
index 61e7bf9..bd1d4e6 100644 (file)
@@ -395,15 +395,15 @@ String ScrollingCoordinator::synchronousScrollingReasonsAsText(SynchronousScroll
     StringBuilder stringBuilder;
 
     if (reasons & ScrollingCoordinator::ForcedOnMainThread)
-        stringBuilder.append("Forced on main thread, ");
+        stringBuilder.appendLiteral("Forced on main thread, ");
     if (reasons & ScrollingCoordinator::HasSlowRepaintObjects)
-        stringBuilder.append("Has slow repaint objects, ");
+        stringBuilder.appendLiteral("Has slow repaint objects, ");
     if (reasons & ScrollingCoordinator::HasViewportConstrainedObjectsWithoutSupportingFixedLayers)
-        stringBuilder.append("Has viewport constrained objects without supporting fixed layers, ");
+        stringBuilder.appendLiteral("Has viewport constrained objects without supporting fixed layers, ");
     if (reasons & ScrollingCoordinator::HasNonLayerViewportConstrainedObjects)
-        stringBuilder.append("Has non-layer viewport-constrained objects, ");
+        stringBuilder.appendLiteral("Has non-layer viewport-constrained objects, ");
     if (reasons & ScrollingCoordinator::IsImageDocument)
-        stringBuilder.append("Is image document, ");
+        stringBuilder.appendLiteral("Is image document, ");
 
     if (stringBuilder.length())
         stringBuilder.resize(stringBuilder.length() - 2);
index e54bd3b..7542209 100644 (file)
@@ -517,15 +517,15 @@ static void logThreadedScrollingMode(unsigned synchronousScrollingReasons)
         StringBuilder reasonsDescription;
 
         if (synchronousScrollingReasons & ScrollingCoordinator::ForcedOnMainThread)
-            reasonsDescription.append("forced,");
+            reasonsDescription.appendLiteral("forced,");
         if (synchronousScrollingReasons & ScrollingCoordinator::HasSlowRepaintObjects)
-            reasonsDescription.append("slow-repaint objects,");
+            reasonsDescription.appendLiteral("slow-repaint objects,");
         if (synchronousScrollingReasons & ScrollingCoordinator::HasViewportConstrainedObjectsWithoutSupportingFixedLayers)
-            reasonsDescription.append("viewport-constrained objects,");
+            reasonsDescription.appendLiteral("viewport-constrained objects,");
         if (synchronousScrollingReasons & ScrollingCoordinator::HasNonLayerViewportConstrainedObjects)
-            reasonsDescription.append("non-layer viewport-constrained objects,");
+            reasonsDescription.appendLiteral("non-layer viewport-constrained objects,");
         if (synchronousScrollingReasons & ScrollingCoordinator::IsImageDocument)
-            reasonsDescription.append("image document,");
+            reasonsDescription.appendLiteral("image document,");
 
         // Strip the trailing comma.
         String reasonsDescriptionTrimmed = reasonsDescription.toString().left(reasonsDescription.length() - 1);
index 5a28824..08be0be 100644 (file)
@@ -144,7 +144,7 @@ public:
         builder.append(ValueToString<UserData>::string(data()));
         builder.append(", maxHigh=");
         builder.append(ValueToString<T>::string(maxHigh()));
-        builder.append("]");
+        builder.append(']');
         return builder.toString();
     }
 #endif
index 484f43a..074d9e6 100644 (file)
@@ -792,10 +792,10 @@ private:
     {
         StringBuilder builder;
         for (int i = 0; i < indentation; i++)
-            builder.append(" ");
-        builder.append("-");
+            builder.append(' ');
+        builder.append('-');
         if (node) {
-            builder.append(" ");
+            builder.append(' ');
             builder.append(ValueToString<T>::string(node->data()));
             builder.append((node->color() == Black) ? " (black)" : " (red)");
         }
index 4a953dc..a6aaf27 100644 (file)
@@ -46,14 +46,14 @@ String createCanonicalUUIDString()
     StringBuilder builder;
     builder.reserveCapacity(36);
     appendUnsignedAsHexFixedSize(randomData[0], builder, 8, Lowercase);
-    builder.append("-");
+    builder.append('-');
     appendUnsignedAsHexFixedSize(randomData[1] >> 16, builder, 4, Lowercase);
-    builder.append("-4");
+    builder.appendLiteral("-4");
     appendUnsignedAsHexFixedSize(randomData[1] & 0x00000fff, builder, 3, Lowercase);
-    builder.append("-");
+    builder.append('-');
     appendUnsignedAsHexFixedSize((randomData[2] >> 30) | 0x8, builder, 1, Lowercase);
     appendUnsignedAsHexFixedSize((randomData[2] >> 16) & 0x00000fff, builder, 3, Lowercase);
-    builder.append("-");
+    builder.append('-');
     appendUnsignedAsHexFixedSize(randomData[2] & 0x0000ffff, builder, 4, Lowercase);
     appendUnsignedAsHexFixedSize(randomData[3], builder, 8, Lowercase);
     return builder.toString();
index 07c90cb..c6d67c2 100644 (file)
@@ -34,14 +34,14 @@ static void appendProxyServerString(StringBuilder& builder, const ProxyServer& p
 {
     switch (proxyServer.type()) {
     case ProxyServer::Direct:
-        builder.append("DIRECT");
+        builder.appendLiteral("DIRECT");
         return;
     case ProxyServer::HTTP:
     case ProxyServer::HTTPS:
-        builder.append("PROXY");
+        builder.appendLiteral("PROXY");
         break;
     case ProxyServer::SOCKS:
-        builder.append("SOCKS");
+        builder.appendLiteral("SOCKS");
         break;
     }
     
@@ -63,7 +63,7 @@ String toString(const Vector<ProxyServer>& proxyServers)
     StringBuilder stringBuilder;
     for (size_t i = 0; i < proxyServers.size(); ++i) {
         if (i)
-            stringBuilder.append("; ");
+            stringBuilder.appendLiteral("; ");
 
         appendProxyServerString(stringBuilder, proxyServers[i]);
     }
index bcbe1d5..b759944 100644 (file)
@@ -257,9 +257,9 @@ void DateTimeFormat::quoteAndAppendLiteral(const String& literal, StringBuilder&
     }
     
     if (literal.find('\'') == notFound) {
-        buffer.append("'");
+        buffer.append('\'');
         buffer.append(literal);
-        buffer.append("'");
+        buffer.append('\'');
         return;
     }
 
@@ -268,10 +268,10 @@ void DateTimeFormat::quoteAndAppendLiteral(const String& literal, StringBuilder&
             buffer.append("''");
         else {
             String escaped = literal.substring(i);
-            escaped.replace(ASCIILiteral("'"), ASCIILiteral("''"));
-            buffer.append("'");
+            escaped.replace('\'', "''");
+            buffer.append('\'');
             buffer.append(escaped);
-            buffer.append("'");
+            buffer.append('\'');
             return;
         }
     }
index 5b75981..c5116bb 100644 (file)
@@ -81,7 +81,7 @@ String DateTimeStringBuilder::zeroPadString(const String& string, size_t width)
     StringBuilder zeroPaddedStringBuilder;
     zeroPaddedStringBuilder.reserveCapacity(width);
     for (size_t i = string.length(); i < width; ++i)
-        zeroPaddedStringBuilder.append("0");
+        zeroPaddedStringBuilder.append('0');
     zeroPaddedStringBuilder.append(string);
     return zeroPaddedStringBuilder.toString();
 }
@@ -311,7 +311,7 @@ String Locale::convertFromLocalizedNumber(const String& localized)
     StringBuilder builder;
     builder.reserveCapacity(input.length());
     if (isNegative)
-        builder.append("-");
+        builder.append('-');
     for (unsigned i = startIndex; i < endIndex;) {
         unsigned symbolIndex = matchedDecimalSymbolIndex(input, i);
         if (symbolIndex >= DecimalSymbolsSize)
index 1238506..a035071 100644 (file)
@@ -91,13 +91,13 @@ TextStream& TextStream::operator<<(unsigned long long i)
 
 TextStream& TextStream::operator<<(float f)
 {
-    m_text.append(String::numberToStringFixedWidth(f, 2));
+    m_text.appendFixedWidthNumber(f, 2);
     return *this;
 }
 
 TextStream& TextStream::operator<<(double d)
 {
-    m_text.append(String::numberToStringFixedWidth(d, 2));
+    m_text.appendFixedWidthNumber(d, 2);
     return *this;
 }
 
index 8a90563..ab29acc 100644 (file)
@@ -644,7 +644,7 @@ String listMarkerText(EListStyleType type, int value)
                 break;
             }
             if (value < 0) {
-                builder.append("-0");
+                builder.appendLiteral("-0");
                 builder.appendNumber(-value); // -01 to -09
                 break;
             }
index f065cd1..ac96f55 100644 (file)
@@ -1213,25 +1213,25 @@ String Internals::parserMetaData(Deprecated::ScriptValue value)
     if (executable->isFunctionExecutable()) {
         FunctionExecutable* funcExecutable = reinterpret_cast<FunctionExecutable*>(executable);
         String inferredName = funcExecutable->inferredName().string();
-        result.append("function \"");
+        result.appendLiteral("function \"");
         result.append(inferredName);
-        result.append("\"");
+        result.append('"');
     } else if (executable->isEvalExecutable())
-        result.append("eval");
+        result.appendLiteral("eval");
     else {
         ASSERT(executable->isProgramExecutable());
-        result.append("program");
+        result.appendLiteral("program");
     }
 
-    result.append(" { ");
+    result.appendLiteral(" { ");
     result.appendNumber(startLine);
-    result.append(":");
+    result.append(':');
     result.appendNumber(startColumn);
-    result.append(" - ");
+    result.appendLiteral(" - ");
     result.appendNumber(endLine);
-    result.append(":");
+    result.append(':');
     result.appendNumber(endColumn);
-    result.append(" }");
+    result.appendLiteral(" }");
 
     return result.toString();
 }
@@ -1996,22 +1996,22 @@ String Internals::getCurrentCursorInfo(ExceptionCode& ec)
     Cursor cursor = document->frame()->eventHandler().currentMouseCursor();
 
     StringBuilder result;
-    result.append("type=");
+    result.appendLiteral("type=");
     result.append(cursorTypeToString(cursor.type()));
-    result.append(" hotSpot=");
+    result.appendLiteral(" hotSpot=");
     result.appendNumber(cursor.hotSpot().x());
-    result.append(",");
+    result.append(',');
     result.appendNumber(cursor.hotSpot().y());
     if (cursor.image()) {
         FloatSize size = cursor.image()->size();
-        result.append(" image=");
+        result.appendLiteral(" image=");
         result.appendNumber(size.width());
-        result.append("x");
+        result.append('x');
         result.appendNumber(size.height());
     }
 #if ENABLE(MOUSE_CURSOR_SCALE)
     if (cursor.imageScaleFactor() != 1) {
-        result.append(" scale=");
+        result.appendLiteral(" scale=");
         NumberToStringBuffer buffer;
         result.append(numberToFixedPrecisionString(cursor.imageScaleFactor(), 8, buffer, true));
     }