Add replaceWithLiteral() method to WTF::String
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2012 09:43:05 +0000 (09:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2012 09:43:05 +0000 (09:43 +0000)
commit64b7265e0ed182b2fce6c6b977e3e7b32aab7497
tree9f51ed4f4f356f9344d088c8ccd8fb7e2d1a4c10
parentadd814986a76042972a4d3384b06e0121019bdf9
Add replaceWithLiteral() method to WTF::String
https://bugs.webkit.org/show_bug.cgi?id=101257

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-11-07
Reviewed by Benjamin Poulain.

Source/WebCore:

Substitute String::replace() calls by String::replaceWithLiteral() where
adequate, for efficiency.

No new tests, no behavior change.

* dom/Node.cpp:
(WebCore::Node::showNode):
* editing/EditingStyle.cpp:
(WebCore::StyleChange::extractTextStyles):
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendQuotedURLAttributeValue):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::setSearch):
* loader/FormSubmission.cpp:
(WebCore::appendMailtoPostFormDataToURL):
* platform/network/soup/ProxyResolverSoup.cpp:
(soupProxyResolverWkSetProperty):
* plugins/PluginView.cpp:
(WebCore::makeURL):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::showBox):
* xml/XSLTProcessor.cpp:
(WebCore::transformTextStringToXHTMLDocumentString):

Source/WebKit/blackberry:

Substitute String::replace() calls by String::replaceWithLiteral() where
adequate, for efficiency.

* WebCoreSupport/SelectPopupClient.cpp:
(WebCore::SelectPopupClient::generateHTML):

Source/WebKit2:

Substitute String::replace() calls by String::replaceWithLiteral() where
adequate, for efficiency.

* WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp:
(WebKit::makeURLString):

Source/WTF:

Add replaceWithLiteral() method to WTF::String that takes
replacement string as a literal to avoid uselessly constructing
a String object.

* wtf/text/StringImpl.cpp:
(WTF::StringImpl::replace):
(WTF):
* wtf/text/StringImpl.h:
(WTF::StringImpl::replace):
(StringImpl):
* wtf/text/WTFString.h:
(String):
(WTF::String::replaceWithLiteral):

Tools:

Add API tests for String::replaceWithLiteral() and corresponding
StringImpl methods.

* TestWebKitAPI/CMakeLists.txt: Add WTFString API tests to CMake.
* TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::TEST):
(TestWebKitAPI):
* TestWebKitAPI/Tests/WTF/WTFString.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@133731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/text/StringImpl.cpp
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/WTFString.h
Source/WebCore/ChangeLog
Source/WebCore/dom/Node.cpp
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/MarkupAccumulator.cpp
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/loader/FormSubmission.cpp
Source/WebCore/platform/network/soup/ProxyResolverSoup.cpp
Source/WebCore/plugins/PluginView.cpp
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/xml/XSLTProcessor.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapeBrowserFuncs.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/CMakeLists.txt
Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp
Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp