[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

zimmermann at webkit.org zimmermann at webkit.org
Wed Dec 22 14:32:01 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit dffa3caddca3e32a6a272f526e2bd9a1ecfe05de
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 12 19:47:24 2010 +0000

    2010-10-12  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Gavin Barraclough.
    
            Unify JSC::StringBuilder & WebCore::StringBuilder
            https://bugs.webkit.org/show_bug.cgi?id=47538
    
            Move runtime/StringBuilder.h to wtf/text/StringBuilder.h. Rename build() to toString() and return a WTF::String().
            Move the append(const JSC::UString&) method into runtime/UStringBuilder.h.
            UStringBuilder inherits from StringBuilder.h and adds append(const JSC::UString&) and UString toUString() functionality.
    
            No new code, just move code around.
    
            * GNUmakefile.am: Add wtf/text/StringBuilder.h / runtime/UStringBuilder.h. Remove runtime/StringBuilder.h.
            * JavaScriptCore.gypi: Ditto.
            * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
            * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
            * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
            * runtime/Executable.cpp:
            (JSC::FunctionExecutable::paramString): Use UStringBuilder, instead of StringBuilder. Rename build() -> toUString().
            * runtime/FunctionConstructor.cpp:
            (JSC::constructFunction): Ditto.
            * runtime/JSGlobalObjectFunctions.cpp:
            (JSC::globalFuncUnescape): Ditto.
            * runtime/JSONObject.cpp:
            (JSC::Stringifier::stringify): Ditto.
            (JSC::Stringifier::appendQuotedString): Ditto.
            (JSC::Stringifier::appendStringifiedValue): Ditto.
            (JSC::Stringifier::startNewLine): Ditto.
            (JSC::Stringifier::Holder::appendNextProperty): Ditto.
            * runtime/LiteralParser.cpp:
            (JSC::LiteralParser::Lexer::lexString): Ditto.
            * runtime/NumberPrototype.cpp: Remove unneeded JSStringBuilder.h / StringBuilder.h include.
            * runtime/StringBuilder.h: Removed.
            * runtime/UStringBuilder.h: Added. Inherits from WTF::StringBuilder, extending it by two methods.
            (JSC::UStringBuilder::append): append(const JSC::UString&)
            (JSC::UStringBuilder::toUString):
            * wtf/text/StringBuilder.h: Copied from runtime/StringBuilder.h. Move JSC::UString parts into runtime/UStringBuilder.h
            (WTF::StringBuilder::append): Renamed m_buffer to buffer everywhere.
            (WTF::StringBuilder::isEmpty): Ditto (+ constify method).
            (WTF::StringBuilder::reserveCapacity): Ditto.
            (WTF::StringBuilder::resize): Ditto.
            (WTF::StringBuilder::size): Ditto.
            (WTF::StringBuilder::operator[]): Ditto.
            (WTF::StringBuilder::toString): Ditto (+ renamed from build()). Returns a String, not an UString. The old build() method is now named toUString() and lives in UStringBuilder.
    2010-10-12  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Gavin Barraclough.
    
            Unify JSC::StringBuilder & WebCore::StringBuilder
            https://bugs.webkit.org/show_bug.cgi?id=47538
    
            * src/LocalizedStrings.cpp:
            (WebCore::imageTitle): Use WTF::StringBuilder.
            * src/WebEntities.cpp:
            (WebKit::WebEntities::convertEntitiesInString): Ditto.
            * src/WebPageSerializerImpl.cpp: Remove useless includes.
            (WebKit::WebPageSerializerImpl::encodeAndFlushBuffer):
            * src/WebPageSerializerImpl.h: Use WTF::StringBuilder.
    2010-10-12  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Gavin Barraclough.
    
            Unify JSC::StringBuilder & WebCore::StringBuilder
            https://bugs.webkit.org/show_bug.cgi?id=47538
    
            JSC::StringBuilder operates on a Vector<UChar, 64> and allows to build a string based on a stream of characters in an efficient manner.
            WebCore::StringBuilder operates on a Vector<String, 16> and allows to concat an arbitary number of Strings. It's not efficient in handling single
            characters, as a String with length=1 has to be constructed for those. An analysis of the callers of WebCore::StringBuilder shows that
            most callsites actually combine Strings and single characters, so using a Vector<UChar> would be more efficient. Those who only combine large
            strings are only used for debugging purposes, so it's fine to switch them to a Vector<UChar> approach as well.
    
            Replace WebCore::StringBuilder with JSC::StringBuilder, and move it to wtf/text/StringBuilder.h into the WTF namespace.
            While I was at it remove platform/text/StringBuffer.h, as it was only including wtf/text/StringBuffer.h.
    
            No change in functionality, thus no new tests.
    
            * Android.mk: Remove platform/text/StringBuilder.* and platform/text/StringBuffer.h.
            * CMakeLists.txt: Ditto.
            * GNUmakefile.am: Ditto.
            * WebCore.gypi: Ditto.
            * WebCore.order: Ditto.
            * WebCore.pro: Ditto.
            * WebCore.vcproj/WebCore.vcproj: Ditto.
            * WebCore.xcodeproj/project.pbxproj: Ditto.
            * ForwardingHeaders/runtime/StringBuilder.h: Removed.
            * ForwardingHeaders/runtime/UStringBuilder.h: Added.
            * ForwardingHeaders/wtf/text/StringBuilder.h: Added.
            * bindings/js/ScriptString.h: Don't include PlatformString.h but wtf/text/WTFString.h.
            (WebCore::ScriptString::operator+=): Use JSC::UStringBuilder instead of JSC::StringBuilder.
            * bridge/jni/JNIBridge.cpp: Use WTF::StringBuilder (+ use append(const UChar) for single characters).
            * css/MediaQuery.cpp: Ditto.
            * css/MediaQueryExp.cpp: Ditto.
            * dom/Node.cpp: Ditto.
            (WebCore::Node::appendTextContent): Manually track wheter the StringBuilder content is empty or null, the new StringBuilder doesn't differentiate between null & empty strings.
            * dom/Node.h: Remove appendTextContent definition, it's not needed to be exported, removes the need for a StringBuilder.h include or forward declaration.
            * html/DOMTokenList.cpp: Use WTF::StringBuilder.
            * inspector/InspectorResource.cpp: Remove useless StringBuffer.h include.
            * platform/android/FileSystemAndroid.cpp: Use WTF::StringBuilder.
            * platform/brew/FileSystemBrew.cpp: Ditto.
            * platform/chromium/ClipboardChromium.cpp: Ditto (+ use append(const UChar) for single characters).
            * platform/graphics/gpu/PODInterval.h: Ditto (Only used as debugging helper here, in debug builds).
            * platform/graphics/gpu/PODRedBlackTree.h: Ditto (Only used as debugging helper here, in debug builds).
            * platform/graphics/mac/GraphicsLayerCA.mm: Remove useless StringBuilder.h include.
            * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp: Use WTF::StringBuilder, and use append(const UChar) for single characters.
            * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp: Ditto.
            * platform/network/ProxyServer.cpp:
            (WebCore::appendProxyServerString): Use WTF::StringBuilder.
            * platform/text/StringBuffer.h: Removed.
            * platform/text/StringBuilder.cpp: Removed.
            * platform/text/StringBuilder.h: Removed.
            * plugins/DOMMimeType.cpp: Use WTF::StringBuilder.
            * svg/SVGPathParserFactory.cpp: Ditto.
            * svg/SVGPathStringBuilder.cpp: SVGPathStringBuilder used stringBuilder.toString(ConcatAddingSpacesBetweenIndividualStrings), adapt to the change, that this mode is gone now.
            (WebCore::SVGPathStringBuilder::result): Just use toString(), append a space to the end of each command, when building the string. Remove the last trailing space before building the result.
            (WebCore::SVGPathStringBuilder::moveTo):
            (WebCore::SVGPathStringBuilder::lineTo):
            (WebCore::SVGPathStringBuilder::lineToHorizontal):
            (WebCore::SVGPathStringBuilder::lineToVertical):
            (WebCore::SVGPathStringBuilder::curveToCubic):
            (WebCore::SVGPathStringBuilder::curveToCubicSmooth):
            (WebCore::SVGPathStringBuilder::curveToQuadratic):
            (WebCore::SVGPathStringBuilder::curveToQuadraticSmooth):
            (WebCore::SVGPathStringBuilder::arcTo):
            (WebCore::SVGPathStringBuilder::closePath):
            * svg/SVGPathStringBuilder.h:
            (WebCore::SVGPathStringBuilder::cleanup): StringBuilder::clear() is gone, just cleanup by assigning StringBuilder().
            * websockets/WebSocket.cpp: Use WTF::StringBuilder.
            * websockets/WebSocketHandshake.cpp: Ditto (+ use append(const UChar) for single characters).
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69594 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index f81cb47..8729486 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,49 @@
+2010-10-12  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Gavin Barraclough.
+
+        Unify JSC::StringBuilder & WebCore::StringBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=47538
+
+        Move runtime/StringBuilder.h to wtf/text/StringBuilder.h. Rename build() to toString() and return a WTF::String().
+        Move the append(const JSC::UString&) method into runtime/UStringBuilder.h.
+        UStringBuilder inherits from StringBuilder.h and adds append(const JSC::UString&) and UString toUString() functionality.
+
+        No new code, just move code around.
+
+        * GNUmakefile.am: Add wtf/text/StringBuilder.h / runtime/UStringBuilder.h. Remove runtime/StringBuilder.h.
+        * JavaScriptCore.gypi: Ditto.
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto.
+        * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
+        * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
+        * runtime/Executable.cpp:
+        (JSC::FunctionExecutable::paramString): Use UStringBuilder, instead of StringBuilder. Rename build() -> toUString().
+        * runtime/FunctionConstructor.cpp:
+        (JSC::constructFunction): Ditto.
+        * runtime/JSGlobalObjectFunctions.cpp:
+        (JSC::globalFuncUnescape): Ditto.
+        * runtime/JSONObject.cpp:
+        (JSC::Stringifier::stringify): Ditto.
+        (JSC::Stringifier::appendQuotedString): Ditto.
+        (JSC::Stringifier::appendStringifiedValue): Ditto.
+        (JSC::Stringifier::startNewLine): Ditto.
+        (JSC::Stringifier::Holder::appendNextProperty): Ditto.
+        * runtime/LiteralParser.cpp:
+        (JSC::LiteralParser::Lexer::lexString): Ditto.
+        * runtime/NumberPrototype.cpp: Remove unneeded JSStringBuilder.h / StringBuilder.h include.
+        * runtime/StringBuilder.h: Removed.
+        * runtime/UStringBuilder.h: Added. Inherits from WTF::StringBuilder, extending it by two methods.
+        (JSC::UStringBuilder::append): append(const JSC::UString&)
+        (JSC::UStringBuilder::toUString):
+        * wtf/text/StringBuilder.h: Copied from runtime/StringBuilder.h. Move JSC::UString parts into runtime/UStringBuilder.h
+        (WTF::StringBuilder::append): Renamed m_buffer to buffer everywhere.
+        (WTF::StringBuilder::isEmpty): Ditto (+ constify method). 
+        (WTF::StringBuilder::reserveCapacity): Ditto.
+        (WTF::StringBuilder::resize): Ditto.
+        (WTF::StringBuilder::size): Ditto.
+        (WTF::StringBuilder::operator[]): Ditto.
+        (WTF::StringBuilder::toString): Ditto (+ renamed from build()). Returns a String, not an UString. The old build() method is now named toUString() and lives in UStringBuilder.
+
 2010-10-12  Michael Saboff  <msaboff at apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/JavaScriptCore/GNUmakefile.am b/JavaScriptCore/GNUmakefile.am
index 7d637b3..ad952d0 100644
--- a/JavaScriptCore/GNUmakefile.am
+++ b/JavaScriptCore/GNUmakefile.am
@@ -411,6 +411,7 @@ javascriptcore_sources += \
 	JavaScriptCore/runtime/Tracing.h \
 	JavaScriptCore/runtime/UString.cpp \
 	JavaScriptCore/runtime/UString.h \
+	JavaScriptCore/runtime/UStringBuilder.h \
 	JavaScriptCore/runtime/WeakGCMap.h \
 	JavaScriptCore/runtime/WeakGCPtr.h \
 	JavaScriptCore/runtime/WeakRandom.h \
@@ -508,6 +509,7 @@ javascriptcore_sources += \
 	JavaScriptCore/wtf/text/CString.cpp \
 	JavaScriptCore/wtf/text/CString.h \
 	JavaScriptCore/wtf/text/StringBuffer.h \
+	JavaScriptCore/wtf/text/StringBuilder.h \
 	JavaScriptCore/wtf/text/StringHash.h \
 	JavaScriptCore/wtf/text/StringImplBase.h \
 	JavaScriptCore/wtf/text/StringImpl.cpp \
diff --git a/JavaScriptCore/JavaScriptCore.gypi b/JavaScriptCore/JavaScriptCore.gypi
index 462960d..97dc952 100644
--- a/JavaScriptCore/JavaScriptCore.gypi
+++ b/JavaScriptCore/JavaScriptCore.gypi
@@ -346,6 +346,7 @@
             'runtime/Tracing.h',
             'runtime/UString.cpp',
             'runtime/UString.h',
+            'runtime/UStringBuilder.h',
             'runtime/WeakRandom.h',
             'wtf/AlwaysInline.h',
             'wtf/ASCIICType.h',
@@ -450,6 +451,8 @@
             'wtf/text/AtomicStringImpl.h',
             'wtf/text/CString.cpp',
             'wtf/text/CString.h',
+            'wtf/text/StringBuffer.h',
+            'wtf/text/StringBuilder.h',
             'wtf/text/StringHash.h',
             'wtf/text/StringImpl.cpp',
             'wtf/text/StringImpl.h',
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
index 479b3dd..38dafab 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
@@ -1253,6 +1253,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\runtime\UStringBuilder.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\runtime\UStringImpl.h"
 				>
 			</File>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
index 42a91eb..afc02d8 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
@@ -609,6 +609,14 @@
  			>
  		</File>
  		<File
+ 			RelativePath="..\..\wtf\text\StringBuffer.h"
+ 			>
+ 		</File>
+ 		<File
+ 			RelativePath="..\..\wtf\text\StringBuilder.h"
+ 			>
+ 		</File>
+ 		<File
  			RelativePath="..\..\wtf\text\StringHash.h"
  			>
  		</File>
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index a45f982..16e1459 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -36,8 +36,10 @@
 /* Begin PBXBuildFile section */
 		06D358B30DAADAA4003B174E /* MainThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 06D358A20DAAD9C4003B174E /* MainThread.cpp */; };
 		06D358B40DAADAAA003B174E /* MainThreadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 06D358A10DAAD9C4003B174E /* MainThreadMac.mm */; };
