2010-10-12 Nikolas Zimmermann <nzimmermann@rim.com>
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Oct 2010 19:47:24 +0000 (19:47 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Oct 2010 19:47:24 +0000 (19:47 +0000)
        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@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@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: https://svn.webkit.org/repository/webkit/trunk@69594 268f45cc-cd09-0410-ab3c-d52691b4dbfc

56 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/GNUmakefile.am
JavaScriptCore/JavaScriptCore.gypi
JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/runtime/Executable.cpp
JavaScriptCore/runtime/FunctionConstructor.cpp
JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
JavaScriptCore/runtime/JSONObject.cpp
JavaScriptCore/runtime/LiteralParser.cpp
JavaScriptCore/runtime/NumberPrototype.cpp
JavaScriptCore/runtime/UStringBuilder.h [new file with mode: 0644]
JavaScriptCore/wtf/text/StringBuilder.h [moved from JavaScriptCore/runtime/StringBuilder.h with 65% similarity]
WebCore/Android.mk
WebCore/CMakeLists.txt
WebCore/ChangeLog
WebCore/ForwardingHeaders/runtime/UStringBuilder.h [new file with mode: 0644]
WebCore/ForwardingHeaders/wtf/text/StringBuilder.h [moved from WebCore/ForwardingHeaders/runtime/StringBuilder.h with 100% similarity]
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.order
WebCore/WebCore.pro
WebCore/WebCore.vcproj/WebCore.vcproj
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/ScriptString.h
WebCore/bridge/jni/JNIBridge.cpp
WebCore/css/MediaQuery.cpp
WebCore/css/MediaQueryExp.cpp
WebCore/dom/Node.cpp
WebCore/dom/Node.h
WebCore/html/DOMTokenList.cpp
WebCore/inspector/InspectorResource.cpp
WebCore/platform/android/FileSystemAndroid.cpp
WebCore/platform/brew/FileSystemBrew.cpp
WebCore/platform/chromium/ClipboardChromium.cpp
WebCore/platform/graphics/gpu/PODInterval.h
WebCore/platform/graphics/gpu/PODRedBlackTree.h
WebCore/platform/graphics/mac/GraphicsLayerCA.mm
WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp
WebCore/platform/network/ProxyServer.cpp
WebCore/platform/text/StringBuffer.h [deleted file]
WebCore/platform/text/StringBuilder.cpp [deleted file]
WebCore/platform/text/StringBuilder.h [deleted file]
WebCore/plugins/DOMMimeType.cpp
WebCore/svg/SVGPathParserFactory.cpp
WebCore/svg/SVGPathStringBuilder.cpp
WebCore/svg/SVGPathStringBuilder.h
WebCore/websockets/WebSocket.cpp
WebCore/websockets/WebSocketHandshake.cpp
WebKit/chromium/ChangeLog
WebKit/chromium/src/LocalizedStrings.cpp
WebKit/chromium/src/WebEntities.cpp
WebKit/chromium/src/WebPageSerializerImpl.cpp
WebKit/chromium/src/WebPageSerializerImpl.h

index f81cb47..8729486 100644 (file)
@@ -1,3 +1,49 @@
+2010-10-12  Nikolas Zimmermann  <nzimmermann@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@apple.com>
 
         Reviewed by Oliver Hunt.
index 7d637b3..ad952d0 100644 (file)
@@ -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 \
index 462960d..97dc952 100644 (file)
             'runtime/Tracing.h',
             'runtime/UString.cpp',
             'runtime/UString.h',
+            'runtime/UStringBuilder.h',
             'runtime/WeakRandom.h',
             'wtf/AlwaysInline.h',
             'wtf/ASCIICType.h',
             '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',
index 479b3dd..38dafab 100644 (file)
                                >\r
                        </File>\r
                        <File\r
+                               RelativePath="..\..\runtime\UStringBuilder.h"\r
+                               >\r
+                       </File>\r
+                       <File\r
                                RelativePath="..\..\runtime\UStringImpl.h"\r
                                >\r
                        </File>\r
index 42a91eb..afc02d8 100644 (file)
                        >\r
                </File>\r
                <File\r
+                       RelativePath="..\..\wtf\text\StringBuffer.h"\r
+                       >\r
+               </File>\r
+               <File\r
+                       RelativePath="..\..\wtf\text\StringBuilder.h"\r
+                       >\r
+               </File>\r
+               <File\r
                        RelativePath="..\..\wtf\text\StringHash.h"\r
                        >\r
                </File>\r
index a45f982..16e1459 100644 (file)
 /* 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, ); }; };
                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 */; };
                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>"; };
                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>"; };
                                7E2C6C980D31C6B6002D44E2 /* ScopeChainMark.h */,
                                93303FE80E6A72B500786E6A /* SmallStrings.cpp */,
                                93303FEA0E6A72C000786E6A /* SmallStrings.h */,
