Skip to content
  • benjamin@webkit.org's avatar
    Add String::startsWith() and endsWith() for string literals · 127cec2c
    benjamin@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=85154
    
    Reviewed by Darin Adler.
    
    Source/WebCore: 
    
    Update WebCore to use the simpler startsWith() and endsWith() taking
    a UChar.
    
    * css/CSSParser.cpp:
    (WebCore::CSSParser::markPropertyEnd):
    * css/WebKitCSSKeyframeRule.cpp:
    (WebCore::StyleKeyframe::parseKeyString):
    * editing/markup.cpp:
    (WebCore::createFragmentFromText):
    * html/HTMLObjectElement.cpp:
    (WebCore::HTMLObjectElement::addSubresourceAttributeURLs):
    * html/HTMLTextFormControlElement.cpp:
    (WebCore::HTMLTextFormControlElement::setInnerTextValue):
    * inspector/ContentSearchUtils.cpp:
    (WebCore::ContentSearchUtils::getRegularExpressionMatchesByLines):
    * inspector/InspectorCSSAgent.cpp:
    (WebCore::InspectorCSSAgent::SetPropertyTextAction::redo):
    * loader/MainResourceLoader.cpp:
    (WebCore::MainResourceLoader::substituteMIMETypeFromPluginDatabase):
    * loader/appcache/ManifestParser.cpp:
    (WebCore::parseManifest):
    * platform/blackberry/CookieManager.cpp:
    (WebCore::CookieManager::shouldRejectForSecurityReason):
    * platform/posix/FileSystemPOSIX.cpp:
    (WebCore::pathByAppendingComponent):
    * plugins/PluginDatabase.cpp:
    (WebCore::PluginDatabase::findPlugin):
    * svg/SVGStopElement.cpp:
    (WebCore::SVGStopElement::parseAttribute):
    * svg/animation/SVGSMILElement.cpp:
    (WebCore::SVGSMILElement::parseOffsetValue):
    (WebCore::SVGSMILElement::parseCondition):
    
    Source/WebKit/blackberry: 
    
    * WebKitSupport/DOMSupport.cpp:
    (BlackBerry::WebKit::DOMSupport::elementPatternMatches):
    
    Source/WebKit2: 
    
    Update WebKit2 to use String::endsWith(UChar).
    
    * UIProcess/Plugins/PluginInfoStore.cpp:
    (WebKit::pathExtension):
    
    Source/WTF: 
    
    When invoking StringImpl::startsWidth() or StringImpl::endsWith() with
    a string literal, a new String was constructed implicitly, allocating
    a new StringImpl and copying the characters for the operation.
    
    This patch adds a version of those methods for single characters and
    string literals.
    This allows us to avoid allocating memory and use the characters in place,
    and it permits some extra shortcuts in the implementation.
    
    * wtf/text/AtomicString.h:
    (WTF::AtomicString::startsWith):
    (AtomicString):
    (WTF::AtomicString::endsWith):
    * wtf/text/StringImpl.cpp:
    (WTF::equalInner):
    (WTF):
    (WTF::StringImpl::startsWith):
    (WTF::StringImpl::endsWith):
    * wtf/text/StringImpl.h:
    (WTF::StringImpl::startsWith):
    (StringImpl):
    (WTF::StringImpl::endsWith):
    * wtf/text/WTFString.h:
    (WTF::String::startsWith):
    (String):
    (WTF::String::endsWith):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@115669 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    127cec2c