+		081469491264378500DFF935 /* StringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 081469481264375E00DFF935 /* StringBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		088FA5BB0EF76D4300578E6F /* RandomNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 088FA5B90EF76D4300578E6F /* RandomNumber.cpp */; };
 		088FA5BC0EF76D4300578E6F /* RandomNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 088FA5BA0EF76D4300578E6F /* RandomNumber.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		08DDA5C11264631700751732 /* UStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 08DDA5BB12645F1D00751732 /* UStringBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		08E279E90EF83B10007DB523 /* RandomNumberSeed.h in Headers */ = {isa = PBXBuildFile; fileRef = 08E279E80EF83B10007DB523 /* RandomNumberSeed.h */; };
 		0B330C270F38C62300692DE3 /* TypeTraits.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0B330C260F38C62300692DE3 /* TypeTraits.cpp */; };
 		0B4D7E630F319AC800AD7E58 /* TypeTraits.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B4D7E620F319AC800AD7E58 /* TypeTraits.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -217,7 +219,6 @@
 		868BFA18117CF19900B908B1 /* WTFString.h in Headers */ = {isa = PBXBuildFile; fileRef = 868BFA16117CF19900B908B1 /* WTFString.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		868BFA60117D048200B908B1 /* StaticConstructors.h in Headers */ = {isa = PBXBuildFile; fileRef = 868BFA5F117D048200B908B1 /* StaticConstructors.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		8690231512092D5C00630AF9 /* PageReservation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8690231412092D5C00630AF9 /* PageReservation.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		8698B86910D44D9400D8D01B /* StringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8698B86810D44D9400D8D01B /* StringBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		869D04AF1193B54D00803475 /* CachedTranscendentalFunction.h in Headers */ = {isa = PBXBuildFile; fileRef = 869D04AE1193B54D00803475 /* CachedTranscendentalFunction.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */ = {isa = PBXBuildFile; fileRef = 869EBCB60E8C6D4A008722CC /* ResultType.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		86A90ED00EE7D51F00AB350D /* JITArithmetic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86A90ECF0EE7D51F00AB350D /* JITArithmetic.cpp */; };
@@ -629,8 +630,10 @@
 		06D358A10DAAD9C4003B174E /* MainThreadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainThreadMac.mm; sourceTree = "<group>"; };
 		06D358A20DAAD9C4003B174E /* MainThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainThread.cpp; sourceTree = "<group>"; };
 		06D358A30DAAD9C4003B174E /* MainThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainThread.h; sourceTree = "<group>"; };
+		081469481264375E00DFF935 /* StringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringBuilder.h; path = text/StringBuilder.h; sourceTree = "<group>"; };
 		088FA5B90EF76D4300578E6F /* RandomNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomNumber.cpp; sourceTree = "<group>"; };
 		088FA5BA0EF76D4300578E6F /* RandomNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumber.h; sourceTree = "<group>"; };
+		08DDA5BB12645F1D00751732 /* UStringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UStringBuilder.h; sourceTree = "<group>"; };
 		08E279E80EF83B10007DB523 /* RandomNumberSeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumberSeed.h; sourceTree = "<group>"; };
 		0B330C260F38C62300692DE3 /* TypeTraits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TypeTraits.cpp; sourceTree = "<group>"; };
 		0B4D7E620F319AC800AD7E58 /* TypeTraits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeTraits.h; sourceTree = "<group>"; };
@@ -822,7 +825,6 @@
 		868BFA16117CF19900B908B1 /* WTFString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WTFString.h; path = text/WTFString.h; sourceTree = "<group>"; };
 		868BFA5F117D048200B908B1 /* StaticConstructors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticConstructors.h; sourceTree = "<group>"; };
 		8690231412092D5C00630AF9 /* PageReservation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageReservation.h; sourceTree = "<group>"; };
-		8698B86810D44D9400D8D01B /* StringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringBuilder.h; sourceTree = "<group>"; };
 		869D04AE1193B54D00803475 /* CachedTranscendentalFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedTranscendentalFunction.h; sourceTree = "<group>"; };
 		869EBCB60E8C6D4A008722CC /* ResultType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResultType.h; sourceTree = "<group>"; };
 		86A90ECF0EE7D51F00AB350D /* JITArithmetic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITArithmetic.cpp; sourceTree = "<group>"; };
@@ -1793,7 +1795,6 @@
 				7E2C6C980D31C6B6002D44E2 /* ScopeChainMark.h */,
 				93303FE80E6A72B500786E6A /* SmallStrings.cpp */,
 				93303FEA0E6A72C000786E6A /* SmallStrings.h */,
-				8698B86810D44D9400D8D01B /* StringBuilder.h */,
 				86B6DA0112132B9A000D316F /* StringConcatenate.h */,
 				BC18C3C00E16EE3300B34460 /* StringConstructor.cpp */,
 				BC18C3C10E16EE3300B34460 /* StringConstructor.h */,
@@ -1815,6 +1816,7 @@
 				5D53726E0E1C54880021E549 /* Tracing.h */,
 				F692A8850255597D01FF60F7 /* UString.cpp */,
 				F692A8860255597D01FF60F7 /* UString.h */,
+				08DDA5BB12645F1D00751732 /* UStringBuilder.h */,
 				14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */,
 				14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */,
 				1420BE7A10AA6DDB00F455D2 /* WeakRandom.h */,
@@ -1834,6 +1836,7 @@
 				86565740115BE3DA00291F40 /* CString.cpp */,
 				86565741115BE3DA00291F40 /* CString.h */,
 				86B99AE1117E578100DF5A90 /* StringBuffer.h */,
+				081469481264375E00DFF935 /* StringBuilder.h */,
 				868BFA05117CEFD100B908B1 /* StringHash.h */,
 				868BFA06117CEFD100B908B1 /* StringImpl.cpp */,
 				868BFA07117CEFD100B908B1 /* StringImpl.h */,
@@ -2256,7 +2259,7 @@
 				868BFA60117D048200B908B1 /* StaticConstructors.h in Headers */,
 				FE1B447A0ECCD73B004F4DD1 /* StdLibExtras.h in Headers */,
 				86B99AE3117E578100DF5A90 /* StringBuffer.h in Headers */,
-				8698B86910D44D9400D8D01B /* StringBuilder.h in Headers */,
+				081469491264378500DFF935 /* StringBuilder.h in Headers */,
 				BC18C4660E16F5CD00B34460 /* StringConstructor.h in Headers */,
 				BC18C4670E16F5CD00B34460 /* StringExtras.h in Headers */,
 				868BFA0D117CEFD100B908B1 /* StringHash.h in Headers */,
@@ -2292,6 +2295,7 @@
 				BC18C4740E16F5CD00B34460 /* UnicodeIcu.h in Headers */,
 				BC18C4750E16F5CD00B34460 /* UnusedParam.h in Headers */,
 				BC18C4760E16F5CD00B34460 /* UString.h in Headers */,
+				08DDA5C11264631700751732 /* UStringBuilder.h in Headers */,
 				BC18C4770E16F5CD00B34460 /* UTF8.h in Headers */,
 				E17FF771112131D200076A19 /* ValueCheck.h in Headers */,
 				BC18C4780E16F5CD00B34460 /* Vector.h in Headers */,
diff --git a/JavaScriptCore/runtime/Executable.cpp b/JavaScriptCore/runtime/Executable.cpp
index 56e509a..733768e 100644
--- a/JavaScriptCore/runtime/Executable.cpp
+++ b/JavaScriptCore/runtime/Executable.cpp
@@ -30,7 +30,7 @@
 #include "CodeBlock.h"
 #include "JIT.h"
 #include "Parser.h"
-#include "StringBuilder.h"
+#include "UStringBuilder.h"
 #include "Vector.h"
 
 namespace JSC {
@@ -367,13 +367,13 @@ PassRefPtr<FunctionExecutable> FunctionExecutable::fromGlobalCode(const Identifi
 UString FunctionExecutable::paramString() const
 {
     FunctionParameters& parameters = *m_parameters;
-    StringBuilder builder;
+    UStringBuilder builder;
     for (size_t pos = 0; pos < parameters.size(); ++pos) {
         if (!builder.isEmpty())
             builder.append(", ");
         builder.append(parameters[pos].ustring());
     }
-    return builder.build();
+    return builder.toUString();
 }
 
 PassOwnPtr<ExceptionInfo> ProgramExecutable::reparseExceptionInfo(ScopeChainNode*, CodeBlock*)
diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp
index f72a273..617992f 100644
--- a/JavaScriptCore/runtime/FunctionConstructor.cpp
+++ b/JavaScriptCore/runtime/FunctionConstructor.cpp
@@ -30,7 +30,7 @@
 #include "Lexer.h"
 #include "Nodes.h"
 #include "Parser.h"
-#include "StringBuilder.h"
+#include "UStringBuilder.h"
 #include "StringConcatenate.h"
 
 namespace JSC {
@@ -83,7 +83,7 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi
     else if (args.size() == 1)
         program = makeString("(function() { ", args.at(0).toString(exec), "\n})");
     else {
-        StringBuilder builder;
+        UStringBuilder builder;
         builder.append("(function(");
         builder.append(args.at(0).toString(exec));
         for (size_t i = 1; i < args.size() - 1; i++) {
@@ -93,7 +93,7 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi
         builder.append(") { ");
         builder.append(args.at(args.size() - 1).toString(exec));
         builder.append("\n})");
-        program = builder.build();
+        program = builder.toUString();
     }
 
     JSGlobalObject* globalObject = exec->lexicalGlobalObject();
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index cd89dd2..ed06fa5 100644
--- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -35,7 +35,7 @@
 #include "LiteralParser.h"
 #include "Nodes.h"
 #include "Parser.h"
-#include "StringBuilder.h"
+#include "UStringBuilder.h"
 #include "dtoa.h"
 #include <stdio.h>
 #include <stdlib.h>
@@ -563,7 +563,7 @@ EncodedJSValue JSC_HOST_CALL globalFuncEscape(ExecState* exec)
 
 EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
 {
-    StringBuilder builder;
+    UStringBuilder builder;
     UString str = exec->argument(0).toString(exec);
     int k = 0;
     int len = str.length();
@@ -585,7 +585,7 @@ EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
         builder.append(*c);
     }
 
-    return JSValue::encode(jsString(exec, builder.build()));
+    return JSValue::encode(jsString(exec, builder.toUString()));
 }
 
 #ifndef NDEBUG
diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp
index ba50721..8ee7165 100644
--- a/JavaScriptCore/runtime/JSONObject.cpp
+++ b/JavaScriptCore/runtime/JSONObject.cpp
@@ -34,7 +34,7 @@
 #include "LiteralParser.h"
 #include "Lookup.h"
 #include "PropertyNameArray.h"
-#include "StringBuilder.h"
+#include "UStringBuilder.h"
 #include "StringConcatenate.h"
 #include <wtf/MathExtras.h>
 
@@ -85,7 +85,7 @@ private:
 
         JSObject* object() const { return m_object; }
 
-        bool appendNextProperty(Stringifier&, StringBuilder&);
+        bool appendNextProperty(Stringifier&, UStringBuilder&);
 
     private:
         JSObject* const m_object;
@@ -98,17 +98,17 @@ private:
 
     friend class Holder;
 
-    static void appendQuotedString(StringBuilder&, const UString&);
+    static void appendQuotedString(UStringBuilder&, const UString&);
 
     JSValue toJSON(JSValue, const PropertyNameForFunctionCall&);
 
     enum StringifyResult { StringifyFailed, StringifySucceeded, StringifyFailedDueToUndefinedValue };
-    StringifyResult appendStringifiedValue(StringBuilder&, JSValue, JSObject* holder, const PropertyNameForFunctionCall&);
+    StringifyResult appendStringifiedValue(UStringBuilder&, JSValue, JSObject* holder, const PropertyNameForFunctionCall&);
 
     bool willIndent() const;
     void indent();
     void unindent();
-    void startNewLine(StringBuilder&) const;
+    void startNewLine(UStringBuilder&) const;
 
     Stringifier* const m_nextStringifierToMark;
     ExecState* const m_exec;
@@ -270,16 +270,16 @@ JSValue Stringifier::stringify(JSValue value)
     PropertyNameForFunctionCall emptyPropertyName(m_exec->globalData().propertyNames->emptyIdentifier);
     object->putDirect(m_exec->globalData().propertyNames->emptyIdentifier, value);
 
-    StringBuilder result;
+    UStringBuilder result;
     if (appendStringifiedValue(result, value, object, emptyPropertyName) != StringifySucceeded)
         return jsUndefined();
     if (m_exec->hadException())
         return jsNull();
 
-    return jsString(m_exec, result.build());
+    return jsString(m_exec, result.toUString());
 }
 
-void Stringifier::appendQuotedString(StringBuilder& builder, const UString& value)
+void Stringifier::appendQuotedString(UStringBuilder& builder, const UString& value)
 {
     int length = value.length();
 
@@ -361,7 +361,7 @@ inline JSValue Stringifier::toJSON(JSValue value, const PropertyNameForFunctionC
     return call(m_exec, object, callType, callData, value, args);
 }
 
-Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder& builder, JSValue value, JSObject* holder, const PropertyNameForFunctionCall& propertyName)
+Stringifier::StringifyResult Stringifier::appendStringifiedValue(UStringBuilder& builder, JSValue value, JSObject* holder, const PropertyNameForFunctionCall& propertyName)
 {
     // Call the toJSON function.
     value = toJSON(value, propertyName);
@@ -477,7 +477,7 @@ inline void Stringifier::unindent()
     m_indent = m_repeatedGap.substringSharingImpl(0, m_indent.length() - m_gap.length());
 }
 
-inline void Stringifier::startNewLine(StringBuilder& builder) const
+inline void Stringifier::startNewLine(UStringBuilder& builder) const
 {
     if (m_gap.isEmpty())
         return;
@@ -492,7 +492,7 @@ inline Stringifier::Holder::Holder(JSObject* object)
 {
 }
 
-bool Stringifier::Holder::appendNextProperty(Stringifier& stringifier, StringBuilder& builder)
+bool Stringifier::Holder::appendNextProperty(Stringifier& stringifier, UStringBuilder& builder)
 {
     ASSERT(m_index <= m_size);
 
diff --git a/JavaScriptCore/runtime/LiteralParser.cpp b/JavaScriptCore/runtime/LiteralParser.cpp
index cc33bae..f1df15f 100644
--- a/JavaScriptCore/runtime/LiteralParser.cpp
+++ b/JavaScriptCore/runtime/LiteralParser.cpp
@@ -29,7 +29,7 @@
 #include "JSArray.h"
 #include "JSString.h"
 #include "Lexer.h"
-#include "StringBuilder.h"
+#include "UStringBuilder.h"
 #include <wtf/ASCIICType.h>
 #include <wtf/dtoa.h>
 
@@ -135,7 +135,7 @@ template <LiteralParser::ParserMode mode> inline LiteralParser::TokenType Litera
 {
     ++m_ptr;
     const UChar* runStart;
-    StringBuilder builder;
+    UStringBuilder builder;
     do {
         runStart = m_ptr;
         while (m_ptr < m_end && isSafeStringCharacter<mode>(*m_ptr))
@@ -200,7 +200,7 @@ template <LiteralParser::ParserMode mode> inline LiteralParser::TokenType Litera
     if (m_ptr >= m_end || *m_ptr != '"')
         return TokError;
 
-    token.stringToken = builder.build();
+    token.stringToken = builder.toUString();
     token.type = TokString;
     token.end = ++m_ptr;
     return TokString;
diff --git a/JavaScriptCore/runtime/NumberPrototype.cpp b/JavaScriptCore/runtime/NumberPrototype.cpp
index e18553b..df8ac4c 100644
--- a/JavaScriptCore/runtime/NumberPrototype.cpp
+++ b/JavaScriptCore/runtime/NumberPrototype.cpp
@@ -25,10 +25,8 @@
 #include "Error.h"
 #include "JSFunction.h"
 #include "JSString.h"
-#include "JSStringBuilder.h"
 #include "Operations.h"
 #include "PrototypeFunction.h"
-#include "StringBuilder.h"
 #include "dtoa.h"
 #include <wtf/Assertions.h>
 #include <wtf/DecimalNumber.h>
diff --git a/JavaScriptCore/runtime/StringBuilder.h b/JavaScriptCore/runtime/StringBuilder.h
deleted file mode 100644
index 27aa57f..0000000
--- a/JavaScriptCore/runtime/StringBuilder.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef StringBuilder_h
-#define StringBuilder_h
-
-#include <wtf/Vector.h>
-
-namespace JSC {
-
-class StringBuilder {
-public:
-    void append(const UChar u)
-    {
-        buffer.append(u);
-    }
-
-    void append(const char* str)
-    {
-        append(str, strlen(str));
-    }
-
-    void append(const char* str, size_t len)
-    {
-        reserveCapacity(buffer.size() + len);
-        for (size_t i = 0; i < len; i++)
-            buffer.append(static_cast<unsigned char>(str[i]));
-    }
-
-    void append(const UChar* str, size_t len)
-    {
-        buffer.append(str, len);
-    }
-
-    void append(const UString& str)
-    {
-        buffer.append(str.characters(), str.length());
-    }
-
-    bool isEmpty() { return buffer.isEmpty(); }
-    void reserveCapacity(size_t newCapacity)
-    {
-        if (newCapacity < buffer.capacity())
-            return;
-        buffer.reserveCapacity(std::max(newCapacity, buffer.capacity() + buffer.capacity() / 4 + 1));
-    }
-    void resize(size_t size) { buffer.resize(size); }
-    size_t size() const { return buffer.size(); }
-
-    UChar operator[](size_t i) const { return buffer.at(i); }
-
-    UString build()
-    {
-        buffer.shrinkToFit();
-        ASSERT(buffer.data() || !buffer.size());
-        return UString::adopt(buffer);
-    }
-
-protected:
-    Vector<UChar, 64> buffer;
-};
-
-}
-
-#endif
diff --git a/JavaScriptCore/runtime/UStringBuilder.h b/JavaScriptCore/runtime/UStringBuilder.h
new file mode 100644
index 0000000..870c221
--- /dev/null
+++ b/JavaScriptCore/runtime/UStringBuilder.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef UStringBuilder_h
+#define UStringBuilder_h
+
+#include <wtf/text/StringBuilder.h>
+
+namespace JSC {
+
+class UStringBuilder : public StringBuilder {
+public:
+    // Forward declare these methods, otherwhise append() is ambigious.
+    void append(const UChar u) { StringBuilder::append(u); }
+    void append(const char* str) { StringBuilder::append(str); }
+    void append(const char* str, size_t len) { StringBuilder::append(str, len); }
+    void append(const UChar* str, size_t len) { StringBuilder::append(str, len); }
+
+    void append(const UString& str)
+    {
+        m_buffer.append(str.characters(), str.length());
+    }
+
+    UString toUString()
+    {
+        m_buffer.shrinkToFit();
+        ASSERT(m_buffer.data() || !m_buffer.size());
+        return UString::adopt(m_buffer);
+    }
+};
+
+} // namespace JSC
+
+#endif // UStringBuilder_h
diff --git a/JavaScriptCore/wtf/text/StringBuilder.h b/JavaScriptCore/wtf/text/StringBuilder.h
new file mode 100644
index 0000000..f938911
--- /dev/null
+++ b/JavaScriptCore/wtf/text/StringBuilder.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef StringBuilder_h
+#define StringBuilder_h
+
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WTF {
+
+class StringBuilder {
+public:
+    void append(const UChar u)
+    {
+        m_buffer.append(u);
+    }
+
+    void append(const char* str)
+    {
+        append(str, strlen(str));
+    }
+
+    void append(const char* str, size_t len)
+    {
+        reserveCapacity(m_buffer.size() + len);
+        for (size_t i = 0; i < len; i++)
+            m_buffer.append(static_cast<unsigned char>(str[i]));
+    }
+
+    void append(const UChar* str, size_t len)
+    {
+        m_buffer.append(str, len);
+    }
+
+    void append(const String& str)
+    {
+        m_buffer.append(str.characters(), str.length());
+    }
+
+    bool isEmpty() const { return m_buffer.isEmpty(); }
+    void reserveCapacity(size_t newCapacity)
+    {
+        if (newCapacity < m_buffer.capacity())
+            return;
+        m_buffer.reserveCapacity(std::max(newCapacity, m_buffer.capacity() + m_buffer.capacity() / 4 + 1));
+    }
+    void resize(size_t size) { m_buffer.resize(size); }
+    size_t size() const { return m_buffer.size(); }
+
+    UChar operator[](size_t i) const { return m_buffer.at(i); }
+
+    String toString()
+    {
+        m_buffer.shrinkToFit();
+        ASSERT(m_buffer.data() || !m_buffer.size());
+        return String::adopt(m_buffer);
+    }
+
+protected:
+    Vector<UChar, 64> m_buffer;
+};
+
+} // namespace WTF
+
+using WTF::StringBuilder;
+
+#endif // StringBuilder_h
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index 7af2148..f14d0e1 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -606,7 +606,6 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
 	platform/text/RegularExpression.cpp \
 	platform/text/SegmentedString.cpp \
 	platform/text/String.cpp \
-	platform/text/StringBuilder.cpp \
 	platform/text/TextBreakIteratorICU.cpp \
 	platform/text/TextCodec.cpp \
 	platform/text/TextCodecICU.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 5331eae..1a5bc33 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -1361,7 +1361,6 @@ SET(WebCore_SOURCES
     platform/text/RegularExpression.cpp
     platform/text/SegmentedString.cpp
     platform/text/String.cpp
-    platform/text/StringBuilder.cpp
     platform/text/TextBoundaries.cpp
     platform/text/TextCodec.cpp
     platform/text/TextCodecLatin1.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ebfafe4..c214b99 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,74 @@
+2010-10-12  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Gavin Barraclough.
+
+        Unify JSC::StringBuilder & WebCore::StringBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=47538
+
+        JSC::StringBuilder operates on a Vector<UChar, 64> and allows to build a string based on a stream of characters in an efficient manner.
+        WebCore::StringBuilder operates on a Vector<String, 16> and allows to concat an arbitary number of Strings. It's not efficient in handling single
+        characters, as a String with length=1 has to be constructed for those. An analysis of the callers of WebCore::StringBuilder shows that
+        most callsites actually combine Strings and single characters, so using a Vector<UChar> would be more efficient. Those who only combine large
+        strings are only used for debugging purposes, so it's fine to switch them to a Vector<UChar> approach as well.
+
+        Replace WebCore::StringBuilder with JSC::StringBuilder, and move it to wtf/text/StringBuilder.h into the WTF namespace.
+        While I was at it remove platform/text/StringBuffer.h, as it was only including wtf/text/StringBuffer.h.
+
+        No change in functionality, thus no new tests.
+
+        * Android.mk: Remove platform/text/StringBuilder.* and platform/text/StringBuffer.h.
+        * CMakeLists.txt: Ditto.
+        * GNUmakefile.am: Ditto. 
+        * WebCore.gypi: Ditto.
+        * WebCore.order: Ditto.
+        * WebCore.pro: Ditto.
+        * WebCore.vcproj/WebCore.vcproj: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * ForwardingHeaders/runtime/StringBuilder.h: Removed.
+        * ForwardingHeaders/runtime/UStringBuilder.h: Added.
+        * ForwardingHeaders/wtf/text/StringBuilder.h: Added.
+        * bindings/js/ScriptString.h: Don't include PlatformString.h but wtf/text/WTFString.h.
+        (WebCore::ScriptString::operator+=): Use JSC::UStringBuilder instead of JSC::StringBuilder.
+        * bridge/jni/JNIBridge.cpp: Use WTF::StringBuilder (+ use append(const UChar) for single characters).
+        * css/MediaQuery.cpp: Ditto.
+        * css/MediaQueryExp.cpp: Ditto.
+        * dom/Node.cpp: Ditto.
+        (WebCore::Node::appendTextContent): Manually track wheter the StringBuilder content is empty or null, the new StringBuilder doesn't differentiate between null & empty strings.
+        * dom/Node.h: Remove appendTextContent definition, it's not needed to be exported, removes the need for a StringBuilder.h include or forward declaration.
+        * html/DOMTokenList.cpp: Use WTF::StringBuilder.
+        * inspector/InspectorResource.cpp: Remove useless StringBuffer.h include.
+        * platform/android/FileSystemAndroid.cpp: Use WTF::StringBuilder.
+        * platform/brew/FileSystemBrew.cpp: Ditto.
+        * platform/chromium/ClipboardChromium.cpp: Ditto (+ use append(const UChar) for single characters).
+        * platform/graphics/gpu/PODInterval.h: Ditto (Only used as debugging helper here, in debug builds).
+        * platform/graphics/gpu/PODRedBlackTree.h: Ditto (Only used as debugging helper here, in debug builds).
+        * platform/graphics/mac/GraphicsLayerCA.mm: Remove useless StringBuilder.h include.
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp: Use WTF::StringBuilder, and use append(const UChar) for single characters.
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp: Ditto.
+        * platform/network/ProxyServer.cpp:
+        (WebCore::appendProxyServerString): Use WTF::StringBuilder.
+        * platform/text/StringBuffer.h: Removed.
+        * platform/text/StringBuilder.cpp: Removed.
+        * platform/text/StringBuilder.h: Removed.
+        * plugins/DOMMimeType.cpp: Use WTF::StringBuilder.
+        * svg/SVGPathParserFactory.cpp: Ditto.
+        * svg/SVGPathStringBuilder.cpp: SVGPathStringBuilder used stringBuilder.toString(ConcatAddingSpacesBetweenIndividualStrings), adapt to the change, that this mode is gone now.
+        (WebCore::SVGPathStringBuilder::result): Just use toString(), append a space to the end of each command, when building the string. Remove the last trailing space before building the result.
+        (WebCore::SVGPathStringBuilder::moveTo):
+        (WebCore::SVGPathStringBuilder::lineTo):
+        (WebCore::SVGPathStringBuilder::lineToHorizontal):
+        (WebCore::SVGPathStringBuilder::lineToVertical):
+        (WebCore::SVGPathStringBuilder::curveToCubic):
+        (WebCore::SVGPathStringBuilder::curveToCubicSmooth):
+        (WebCore::SVGPathStringBuilder::curveToQuadratic):
+        (WebCore::SVGPathStringBuilder::curveToQuadraticSmooth):
+        (WebCore::SVGPathStringBuilder::arcTo):
+        (WebCore::SVGPathStringBuilder::closePath):
+        * svg/SVGPathStringBuilder.h:
+        (WebCore::SVGPathStringBuilder::cleanup): StringBuilder::clear() is gone, just cleanup by assigning StringBuilder().
+        * websockets/WebSocket.cpp: Use WTF::StringBuilder.
+        * websockets/WebSocketHandshake.cpp: Ditto (+ use append(const UChar) for single characters).
+
 2010-10-12  Gyuyoung Kim  <gyuyoung.kim at samsung.com>
 
         Reviewed by Antonio Gomes.
diff --git a/WebCore/ForwardingHeaders/runtime/UStringBuilder.h b/WebCore/ForwardingHeaders/runtime/UStringBuilder.h
new file mode 100644
index 0000000..592a783
--- /dev/null
+++ b/WebCore/ForwardingHeaders/runtime/UStringBuilder.h
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_UStringBuilder_h
+#define WebCore_FWD_UStringBuilder_h
+#include <JavaScriptCore/UStringBuilder.h>
+#endif
diff --git a/WebCore/ForwardingHeaders/runtime/StringBuilder.h b/WebCore/ForwardingHeaders/wtf/text/StringBuilder.h
similarity index 100%
rename from WebCore/ForwardingHeaders/runtime/StringBuilder.h
rename to WebCore/ForwardingHeaders/wtf/text/StringBuilder.h
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index c629a7c..dc6e548 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2455,9 +2455,6 @@ webcore_sources += \
 	WebCore/platform/text/RegularExpression.h \
 	WebCore/platform/text/SegmentedString.cpp \
 	WebCore/platform/text/SegmentedString.h \
-	WebCore/platform/text/StringBuffer.h \
-	WebCore/platform/text/StringBuilder.cpp \
-	WebCore/platform/text/StringBuilder.h \
 	WebCore/platform/text/String.cpp \
 	WebCore/platform/text/SuffixTree.h \
 	WebCore/platform/text/TextBoundaries.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 2b406a3..25f9d7a 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3143,9 +3143,6 @@
             'platform/text/SegmentedString.cpp',
             'platform/text/SegmentedString.h',
             'platform/text/String.cpp',
-            'platform/text/StringBuffer.h',
-            'platform/text/StringBuilder.cpp',
-            'platform/text/StringBuilder.h',
             'platform/text/StringHash.h',
             'platform/text/StringImpl.h',
             'platform/text/SuffixTree.h',
diff --git a/WebCore/WebCore.order b/WebCore/WebCore.order
index 7eb980c..06dfb3d 100644
--- a/WebCore/WebCore.order
+++ b/WebCore/WebCore.order
@@ -3397,9 +3397,6 @@ __ZN7WebCore17HTMLScriptElement8checkDTDEPKNS_4NodeE
 __ZN7WebCore17HTMLScriptElement15childrenChangedEbPNS_4NodeES2_i
 __ZN7WebCore13ScriptElement15childrenChangedERNS_17ScriptElementDataE
 __ZNK7WebCore4Node11textContentEb
-__ZNK7WebCore4Node17appendTextContentEbRNS_13StringBuilderE
-__ZN7WebCore13StringBuilder6appendERKNS_6StringE
-__ZNK7WebCore13StringBuilder8toStringEv
 __ZN3WTF6VectorIN7WebCore6StringELm16EE6shrinkEm
 __ZN7WebCore17HTMLScriptElement21finishParsingChildrenEv
 __ZN7WebCore13ScriptElement21finishParsingChildrenERNS_17ScriptElementDataERKNS_6StringE
@@ -22595,7 +22592,6 @@ __ZN7WebCore16JSDOMWindowShell12lookupGetterEPN3JSC9ExecStateERKNS1_10Identifier
 __ZN7WebCore11JSDOMWindow12lookupGetterEPN3JSC9ExecStateERKNS1_10IdentifierE
 __ZN7WebCore16JSDOMWindowShell12defineSetterEPN3JSC9ExecStateERKNS1_10IdentifierEPNS1_8JSObjectEj
 __ZN7WebCore11JSDOMWindow12defineSetterEPN3JSC9ExecStateERKNS1_10IdentifierEPNS1_8JSObjectEj
-__ZN7WebCore13StringBuilder6appendEc
 __ZN7WebCore33jsLocationPrototypeFunctionAssignEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE
 __ZN7WebCore10JSLocation6assignEPN3JSC9ExecStateERKNS1_7ArgListE
 __ZN7WebCore33jsHistoryPrototypeFunctionForwardEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE
@@ -25840,7 +25836,6 @@ __ZNK3JSC8Bindings10RootObject12nativeHandleEv
 __ZNK3JSC8Bindings10JavaMethod8methodIDEP8_jobject
 __ZNK3JSC8Bindings10JavaMethod9signatureEv
 __ZN3JSC8Bindings26signatureFromPrimitiveTypeE7JNIType
-__ZL15appendClassNameRN7WebCore13StringBuilderEPKc
 __ZN3JSC8Bindings11getMethodIDEP8_jobjectPKcS4_
 __ZNK3JSC8Bindings10JavaMethod13JNIReturnTypeEv
 __ZN3JSC8Bindings15dispatchJNICallEPNS_9ExecStateEPKvP8_jobjectb7JNITypeP10_jmethodIDP6jvalueRSA_PKcRNS_7JSValueE
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 9b1c534..eee56ee 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1200,7 +1200,6 @@ SOURCES += \
     platform/text/SegmentedString.cpp \
     platform/SharedBuffer.cpp \
     platform/text/String.cpp \
-    platform/text/StringBuilder.cpp \
     platform/text/TextCodec.cpp \
     platform/text/TextCodecLatin1.cpp \
     platform/text/TextCodecUserDefined.cpp \
@@ -2141,7 +2140,6 @@ HEADERS += \
     platform/text/qt/TextCodecQt.h \
     platform/text/RegularExpression.h \
     platform/text/SegmentedString.h \
-    platform/text/StringBuilder.h \
     platform/text/TextCodec.h \
     platform/text/TextCodecLatin1.h \
     platform/text/TextCodecUserDefined.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 17ae90a..7af2d7f 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -28614,18 +28614,6 @@
 					>
 				</File>
 				<File
-					RelativePath="..\platform\text\StringBuffer.h"
-					>
-				</File>
-				<File
-					RelativePath="..\platform\text\StringBuilder.cpp"
-					>
-				</File>
-				<File
-					RelativePath="..\platform\text\StringBuilder.h"
-					>
-				</File>
-				<File
 					RelativePath="..\platform\text\StringHash.h"
 					>
 				</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index fea9e0e..1e479f4 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -2745,7 +2745,6 @@
 		939885C408B7E3D100E707C4 /* EventNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 939885C208B7E3D100E707C4 /* EventNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		939B02EE0EA2DBC400C54570 /* WidthIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939B02EC0EA2DBC400C54570 /* WidthIterator.cpp */; };
 		939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 939B02ED0EA2DBC400C54570 /* WidthIterator.h */; };
-		939B3E4E0D3C1E8400B4A92B /* StringBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 939B3E4D0D3C1E8400B4A92B /* StringBuffer.h */; };
 		93A38B4B0D0E5808006872C2 /* EditorCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93A38B4A0D0E5808006872C2 /* EditorCommand.cpp */; };
 		93B2D8160F9920D2006AE6B2 /* SuddenTermination.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B2D8150F9920D2006AE6B2 /* SuddenTermination.h */; };
 		93B2D8180F9920EE006AE6B2 /* SuddenTermination.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93B2D8170F9920EE006AE6B2 /* SuddenTermination.mm */; };
@@ -5333,8 +5332,6 @@
 		E18256900EF2B02D00933242 /* JSWorkerContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E182568E0EF2B02D00933242 /* JSWorkerContext.h */; };
 		E18258AC0EF3CD7000933242 /* JSWorkerContextCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18258AB0EF3CD7000933242 /* JSWorkerContextCustom.cpp */; };
 		E1A1470811102B1500EEC0F3 /* ContainerNodeAlgorithms.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */; };
-		E1A302BC0DE8370300C52F2C /* StringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A302BB0DE8370300C52F2C /* StringBuilder.h */; };
-		E1A302C10DE8376900C52F2C /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A302C00DE8376900C52F2C /* StringBuilder.cpp */; };
 		E1A5F99B0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */; };
 		E1A643F20EC0972500779668 /* WorkerScriptController.h in Headers */ = {isa = PBXBuildFile; fileRef = E1A643F10EC0972500779668 /* WorkerScriptController.h */; };
 		E1A643FD0EC097A000779668 /* WorkerScriptController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A643FC0EC097A000779668 /* WorkerScriptController.cpp */; };