-                               8698B86810D44D9400D8D01B /* StringBuilder.h */,
                                86B6DA0112132B9A000D316F /* StringConcatenate.h */,
                                BC18C3C00E16EE3300B34460 /* StringConstructor.cpp */,
                                BC18C3C10E16EE3300B34460 /* StringConstructor.h */,
                                5D53726E0E1C54880021E549 /* Tracing.h */,
                                F692A8850255597D01FF60F7 /* UString.cpp */,
                                F692A8860255597D01FF60F7 /* UString.h */,
+                               08DDA5BB12645F1D00751732 /* UStringBuilder.h */,
                                14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */,
                                14035DB010DBFB2A00FFFFE7 /* WeakGCPtr.h */,
                                1420BE7A10AA6DDB00F455D2 /* WeakRandom.h */,
                                86565740115BE3DA00291F40 /* CString.cpp */,
                                86565741115BE3DA00291F40 /* CString.h */,
                                86B99AE1117E578100DF5A90 /* StringBuffer.h */,
+                               081469481264375E00DFF935 /* StringBuilder.h */,
                                868BFA05117CEFD100B908B1 /* StringHash.h */,
                                868BFA06117CEFD100B908B1 /* StringImpl.cpp */,
                                868BFA07117CEFD100B908B1 /* StringImpl.h */,
                                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 */,
                                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 */,
index 56e509a..733768e 100644 (file)
@@ -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*)
index f72a273..617992f 100644 (file)
@@ -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();
index cd89dd2..ed06fa5 100644 (file)
@@ -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
index ba50721..8ee7165 100644 (file)
@@ -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);
 
index cc33bae..f1df15f 100644 (file)
@@ -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;
index e18553b..df8ac4c 100644 (file)
 #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/UStringBuilder.h b/JavaScriptCore/runtime/UStringBuilder.h
new file mode 100644 (file)
index 0000000..870c221
--- /dev/null
@@ -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
similarity index 65%
rename from JavaScriptCore/runtime/StringBuilder.h
rename to JavaScriptCore/wtf/text/StringBuilder.h
index 27aa57f..f938911 100644 (file)
 #define StringBuilder_h
 
 #include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
 
-namespace JSC {
+namespace WTF {
 
 class StringBuilder {
 public:
     void append(const UChar u)
     {
-        buffer.append(u);
+        m_buffer.append(u);
     }
 
     void append(const char* str)
@@ -44,44 +45,46 @@ public:
 
     void append(const char* str, size_t len)
     {
-        reserveCapacity(buffer.size() + len);
+        reserveCapacity(m_buffer.size() + len);
         for (size_t i = 0; i < len; i++)
-            buffer.append(static_cast<unsigned char>(str[i]));
+            m_buffer.append(static_cast<unsigned char>(str[i]));
     }
 
     void append(const UChar* str, size_t len)
     {
-        buffer.append(str, len);
+        m_buffer.append(str, len);
     }
 
-    void append(const UString& str)
+    void append(const String& str)
     {
-        buffer.append(str.characters(), str.length());
+        m_buffer.append(str.characters(), str.length());
     }
 
-    bool isEmpty() { return buffer.isEmpty(); }
+    bool isEmpty() const { return m_buffer.isEmpty(); }
     void reserveCapacity(size_t newCapacity)
     {
-        if (newCapacity < buffer.capacity())
+        if (newCapacity < m_buffer.capacity())
             return;
-        buffer.reserveCapacity(std::max(newCapacity, buffer.capacity() + buffer.capacity() / 4 + 1));
+        m_buffer.reserveCapacity(std::max(newCapacity, m_buffer.capacity() + m_buffer.capacity() / 4 + 1));
     }
-    void resize(size_t size) { buffer.resize(size); }
-    size_t size() const { return buffer.size(); }
+    void resize(size_t size) { m_buffer.resize(size); }
+    size_t size() const { return m_buffer.size(); }
 
-    UChar operator[](size_t i) const { return buffer.at(i); }
+    UChar operator[](size_t i) const { return m_buffer.at(i); }
 
-    UString build()
+    String toString()
     {
-        buffer.shrinkToFit();
-        ASSERT(buffer.data() || !buffer.size());
-        return UString::adopt(buffer);
+        m_buffer.shrinkToFit();
+        ASSERT(m_buffer.data() || !m_buffer.size());
+        return String::adopt(m_buffer);
     }
 
 protected:
-    Vector<UChar, 64> buffer;
+    Vector<UChar, 64> m_buffer;
 };
 
-}
+} // namespace WTF
 
-#endif
+using WTF::StringBuilder;
+
+#endif // StringBuilder_h
index 7af2148..f14d0e1 100644 (file)
@@ -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 \
index 5331eae..1a5bc33 100644 (file)
@@ -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
index ebfafe4..c214b99 100644 (file)
@@ -1,3 +1,74 @@
+2010-10-12  Nikolas Zimmermann  <nzimmermann@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@samsung.com>
 
         Reviewed by Antonio Gomes.
