Replace String::replace() functions with makeStringByReplacingAll() free functions
https://bugs.webkit.org/show_bug.cgi?id=239685
Reviewed by Darin Adler.
Replace String::replace() functions with makeStringByReplacingAll() free functions.
"All" is added to the name since every instance is replaced, not just the first one.
Making it a free function that returns a new String is a step towards making String
immutable.
In the future, we may want to add a makeStringByReplacingAll() that takes in a
StringView instead of a const String . Some call sites would benefit from that.
- Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
(TestWebKitAPI::TEST):
- Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp:
(TestWebKitAPI::TEST):
- Tools/TestWebKitAPI/Tests/WebKit/OverrideAppleLanguagesPreference.mm:
(AppleLanguagesTest::AppleLanguagesTest):
- Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp:
(WTR::AccessibilityUIElement::stringValue):
(WTR::AccessibilityUIElement::attributedStringForRange):
- Source/JavaScriptCore/inspector/agents/InspectorAuditAgent.cpp:
(Inspector::InspectorAuditAgent::run):
- Source/JavaScriptCore/jit/ExecutableAllocator.cpp:
(JSC::dumpJITMemory):
- Source/JavaScriptCore/runtime/TypeProfiler.cpp:
(JSC::TypeProfiler::logTypesForTypeLocation):
- Source/JavaScriptCore/runtime/TypeSet.cpp:
(JSC::StructureShape::propertyHash):
- Source/JavaScriptCore/yarr/RegularExpression.cpp:
(JSC::Yarr::replace):
- Source/WebCore/PAL/pal/text/TextCodecICU.cpp:
(PAL::TextCodecICU::encode const):
- Source/WebKit/NetworkProcess/DatabaseUtilities.cpp:
(WebKit::DatabaseUtilities::stripIndexQueryToMatchStoredValue):
- Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::escapeForJSON):
- Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:
(webkit_web_context_set_preferred_languages):
- Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::insertText):
- Source/WebKit/WebProcess/WebCoreSupport/WebContextMenuClient.cpp:
(WebKit::WebContextMenuClient::searchWithGoogle):
- Source/WebKit/WebProcess/WebCoreSupport/WebResourceLoadObserver.cpp:
(WebKit::WebResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
- Source/WebKitLegacy/mac/WebView/WebHTMLRepresentation.mm:
(matchLabelsAgainstString):
- Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:
(-[WebHTMLView insertText:]):
- Source/WebKitLegacy/win/DOMHTMLClasses.cpp:
(DOMHTMLInputElement::replaceCharactersInRange):
- Source/WebKitLegacy/win/WebCoreSupport/WebContextMenuClient.cpp:
(WebContextMenuClient::searchWithGoogle):
- Source/WebKitLegacy/win/WebLocalizableStrings.cpp:
(LocalizedString::operator LPCTSTR const):
- Source/WTF/wtf/Language.cpp:
(WTF::canonicalLanguageIdentifier):
- Source/WTF/wtf/URLHelpers.cpp:
(WTF::URLHelpers::mapHostNames):
- Source/WTF/wtf/URLParser.cpp:
(WTF::URLParser::parseURLEncodedForm):
- Source/WTF/wtf/text/StringView.h:
(WTF::makeStringByReplacingAll):
(WTF::makeStringByReplacing):
(WTF::String::replace): Deleted.
- Source/WTF/wtf/text/WTFString.h:
(WTF::makeStringByReplacingAll):
(WTF::String::replace): Deleted.
- Source/WTF/wtf/unix/LanguageUnix.cpp:
(WTF::platformLanguage):
- Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::encodeDatabaseName):
(WebCore::IDBServer::SQLiteIDBBackingStore::decodeDatabaseName):
- Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp:
(WebCore::GStreamerMediaEndpoint::setConfiguration):
- Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::queryKeysAndValues):
- Source/WebCore/accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineDropEffects const):
- Source/WebCore/accessibility/atspi/AccessibilityAtspi.cpp:
(WebCore::AccessibilityAtspi::registerRoot):
(WebCore::AccessibilityAtspi::registerObject):
(WebCore::AccessibilityAtspi::registerHyperlink):
- Source/WebCore/contentextensions/ContentExtensionActions.cpp:
(WebCore::ContentExtensions::RedirectAction::RegexSubstitutionAction::applyToURL const):
- Source/WebCore/contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::getDomainList):
- Source/WebCore/css/parser/CSSTokenizer.cpp:
(WebCore::CSSTokenizer::preprocessString):
- Source/WebCore/display/css/DisplayTextBox.cpp:
(WebCore::Display::TextBox::debugDescription const):
- Source/WebCore/dom/Document.cpp:
(WebCore::Document::displayStringModifiedByEncoding const):
- Source/WebCore/dom/Node.cpp:
(WebCore::Node::showNode const):
- Source/WebCore/dom/Text.cpp:
(WebCore::appendTextRepresentation):
- Source/WebCore/dom/ViewportArguments.cpp:
(WebCore::viewportErrorMessage):
- Source/WebCore/editing/EditingStyle.cpp:
(WebCore::StyleChange::extractTextStyles):
- Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::selectedText const):
- Source/WebCore/editing/FrameSelection.cpp:
(WebCore::FrameSelection::debugRenderer const):
- Source/WebCore/editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendQuotedURLAttributeValue):
- Source/WebCore/editing/TextIterator.cpp:
(WebCore::foldQuoteMarks):
- Source/WebCore/editing/VisibleUnits.cpp:
(WebCore::charactersAroundPosition):
- Source/WebCore/editing/cocoa/EditorCocoa.mm:
(WebCore::Editor::stringSelectionForPasteboard):
(WebCore::Editor::stringSelectionForPasteboardWithImageAltText):
- Source/WebCore/editing/cocoa/HTMLConverter.mm:
(WebCore::editingAttributedString):
- Source/WebCore/editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::takeResults):
(WebCore::createFragmentFromText):
- Source/WebCore/html/HTMLElement.cpp:
(WebCore::HTMLElement::setInnerText):
- Source/WebCore/html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::setValueCommon):
- Source/WebCore/html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setRangeText):
- Source/WebCore/html/LinkRelAttribute.cpp:
(WebCore::LinkRelAttribute::LinkRelAttribute):
- Source/WebCore/html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::handleBeforeTextInsertedEvent):
- Source/WebCore/html/URLDecomposition.cpp:
(WebCore::URLDecomposition::setSearch):
- Source/WebCore/inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::setRuleSelector):
(WebCore::InspectorStyleSheet::styleSheetTextWithChangedStyle):
- Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::outputLayoutBox):
- Source/WebCore/loader/FormSubmission.cpp:
(WebCore::appendMailtoPostFormDataToURL):
(WebCore::encodingFromAcceptCharset):
- Source/WebCore/page/Frame.cpp:
(WebCore::matchLabelsAgainstString):
- Source/WebCore/platform/LocalizedStrings.cpp:
(WebCore::contextMenuItemTagLookUpInDictionary):
(WebCore::imageTitle):
(WebCore::webCryptoMasterKeyKeychainLabel):
- Source/WebCore/platform/graphics/avfoundation/objc/AVStreamDataParserMIMETypeCache.mm:
(WebCore::AVStreamDataParserMIMETypeCache::canDecodeExtendedType):
- Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::configureDownloadBuffer):
- Source/WebCore/platform/graphics/gstreamer/mse/AppendPipeline.cpp:
(WebCore::AppendPipeline::AppendPipeline):
(WebCore::AppendPipeline::handleStateChangeMessage):
- Source/WebCore/platform/gtk/SelectionData.cpp:
(WebCore::replaceNonBreakingSpaceWithSpace):
- Source/WebCore/platform/mediastream/gstreamer/GStreamerDisplayCaptureDeviceManager.cpp:
(WebCore::GStreamerDisplayCaptureDeviceManager::createDisplayCaptureSource):
- Source/WebCore/platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::sanitizeSuggestedFilename):
- Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::createSoupURI const):
- Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp:
(WebCore::sanitizeFilename):
- Source/WebCore/platform/text/DateTimeFormat.cpp:
(WebCore::DateTimeFormat::quoteAndAppendLiteral):
- Source/WebCore/platform/text/LocaleToScriptMapping.cpp:
(WebCore::localeToScriptCodeForFontSelection):
- Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp:
(WebCore::scanDirectoryForDictionaries):
- Source/WebCore/platform/text/win/LocaleWin.cpp:
(WebCore::LocaleWin::shortMonthFormat):
- Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp:
(WebCore::replaceNBSPWithSpace):
- Source/WebCore/rendering/LegacyInlineTextBox.cpp:
(WebCore::LegacyInlineTextBox::outputLineBox const):
- Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::updateSecurityDiscCharacters):
- Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::outputRenderObject const):
- Source/WebCore/rendering/RenderText.cpp:
(WebCore::RenderText::setRenderedText):
- Source/WebCore/rendering/svg/RenderSVGInlineText.cpp:
(WebCore::applySVGWhitespaceRules):
- Source/WebCore/xml/XSLTProcessor.cpp:
(WebCore::transformTextStringToXHTMLDocumentString):
Canonical link: https://commits.webkit.org/249949@main
|