@@ -8804,7 +8801,6 @@
 		939885C208B7E3D100E707C4 /* EventNames.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = EventNames.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		939B02EC0EA2DBC400C54570 /* WidthIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WidthIterator.cpp; sourceTree = "<group>"; };
 		939B02ED0EA2DBC400C54570 /* WidthIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WidthIterator.h; sourceTree = "<group>"; };
-		939B3E4D0D3C1E8400B4A92B /* StringBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringBuffer.h; sourceTree = "<group>"; };
 		93A38B4A0D0E5808006872C2 /* EditorCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditorCommand.cpp; sourceTree = "<group>"; };
 		93B2D8150F9920D2006AE6B2 /* SuddenTermination.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SuddenTermination.h; sourceTree = "<group>"; };
 		93B2D8170F9920EE006AE6B2 /* SuddenTermination.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SuddenTermination.mm; sourceTree = "<group>"; };
@@ -11331,8 +11327,6 @@
 		E182568E0EF2B02D00933242 /* JSWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerContext.h; sourceTree = "<group>"; };
 		E18258AB0EF3CD7000933242 /* JSWorkerContextCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContextCustom.cpp; sourceTree = "<group>"; };
 		E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContainerNodeAlgorithms.h; sourceTree = "<group>"; };
-		E1A302BB0DE8370300C52F2C /* StringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringBuilder.h; sourceTree = "<group>"; };
-		E1A302C00DE8376900C52F2C /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringBuilder.cpp; sourceTree = "<group>"; };
 		E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannelCustom.cpp; sourceTree = "<group>"; };
 		E1A643F10EC0972500779668 /* WorkerScriptController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerScriptController.h; sourceTree = "<group>"; };
 		E1A643FC0EC097A000779668 /* WorkerScriptController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerScriptController.cpp; sourceTree = "<group>"; };
@@ -16561,9 +16555,6 @@
 				B2C3D9FE0D006C1D00EF6F26 /* SegmentedString.cpp */,
 				B2C3D9FF0D006C1D00EF6F26 /* SegmentedString.h */,
 				B2C3DA000D006C1D00EF6F26 /* String.cpp */,