diff --git a/WebCore/ForwardingHeaders/runtime/UStringBuilder.h b/WebCore/ForwardingHeaders/runtime/UStringBuilder.h
new file mode 100644 (file)
index 0000000..592a783
--- /dev/null
@@ -0,0 +1,4 @@
+#ifndef WebCore_FWD_UStringBuilder_h
+#define WebCore_FWD_UStringBuilder_h
+#include <JavaScriptCore/UStringBuilder.h>
+#endif
index c629a7c..dc6e548 100644 (file)
@@ -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 \
index 2b406a3..25f9d7a 100644 (file)
             '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',
index 7eb980c..06dfb3d 100644 (file)
@@ -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
index 9b1c534..eee56ee 100644 (file)
@@ -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 \
index 17ae90a..7af2d7f 100644 (file)
                                        >\r
                                </File>\r
                                <File\r
-                                       RelativePath="..\platform\text\StringBuffer.h"\r
-                                       >\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="..\platform\text\StringBuilder.cpp"\r
-                                       >\r
-                               </File>\r
-                               <File\r
-                                       RelativePath="..\platform\text\StringBuilder.h"\r
-                                       >\r
-                               </File>\r
-                               <File\r
                                        RelativePath="..\platform\text\StringHash.h"\r
                                        >\r
                                </File>\r
index fea9e0e..1e479f4 100644 (file)
                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 */; };
                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 */; };
                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>"; };
                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>"; };
                                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 */,
                                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 */,
                                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 */,
index 7401818..98dab6b 100644 (file)
 #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;
     }
 
index 8fa2678..c512ee7 100644 (file)
 
 #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(';');
             }
         }
 
index 77a79ad..c476a21 100644 (file)
@@ -30,8 +30,8 @@
 #include "MediaQuery.h"
 
 #include "MediaQueryExp.h"
-#include "StringBuilder.h"
 #include <wtf/NonCopyingSort.h>
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
index 36a155e..e970400 100644 (file)
@@ -32,7 +32,7 @@
 #include "CSSParser.h"
 #include "CSSPrimitiveValue.h"
 #include "CSSValueList.h"
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
index ab9dc02..873a2f3 100644 (file)
@@ -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)
index b358094..33a222b 100644 (file)
@@ -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;
index 3383447..aa0a74b 100644 (file)
@@ -29,7 +29,7 @@
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
 #include "SpaceSplitString.h"
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
index 570a4fb..ffe1f71 100644 (file)
 #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 {
 
index 3d841d7..6725d92 100644 (file)
@@ -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 {
 
index 2411c3b..e207b55 100644 (file)
@@ -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 {
 
index effbc4a..46b4339 100644 (file)
 #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("/>");
index 12a4420..5c1dcc2 100644 (file)
@@ -27,7 +27,7 @@
 #define PODInterval_h
 
 #ifndef NDEBUG
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
 #endif
 
 namespace WebCore {
index 7898628..6d5954c 100644 (file)
@@ -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 {
index 76d6a3b..4e77e13 100644 (file)
@@ -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"
index 354e0bf..d2c258e 100644 (file)
@@ -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()) {
index c37f5d5..39e8a11 100644 (file)
@@ -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()) {
index ef08d6c..7ef283b 100644 (file)
 #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(StringBuilderbuilder, 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 (file)
index 3a753b4..0000000
+++ /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 (file)
index 32f0b53..0000000
+++ /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 (file)
index dd8c1c0..0000000
+++ /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
index e1fa7f1..e799314 100644 (file)
@@ -25,7 +25,7 @@
 #include "Page.h"
 #include "PluginData.h"
 #include "Settings.h"
-#include "StringBuilder.h"
+#include <wtf/text/StringBuilder.h>
 
 namespace WebCore {
 
index b251ec4..e707c20 100644 (file)
@@ -33,7 +33,6 @@
 #include "SVGPathStringBuilder.h"
 #include "SVGPathStringSource.h"
 #include "SVGPathTraversalStateBuilder.h"
-#include "StringBuilder.h"
 
 namespace WebCore {
 
index 951956d..418e367 100644 (file)
 
 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
index a51c40c..6a7e980 100644 (file)
 #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; }
 
index 073a924..eb4b567 100644 (file)
 #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 {
 
index effbb67..45e47a8 100644 (file)
@@ -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();
index a3927b5..8b2deef 100644 (file)
@@ -1,3 +1,18 @@
+2010-10-12  Nikolas Zimmermann  <nzimmermann@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@chromium.org>
 
         Reviewed by James Robinson.
index 3354c30..ecc53e4 100644 (file)
 
 #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();
 }
 
index bfdd9f2..4e37dde 100644 (file)
 #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++;
index 885ee25..dd6f858 100644 (file)
@@ -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(
index a7f2fb4..3c66e3a 100644 (file)
 #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.