Skip to content
  • commit-queue@webkit.org's avatar
    Add replaceWithLiteral() method to WTF::String · bf6f7fa0
    commit-queue@webkit.org authored
    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: http://svn.webkit.org/repository/webkit/trunk@133731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    bf6f7fa0