-				939B3E4D0D3C1E8400B4A92B /* StringBuffer.h */,
-				E1A302C00DE8376900C52F2C /* StringBuilder.cpp */,
-				E1A302BB0DE8370300C52F2C /* StringBuilder.h */,
 				97C0784F1165D5BE003A32EF /* SuffixTree.h */,
 				B2C3DA040D006C1D00EF6F26 /* TextBoundaries.h */,
 				B2C3DA060D006C1D00EF6F26 /* TextBreakIterator.h */,
@@ -20590,8 +20581,6 @@
 				C50D0E830FF4272900AC2644 /* StorageNamespace.h in Headers */,
 				C55E38BF10040D5D00A56BDB /* StorageNamespaceImpl.h in Headers */,
 				C5102D940FD9AA2D00FAFF04 /* StorageSyncManager.h in Headers */,
-				939B3E4E0D3C1E8400B4A92B /* StringBuffer.h in Headers */,
-				E1A302BC0DE8370300C52F2C /* StringBuilder.h in Headers */,
 				65488D6B0DD5A83D009D83B2 /* StringSourceProvider.h in Headers */,
 				B23540F30D00782E002382FA /* StringTruncator.h in Headers */,
 				849F77760EFEC6200090849D /* StrokeStyleApplier.h in Headers */,
@@ -23196,7 +23185,6 @@
 				C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */,
 				C5102D950FD9AA2D00FAFF04 /* StorageSyncManager.cpp in Sources */,
 				B2C3DA300D006C1D00EF6F26 /* String.cpp in Sources */,
-				E1A302C10DE8376900C52F2C /* StringBuilder.cpp in Sources */,
 				B2B2645C0D00A77E000ACC1D /* StringCF.cpp in Sources */,
 				B2B2645D0D00A77E000ACC1D /* StringImplCF.cpp in Sources */,
 				B2AFFC950D00A5DF0030074D /* StringImplMac.mm in Sources */,
diff --git a/WebCore/bindings/js/ScriptString.h b/WebCore/bindings/js/ScriptString.h
index 7401818..98dab6b 100644
--- a/WebCore/bindings/js/ScriptString.h
+++ b/WebCore/bindings/js/ScriptString.h
@@ -32,10 +32,10 @@
 #define ScriptString_h
 
 #include "JSDOMBinding.h"
-#include "PlatformString.h"
 #include <runtime/UString.h>
-#include <runtime/StringBuilder.h>
+#include <runtime/UStringBuilder.h>
 #include <wtf/Forward.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
@@ -61,10 +61,10 @@ public:
 
     ScriptString& operator+=(const String& s)
     {
-        JSC::StringBuilder buffer;
+        JSC::UStringBuilder buffer;
         buffer.append(m_str);
         buffer.append(stringToUString(s));
-        m_str = buffer.build();
+        m_str = buffer.toUString();
         return *this;
     }
 
diff --git a/WebCore/bridge/jni/JNIBridge.cpp b/WebCore/bridge/jni/JNIBridge.cpp
index 8fa2678..c512ee7 100644
--- a/WebCore/bridge/jni/JNIBridge.cpp
+++ b/WebCore/bridge/jni/JNIBridge.cpp
@@ -29,14 +29,11 @@
 
 #if ENABLE(JAVA_BRIDGE)
 
-#include "StringBuilder.h"
 #include <wtf/text/CString.h>
-
+#include <wtf/text/StringBuilder.h>
 
 using namespace JSC;
 using namespace JSC::Bindings;
-using namespace WebCore;
-
 
 JavaParameter::JavaParameter(JNIEnv* env, jstring type)
 {
@@ -132,7 +129,7 @@ const char* JavaMethod::signature() const
 #endif
 
         StringBuilder signatureBuilder;
-        signatureBuilder.append("(");
+        signatureBuilder.append('(');
         for (int i = 0; i < m_numParameters; i++) {
             JavaParameter* aParameter = parameterAt(i);
             JNIType type = aParameter->getJNIType();
@@ -142,11 +139,11 @@ const char* JavaMethod::signature() const
                 signatureBuilder.append(signatureFromPrimitiveType(type));
                 if (type == object_type) {
                     appendClassName(signatureBuilder, aParameter->type());
-                    signatureBuilder.append(";");
+                    signatureBuilder.append(';');
                 }
             }
         }
-        signatureBuilder.append(")");
+        signatureBuilder.append(')');
 
         const char* returnType = m_returnType.utf8();
         if (m_JNIReturnType == array_type)
@@ -155,7 +152,7 @@ const char* JavaMethod::signature() const
             signatureBuilder.append(signatureFromPrimitiveType(m_JNIReturnType));
             if (m_JNIReturnType == object_type) {
                 appendClassName(signatureBuilder, returnType);
-                signatureBuilder.append(";");
+                signatureBuilder.append(';');
             }
         }
 
diff --git a/WebCore/css/MediaQuery.cpp b/WebCore/css/MediaQuery.cpp
index 77a79ad..c476a21 100644
--- a/WebCore/css/MediaQuery.cpp
+++ b/WebCore/css/MediaQuery.cpp
@@ -30,8 +30,8 @@
 #include "MediaQuery.h"
 
 #include "MediaQueryExp.h"
-#include "StringBuilder.h"
 #include <wtf/NonCopyingSort.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
diff --git a/WebCore/css/MediaQueryExp.cpp b/WebCore/css/MediaQueryExp.cpp
index 36a155e..e970400 100644
--- a/WebCore/css/MediaQueryExp.cpp
+++ b/WebCore/css/MediaQueryExp.cpp
@@ -32,7 +32,7 @@
 #include "CSSParser.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSValueList.h"
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp
index ab9dc02..873a2f3 100644
--- a/WebCore/dom/Node.cpp
+++ b/WebCore/dom/Node.cpp
@@ -72,7 +72,6 @@
 #include "ScriptController.h"
 #include "SelectorNodeList.h"
 #include "StaticNodeList.h"
-#include "StringBuilder.h"
 #include "TagNodeList.h"
 #include "Text.h"
 #include "TextEvent.h"
@@ -88,6 +87,7 @@
 #include <wtf/RefCountedLeakCounter.h>
 #include <wtf/UnusedParam.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
 
 #if ENABLE(DOM_STORAGE)
 #include "StorageEvent.h"
@@ -1923,52 +1923,54 @@ String Node::lookupNamespacePrefix(const AtomicString &_namespaceURI, const Elem
     return String();
 }
 
-void Node::appendTextContent(bool convertBRsToNewlines, StringBuilder& content) const
+static void appendTextContent(const Node* node, bool convertBRsToNewlines, bool& isNullString, StringBuilder& content)
 {
-    switch (nodeType()) {
-        case TEXT_NODE:
-        case CDATA_SECTION_NODE:
-        case COMMENT_NODE:
-            content.append(static_cast<const CharacterData*>(this)->data());
-            break;
+    switch (node->nodeType()) {
+    case Node::TEXT_NODE:
+    case Node::CDATA_SECTION_NODE:
+    case Node::COMMENT_NODE:
+        isNullString = false;
+        content.append(static_cast<const CharacterData*>(node)->data());
+        break;
 
-        case PROCESSING_INSTRUCTION_NODE:
-            content.append(static_cast<const ProcessingInstruction*>(this)->data());
+    case Node::PROCESSING_INSTRUCTION_NODE:
+        isNullString = false;
+        content.append(static_cast<const ProcessingInstruction*>(node)->data());
+        break;
+    
+    case Node::ELEMENT_NODE:
+        if (node->hasTagName(brTag) && convertBRsToNewlines) {
+            isNullString = false;
+            content.append('\n');
             break;
-        
-        case ELEMENT_NODE:
-            if (hasTagName(brTag) && convertBRsToNewlines) {
-                content.append('\n');
-                break;
         }
-        // Fall through.
-        case ATTRIBUTE_NODE:
-        case ENTITY_NODE:
-        case ENTITY_REFERENCE_NODE:
-        case DOCUMENT_FRAGMENT_NODE:
-            content.setNonNull();
-
-            for (Node *child = firstChild(); child; child = child->nextSibling()) {
-                if (child->nodeType() == COMMENT_NODE || child->nodeType() == PROCESSING_INSTRUCTION_NODE)
-                    continue;
-            
-                child->appendTextContent(convertBRsToNewlines, content);
-            }
-            break;
+    // Fall through.
+    case Node::ATTRIBUTE_NODE:
+    case Node::ENTITY_NODE:
+    case Node::ENTITY_REFERENCE_NODE:
+    case Node::DOCUMENT_FRAGMENT_NODE:
+        isNullString = false;
+        for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
+            if (child->nodeType() == Node::COMMENT_NODE || child->nodeType() == Node::PROCESSING_INSTRUCTION_NODE)
+                continue;
+            appendTextContent(child, convertBRsToNewlines, isNullString, content);
+        }
+        break;
 
-        case DOCUMENT_NODE:
-        case DOCUMENT_TYPE_NODE:
-        case NOTATION_NODE:
-        case XPATH_NAMESPACE_NODE:
-            break;
+    case Node::DOCUMENT_NODE:
+    case Node::DOCUMENT_TYPE_NODE:
+    case Node::NOTATION_NODE:
+    case Node::XPATH_NAMESPACE_NODE:
+        break;
     }
 }
 
 String Node::textContent(bool convertBRsToNewlines) const
 {
     StringBuilder content;
-    appendTextContent(convertBRsToNewlines, content);
-    return content.toString();
+    bool isNullString = true;
+    appendTextContent(this, convertBRsToNewlines, isNullString, content);
+    return isNullString ? String() : content.toString();
 }
 
 void Node::setTextContent(const String &text, ExceptionCode& ec)
diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h
index b358094..33a222b 100644
--- a/WebCore/dom/Node.h
+++ b/WebCore/dom/Node.h
@@ -69,7 +69,6 @@ class RenderBox;
 class RenderBoxModelObject;
 class RenderObject;
 class RenderStyle;
-class StringBuilder;
 class TagNodeList;
 
 typedef int ExceptionCode;
@@ -706,7 +705,6 @@ private:
 
     Element* ancestorElement() const;
 
-    void appendTextContent(bool convertBRsToNewlines, StringBuilder&) const;
     void trackForDebugging();
 
     Document* m_document;
diff --git a/WebCore/html/DOMTokenList.cpp b/WebCore/html/DOMTokenList.cpp
index 3383447..aa0a74b 100644
--- a/WebCore/html/DOMTokenList.cpp
+++ b/WebCore/html/DOMTokenList.cpp
@@ -29,7 +29,7 @@
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
 #include "SpaceSplitString.h"
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
diff --git a/WebCore/inspector/InspectorResource.cpp b/WebCore/inspector/InspectorResource.cpp
index 570a4fb..ffe1f71 100644
--- a/WebCore/inspector/InspectorResource.cpp
+++ b/WebCore/inspector/InspectorResource.cpp
@@ -44,12 +44,12 @@
 #include "ResourceLoadTiming.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
-#include "StringBuffer.h"
 #include "TextEncoding.h"
 #include "WebSocketHandshakeRequest.h"
 #include "WebSocketHandshakeResponse.h"
 
 #include <wtf/Assertions.h>
+#include <wtf/text/StringBuffer.h>
 
 namespace WebCore {
 
diff --git a/WebCore/platform/android/FileSystemAndroid.cpp b/WebCore/platform/android/FileSystemAndroid.cpp
index 3d841d7..6725d92 100644
--- a/WebCore/platform/android/FileSystemAndroid.cpp
+++ b/WebCore/platform/android/FileSystemAndroid.cpp
@@ -28,7 +28,6 @@
 #include "config.h"
 #include "FileSystem.h"
 
-#include "StringBuilder.h"
 #include "cutils/log.h"
 #include <dirent.h>
 #include <dlfcn.h>
@@ -36,6 +35,7 @@
 #include <fnmatch.h>
 #include <sys/stat.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
diff --git a/WebCore/platform/brew/FileSystemBrew.cpp b/WebCore/platform/brew/FileSystemBrew.cpp
index 2411c3b..e207b55 100644
--- a/WebCore/platform/brew/FileSystemBrew.cpp
+++ b/WebCore/platform/brew/FileSystemBrew.cpp
@@ -30,8 +30,6 @@
 #include "FileSystem.h"
 
 #include "NotImplemented.h"
-#include "PlatformString.h"
-#include "StringBuilder.h"
 
 #include <AEEAppGen.h>
 #include <AEEFile.h>
@@ -41,6 +39,8 @@
 #include <wtf/brew/RefPtrBrew.h>
 #include <wtf/brew/ShellBrew.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
diff --git a/WebCore/platform/chromium/ClipboardChromium.cpp b/WebCore/platform/chromium/ClipboardChromium.cpp
index effbc4a..46b4339 100644
--- a/WebCore/platform/chromium/ClipboardChromium.cpp
+++ b/WebCore/platform/chromium/ClipboardChromium.cpp
@@ -41,13 +41,14 @@
 #include "Image.h"
 #include "MIMETypeRegistry.h"
 #include "NamedNodeMap.h"
-#include "PlatformString.h"
 #include "Range.h"
 #include "RenderImage.h"
 #include "ScriptExecutionContext.h"
-#include "StringBuilder.h"
 #include "markup.h"
 
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -205,7 +206,7 @@ static String imageToMarkup(const String& url, Element* element)
     StringBuilder markup;
     markup.append("<img src=\"");
     markup.append(url);
-    markup.append("\"");
+    markup.append('"');
     // Copy over attributes.  If we are dragging an image, we expect things like
     // the id to be copied as well.
     NamedNodeMap* attrs = element->attributes();
@@ -214,13 +215,13 @@ static String imageToMarkup(const String& url, Element* element)
         Attribute* attr = attrs->attributeItem(i);
         if (attr->localName() == "src")
             continue;
-        markup.append(" ");
+        markup.append(' ');
         markup.append(attr->localName());
         markup.append("=\"");
         String escapedAttr = attr->value();
         escapedAttr.replace("\"", "&quot;");
         markup.append(escapedAttr);
-        markup.append("\"");
+        markup.append('"');
     }
 
     markup.append("/>");
diff --git a/WebCore/platform/graphics/gpu/PODInterval.h b/WebCore/platform/graphics/gpu/PODInterval.h
index 12a4420..5c1dcc2 100644
--- a/WebCore/platform/graphics/gpu/PODInterval.h
+++ b/WebCore/platform/graphics/gpu/PODInterval.h
@@ -27,7 +27,7 @@
 #define PODInterval_h
 
 #ifndef NDEBUG
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
 #endif
 
 namespace WebCore {
diff --git a/WebCore/platform/graphics/gpu/PODRedBlackTree.h b/WebCore/platform/graphics/gpu/PODRedBlackTree.h
index 7898628..6d5954c 100644
--- a/WebCore/platform/graphics/gpu/PODRedBlackTree.h
+++ b/WebCore/platform/graphics/gpu/PODRedBlackTree.h
@@ -78,9 +78,9 @@
 #include <wtf/RefPtr.h>
 #ifndef NDEBUG
 #include "Logging.h"
-#include "PlatformString.h"
-#include "StringBuilder.h"
 #include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
 #endif
 
 namespace WebCore {
diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
index 76d6a3b..4e77e13 100644
--- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
+++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm
@@ -38,7 +38,6 @@
 #import <QuartzCore/QuartzCore.h>
 #import "RotateTransformOperation.h"
 #import "ScaleTransformOperation.h"
-#import "StringBuilder.h"
 #import "SystemTime.h"
 #import "TranslateTransformOperation.h"
 #import "WebLayer.h"
diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
index 354e0bf..d2c258e 100644
--- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
+++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
@@ -42,7 +42,6 @@
 #include "ScrollView.h"
 #include "Settings.h"
 #include "SoftLinking.h"
-#include "StringBuilder.h"
 #include "TimeRanges.h"
 #include "Timer.h"
 #include <AssertMacros.h>
@@ -53,6 +52,7 @@
 #include <wtf/MainThread.h>
 #include <wtf/MathExtras.h>
 #include <wtf/StdLibExtras.h>
+#include <wtf/text/StringBuilder.h>
 #include <wtf/text/StringHash.h>
 
 #if USE(ACCELERATED_COMPOSITING)
@@ -241,7 +241,7 @@ static void addCookieParam(StringBuilder& cookieBuilder, const String& name, con
     // Add parameter name, and value if there is one.
     cookieBuilder.append(name);
     if (!value.isEmpty()) {
-        cookieBuilder.append("=");
+        cookieBuilder.append('=');
         cookieBuilder.append(value);
     }
 }
@@ -275,7 +275,7 @@ void MediaPlayerPrivateQuickTimeVisualContext::setUpCookiesForQuickTime(const St
             addCookieParam(cookieBuilder, "expires", rfc2616DateStringFromTime(cookie.expires));
         if (cookie.httpOnly) 
             addCookieParam(cookieBuilder, "httpOnly", String());
-        cookieBuilder.append(";");
+        cookieBuilder.append(';');
 
         String cookieURL;
         if (!cookie.domain.isEmpty()) {
diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp
index c37f5d5..39e8a11 100644
--- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp
+++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp
@@ -38,7 +38,6 @@
 #include "QTMovieTask.h"
 #include "ScrollView.h"
 #include "SoftLinking.h"
-#include "StringBuilder.h"
 #include "TimeRanges.h"
 #include "Timer.h"
 #include <Wininet.h>
@@ -46,6 +45,7 @@
 #include <wtf/HashSet.h>
 #include <wtf/MathExtras.h>
 #include <wtf/StdLibExtras.h>
+#include <wtf/text/StringBuilder.h>
 #include <wtf/text/StringHash.h>
 
 #if USE(ACCELERATED_COMPOSITING)
@@ -159,7 +159,7 @@ static void addCookieParam(StringBuilder& cookieBuilder, const String& name, con
     // Add parameter name, and value if there is one.
     cookieBuilder.append(name);
     if (!value.isEmpty()) {
-        cookieBuilder.append("=");
+        cookieBuilder.append('=');
         cookieBuilder.append(value);
     }
 }
@@ -194,7 +194,7 @@ void MediaPlayerPrivate::setUpCookiesForQuickTime(const String& url)
             addCookieParam(cookieBuilder, "expires", rfc2616DateStringFromTime(cookie.expires));
         if (cookie.httpOnly) 
             addCookieParam(cookieBuilder, "httpOnly", String());
-        cookieBuilder.append(";");
+        cookieBuilder.append(';');
 
         String cookieURL;
         if (!cookie.domain.isEmpty()) {
diff --git a/WebCore/platform/network/ProxyServer.cpp b/WebCore/platform/network/ProxyServer.cpp
index ef08d6c..7ef283b 100644
--- a/WebCore/platform/network/ProxyServer.cpp
+++ b/WebCore/platform/network/ProxyServer.cpp
@@ -26,11 +26,11 @@
 #include "config.h"
 #include "ProxyServer.h"
 
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
-static void appendProxyServerString(StringBuilder &builder, const ProxyServer& proxyServer)
+static void appendProxyServerString(StringBuilder& builder, const ProxyServer& proxyServer)
 {
     switch (proxyServer.type()) {
     case ProxyServer::Direct:
diff --git a/WebCore/platform/text/StringBuffer.h b/WebCore/platform/text/StringBuffer.h
deleted file mode 100644
index 3a753b4..0000000
--- a/WebCore/platform/text/StringBuffer.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Inc. ("Apple") nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebCoreStringBuffer_h
-#define WebCoreStringBuffer_h
-
-// FIXME: remove this header, use the forward from wtf directly.
-#include <wtf/text/StringBuffer.h>
-
-#endif // StringBuffer_h
diff --git a/WebCore/platform/text/StringBuilder.cpp b/WebCore/platform/text/StringBuilder.cpp
deleted file mode 100644
index 32f0b53..0000000
--- a/WebCore/platform/text/StringBuilder.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- 
-#include "config.h"
-#include "StringBuilder.h"
-
-using namespace std;
-
-namespace WebCore {
-
-static inline void checkedAppend(unsigned& totalLength, unsigned charactersToAppend)
-{
-    if (numeric_limits<unsigned>::max() - charactersToAppend <= totalLength)
-        CRASH();
-
-    totalLength += charactersToAppend;
-}
-
-void StringBuilder::append(const String& string)
-{
-    if (string.isNull())
-        return;
-
-    unsigned totalLength = length();
-    checkedAppend(totalLength, string.length());
-    m_totalLength = totalLength;
-
-    if (!string.isEmpty())
-        m_strings.append(string);
-}
-
-void StringBuilder::append(UChar c)
-{
-    unsigned totalLength = length();
-    checkedAppend(totalLength, 1);
-    m_totalLength = totalLength;
-
-    m_strings.append(String(&c, 1));
-}
-
-void StringBuilder::append(char c)
-{
-    unsigned totalLength = length();
-    checkedAppend(totalLength, 1);
-    m_totalLength = totalLength;
-
-    m_strings.append(String(&c, 1));
-}
-
-String StringBuilder::toString(ConcatMode mode) const
-{
-    if (isNull())
-        return String();
-
-    unsigned count = m_strings.size();
-
-    if (!count)
-        return String(StringImpl::empty());
-    if (count == 1)
-        return m_strings[0];
-
-    unsigned totalLength = m_totalLength;
-    if (mode == ConcatAddingSpacesBetweenIndividualStrings)
-        checkedAppend(totalLength, count - 1);
-
-    UChar* buffer;
-    String result = String::createUninitialized(totalLength, buffer);
-
-    UChar* p = buffer;
-
-    // We could handle both Concat modes in a single for loop, not doing that for performance reasons.
-    if (mode == ConcatUnaltered) {
-        for (unsigned i = 0; i < count; ++i) {
-            StringImpl* string = m_strings[i].impl();
-            unsigned length = string->length(); 
-            memcpy(p, string->characters(), length * sizeof(UChar));
-            p += length;
-        }
-    } else {
-        ASSERT(mode == ConcatAddingSpacesBetweenIndividualStrings);
-        for (unsigned i = 0; i < count; ++i) {
-            StringImpl* string = m_strings[i].impl();
-            unsigned length = string->length(); 
-            memcpy(p, string->characters(), length * sizeof(UChar));
-            p += length;
-
-            // Add space after string before the start of the next string, if we're not processing the last string.
-            if (i < count - 1) {
-                *p = ' ';
-                ++p;
-            }
-        }
-    }
-    ASSERT(p == totalLength + buffer);
-
-    return result;
-}
-
-void StringBuilder::clear()
-{
-    m_totalLength = numeric_limits<unsigned>::max();
-    m_strings.clear();
-}
-
-unsigned StringBuilder::length() const
-{
-    if (isNull())
-        return 0;
-    return m_totalLength;
-}
-
-} // namespace WebCore
diff --git a/WebCore/platform/text/StringBuilder.h b/WebCore/platform/text/StringBuilder.h
deleted file mode 100644
index dd8c1c0..0000000
--- a/WebCore/platform/text/StringBuilder.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2008, 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef StringBuilder_h
-#define StringBuilder_h
-
-#include "PlatformString.h"
-#include <limits>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-enum ConcatMode {
-    ConcatUnaltered,
-    ConcatAddingSpacesBetweenIndividualStrings
-};
-
-class StringBuilder {
-public:
-    StringBuilder() : m_totalLength(std::numeric_limits<unsigned>::max()) {}
-
-    void setNonNull()
-    {
-        if (isNull())
-            m_totalLength = 0;
-    }
-
-    void append(const String&);
-    void append(UChar);
-    void append(char);
-    
-    void clear();
-    unsigned length() const;
-
-    String toString(ConcatMode mode = ConcatUnaltered) const;
-
-private:
-    bool isNull() const { return m_totalLength == std::numeric_limits<unsigned>::max(); }
-
-    unsigned m_totalLength;
-    Vector<String, 16> m_strings;
-};
-
-} // namespace WebCore
-
-#endif // StringBuilder_h
diff --git a/WebCore/plugins/DOMMimeType.cpp b/WebCore/plugins/DOMMimeType.cpp
index e1fa7f1..e799314 100644
--- a/WebCore/plugins/DOMMimeType.cpp
+++ b/WebCore/plugins/DOMMimeType.cpp
@@ -25,7 +25,7 @@
 #include "Page.h"
 #include "PluginData.h"
 #include "Settings.h"
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
diff --git a/WebCore/svg/SVGPathParserFactory.cpp b/WebCore/svg/SVGPathParserFactory.cpp
index b251ec4..e707c20 100644
--- a/WebCore/svg/SVGPathParserFactory.cpp
+++ b/WebCore/svg/SVGPathParserFactory.cpp
@@ -33,7 +33,6 @@
 #include "SVGPathStringBuilder.h"
 #include "SVGPathStringSource.h"
 #include "SVGPathTraversalStateBuilder.h"
-#include "StringBuilder.h"
 
 namespace WebCore {
 
diff --git a/WebCore/svg/SVGPathStringBuilder.cpp b/WebCore/svg/SVGPathStringBuilder.cpp
index 951956d..418e367 100644
--- a/WebCore/svg/SVGPathStringBuilder.cpp
+++ b/WebCore/svg/SVGPathStringBuilder.cpp
@@ -24,81 +24,92 @@
 
 namespace WebCore {
 
+String SVGPathStringBuilder::result()
+{
+    unsigned size = m_stringBuilder.size();
+    if (!size)
+        return String();
+
+    // Remove trailing space.
+    m_stringBuilder.resize(size - 1);
+    return m_stringBuilder.toString();
+}
+
 void SVGPathStringBuilder::moveTo(const FloatPoint& targetPoint, bool, PathCoordinateMode mode)
 {
     if (mode == AbsoluteCoordinates)
-        m_stringBuilder.append(String::format("M %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("M %.6lg %.6lg ", targetPoint.x(), targetPoint.y()));
     else
-        m_stringBuilder.append(String::format("m %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("m %.6lg %.6lg ", targetPoint.x(), targetPoint.y()));
 }
 
 void SVGPathStringBuilder::lineTo(const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
     if (mode == AbsoluteCoordinates)
-        m_stringBuilder.append(String::format("L %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("L %.6lg %.6lg ", targetPoint.x(), targetPoint.y()));
     else
-        m_stringBuilder.append(String::format("l %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("l %.6lg %.6lg ", targetPoint.x(), targetPoint.y()));
 }
 
 void SVGPathStringBuilder::lineToHorizontal(float x, PathCoordinateMode mode)
 {
     if (mode == AbsoluteCoordinates)
-        m_stringBuilder.append(String::format("H %.6lg", x));
+        m_stringBuilder.append(String::format("H %.6lg ", x));
     else
-        m_stringBuilder.append(String::format("h %.6lg", x));
+        m_stringBuilder.append(String::format("h %.6lg ", x));
 }
 
 void SVGPathStringBuilder::lineToVertical(float y, PathCoordinateMode mode)
 {
     if (mode == AbsoluteCoordinates)
-        m_stringBuilder.append(String::format("V %.6lg", y));
+        m_stringBuilder.append(String::format("V %.6lg ", y));
     else
-        m_stringBuilder.append(String::format("v %.6lg", y));
+        m_stringBuilder.append(String::format("v %.6lg ", y));
 }
 
 void SVGPathStringBuilder::curveToCubic(const FloatPoint& point1, const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
     if (mode == AbsoluteCoordinates)
-        m_stringBuilder.append(String::format("C %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", point1.x(), point1.y(), point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("C %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg ", point1.x(), point1.y(), point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
     else
-        m_stringBuilder.append(String::format("c %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg", point1.x(), point1.y(), point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("c %.6lg %.6lg %.6lg %.6lg %.6lg %.6lg ", point1.x(), point1.y(), point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
 }
 
 void SVGPathStringBuilder::curveToCubicSmooth(const FloatPoint& point2, const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
     if (mode == AbsoluteCoordinates)
-        m_stringBuilder.append(String::format("S %.6lg %.6lg %.6lg %.6lg", point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("S %.6lg %.6lg %.6lg %.6lg ", point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
     else
-        m_stringBuilder.append(String::format("s %.6lg %.6lg %.6lg %.6lg", point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("s %.6lg %.6lg %.6lg %.6lg ", point2.x(), point2.y(), targetPoint.x(), targetPoint.y()));
 }
 
 void SVGPathStringBuilder::curveToQuadratic(const FloatPoint& point1, const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
     if (mode == AbsoluteCoordinates)
-        m_stringBuilder.append(String::format("Q %.6lg %.6lg %.6lg %.6lg", point1.x(), point1.y(), targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("Q %.6lg %.6lg %.6lg %.6lg ", point1.x(), point1.y(), targetPoint.x(), targetPoint.y()));
     else
-        m_stringBuilder.append(String::format("q %.6lg %.6lg %.6lg %.6lg", point1.x(), point1.y(), targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("q %.6lg %.6lg %.6lg %.6lg ", point1.x(), point1.y(), targetPoint.x(), targetPoint.y()));
 }
 
 void SVGPathStringBuilder::curveToQuadraticSmooth(const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
     if (mode == AbsoluteCoordinates)
-        m_stringBuilder.append(String::format("T %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("T %.6lg %.6lg ", targetPoint.x(), targetPoint.y()));
     else
-        m_stringBuilder.append(String::format("t %.6lg %.6lg", targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("t %.6lg %.6lg ", targetPoint.x(), targetPoint.y()));
 }
 
 void SVGPathStringBuilder::arcTo(float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, const FloatPoint& targetPoint, PathCoordinateMode mode)
 {
     if (mode == AbsoluteCoordinates)
-        m_stringBuilder.append(String::format("A %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", r1, r2, angle, largeArcFlag, sweepFlag, targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("A %.6lg %.6lg %.6lg %d %d %.6lg %.6lg ", r1, r2, angle, largeArcFlag, sweepFlag, targetPoint.x(), targetPoint.y()));
     else
-        m_stringBuilder.append(String::format("a %.6lg %.6lg %.6lg %d %d %.6lg %.6lg", r1, r2, angle, largeArcFlag, sweepFlag, targetPoint.x(), targetPoint.y()));
+        m_stringBuilder.append(String::format("a %.6lg %.6lg %.6lg %d %d %.6lg %.6lg ", r1, r2, angle, largeArcFlag, sweepFlag, targetPoint.x(), targetPoint.y()));
 }
 
 void SVGPathStringBuilder::closePath()
 {
-    m_stringBuilder.append("Z");
+    m_stringBuilder.append("Z ");
 }
 
 } // namespace WebCore
diff --git a/WebCore/svg/SVGPathStringBuilder.h b/WebCore/svg/SVGPathStringBuilder.h
index a51c40c..6a7e980 100644
--- a/WebCore/svg/SVGPathStringBuilder.h
+++ b/WebCore/svg/SVGPathStringBuilder.h
@@ -23,16 +23,16 @@
 #if ENABLE(SVG)
 #include "FloatPoint.h"
 #include "SVGPathConsumer.h"
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
 class SVGPathStringBuilder : public SVGPathConsumer {
 public:
-    String result() { return m_stringBuilder.toString(ConcatAddingSpacesBetweenIndividualStrings); }
+    String result();
 
 private:
-    virtual void cleanup() { m_stringBuilder.clear(); }
+    virtual void cleanup() { m_stringBuilder = StringBuilder(); }
     virtual void incrementPathSegmentCount() { }
     virtual bool continueConsuming() { return true; }
 
diff --git a/WebCore/websockets/WebSocket.cpp b/WebCore/websockets/WebSocket.cpp
index 073a924..eb4b567 100644
--- a/WebCore/websockets/WebSocket.cpp
+++ b/WebCore/websockets/WebSocket.cpp
@@ -42,11 +42,11 @@
 #include "Logging.h"
 #include "MessageEvent.h"
 #include "ScriptExecutionContext.h"
-#include "StringBuilder.h"
 #include "ThreadableWebSocketChannel.h"
 #include "WebSocketChannel.h"
-#include <wtf/text/CString.h>
 #include <wtf/StdLibExtras.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
diff --git a/WebCore/websockets/WebSocketHandshake.cpp b/WebCore/websockets/WebSocketHandshake.cpp
index effbb67..45e47a8 100644
--- a/WebCore/websockets/WebSocketHandshake.cpp
+++ b/WebCore/websockets/WebSocketHandshake.cpp
@@ -43,7 +43,6 @@
 #include "Logging.h"
 #include "ScriptExecutionContext.h"
 #include "SecurityOrigin.h"
-#include "StringBuilder.h"
 
 #include <wtf/MD5.h>
 #include <wtf/RandomNumber.h>
@@ -52,6 +51,7 @@
 #include <wtf/Vector.h>
 #include <wtf/text/AtomicString.h>
 #include <wtf/text/CString.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
@@ -75,7 +75,7 @@ static String hostName(const KURL& url, bool secure)
     StringBuilder builder;
     builder.append(url.host().lower());
     if (url.port() && ((!secure && url.port() != 80) || (secure && url.port() != 443))) {
-        builder.append(":");
+        builder.append(':');
         builder.append(String::number(url.port()));
     }
     return builder.toString();
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index a3927b5..8b2deef 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-12  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Gavin Barraclough.
+
+        Unify JSC::StringBuilder & WebCore::StringBuilder
+        https://bugs.webkit.org/show_bug.cgi?id=47538
+
+        * src/LocalizedStrings.cpp:
+        (WebCore::imageTitle): Use WTF::StringBuilder.
+        * src/WebEntities.cpp:
+        (WebKit::WebEntities::convertEntitiesInString): Ditto.
+        * src/WebPageSerializerImpl.cpp: Remove useless includes.
+        (WebKit::WebPageSerializerImpl::encodeAndFlushBuffer): 
+        * src/WebPageSerializerImpl.h: Use WTF::StringBuilder.
+
 2010-10-07  Stephen White  <senorblanco at chromium.org>
 
         Reviewed by James Robinson.
diff --git a/WebKit/chromium/src/LocalizedStrings.cpp b/WebKit/chromium/src/LocalizedStrings.cpp
index 3354c30..ecc53e4 100644
--- a/WebKit/chromium/src/LocalizedStrings.cpp
+++ b/WebKit/chromium/src/LocalizedStrings.cpp
@@ -33,14 +33,15 @@
 
 #include "IntSize.h"
 #include "NotImplemented.h"
-#include "PlatformString.h"
-#include "StringBuilder.h"
 
 #include "WebKit.h"
 #include "WebKitClient.h"
 #include "WebLocalizedString.h"
 #include "WebString.h"
 
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
+
 using WebKit::WebLocalizedString;
 
 namespace WebCore {
@@ -220,7 +221,7 @@ String imageTitle(const String& filename, const IntSize& size)
     result.append(String::number(size.width()));
     result.append(static_cast<UChar>(0xD7));  // U+00D7 (multiplication sign)
     result.append(String::number(size.height()));
-    result.append(")");
+    result.append(')');
     return result.toString();
 }
 
diff --git a/WebKit/chromium/src/WebEntities.cpp b/WebKit/chromium/src/WebEntities.cpp
index bfdd9f2..4e37dde 100644
--- a/WebKit/chromium/src/WebEntities.cpp
+++ b/WebKit/chromium/src/WebEntities.cpp
@@ -31,15 +31,12 @@
 #include "config.h"
 #include "WebEntities.h"
 
-#include <string.h>
-
-#include "PlatformString.h"
-#include "StringBuilder.h"
-#include <wtf/HashMap.h>
-
 #include "WebString.h"
 
-using namespace WebCore;
+#include <string.h>
+#include <wtf/HashMap.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebKit {
 
@@ -76,9 +73,9 @@ String WebEntities::convertEntitiesInString(const String& value) const
             // Append content before entity code.
             if (curPos > startPos)
                 result.append(String(startPos, curPos - startPos));
-            result.append("&");
+            result.append('&');
             result.append(m_entitiesMap.get(*curPos));
-            result.append(";");
+            result.append(';');
             startPos = ++curPos;
         } else
             curPos++;
diff --git a/WebKit/chromium/src/WebPageSerializerImpl.cpp b/WebKit/chromium/src/WebPageSerializerImpl.cpp
index 885ee25..dd6f858 100644
--- a/WebKit/chromium/src/WebPageSerializerImpl.cpp
+++ b/WebKit/chromium/src/WebPageSerializerImpl.cpp
@@ -88,8 +88,6 @@
 #include "HTMLMetaElement.h"
 #include "HTMLNames.h"
 #include "KURL.h"
-#include "PlatformString.h"
-#include "StringBuilder.h"
 #include "TextEncoding.h"
 #include "markup.h"
 
@@ -280,11 +278,11 @@ void WebPageSerializerImpl::encodeAndFlushBuffer(
     bool force)
 {
     // Data buffer is not full nor do we want to force flush.
-    if (!force && m_dataBuffer.length() <= dataBufferCapacity)
+    if (!force && m_dataBuffer.size() <= dataBufferCapacity)
         return;
 
     String content = m_dataBuffer.toString();
-    m_dataBuffer.clear();
+    m_dataBuffer = StringBuilder();
 
     // Convert the unicode content to target encoding
     CString encodedContent = param->textEncoding.encode(
diff --git a/WebKit/chromium/src/WebPageSerializerImpl.h b/WebKit/chromium/src/WebPageSerializerImpl.h
index a7f2fb4..3c66e3a 100644
--- a/WebKit/chromium/src/WebPageSerializerImpl.h
+++ b/WebKit/chromium/src/WebPageSerializerImpl.h
@@ -31,12 +31,12 @@
 #ifndef WebPageSerializerImpl_h
 #define WebPageSerializerImpl_h
 
-#include "PlatformString.h"
 #include <wtf/Forward.h>
 #include <wtf/HashMap.h>
 #include <wtf/Vector.h>
+#include <wtf/text/StringBuilder.h>
 #include <wtf/text/StringHash.h>
-#include "StringBuilder.h"
+#include <wtf/text/WTFString.h>
 
 #include "WebEntities.h"
 #include "WebPageSerializer.h"
@@ -98,7 +98,7 @@ private:
     // original link.
     LinkLocalPathMap m_localLinks;
     // Data buffer for saving result of serialized DOM data.
-    WebCore::StringBuilder m_dataBuffer;
+    StringBuilder m_dataBuffer;
     // Passing true to recursive_serialization_ indicates we will serialize not
     // only the specified frame but also all sub-frames in the specific frame.
     // Otherwise we only serialize the specified frame excluded all sub-frames.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list