⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278669 in webkit


Ignore:
Timestamp:
Jun 9, 2021, 1:46:24 PM (5 years ago)
Author:
Chris Dumez
Message:

Avoid some calls to StringView::toString() / StringView::toStringWithoutCopying()
https://bugs.webkit.org/show_bug.cgi?id=226803

Reviewed by Darin Adler.

Source/WebCore:

  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeFontVariationTag):

  • page/FrameView.cpp:

(WebCore::FrameView::scrollToFragmentInternal):

  • platform/text/hyphen/HyphenationLibHyphen.cpp:

(WebCore::lastHyphenLocation):

  • rendering/RenderTreeAsText.cpp:

(WebCore::writeDebugInfo):

Source/WTF:

Add support to TextStream for printing a StringView directly, without having to convert
it to a String first.

  • wtf/text/TextStream.cpp:

(WTF::TextStream::operator<<):

  • wtf/text/TextStream.h:
Location:
trunk/Source
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r278655 r278669  
     12021-06-09  Chris Dumez  <cdumez@apple.com>
     2
     3        Avoid some calls to StringView::toString() / StringView::toStringWithoutCopying()
     4        https://bugs.webkit.org/show_bug.cgi?id=226803
     5
     6        Reviewed by Darin Adler.
     7
     8        Add support to TextStream for printing a StringView directly, without having to convert
     9        it to a String first.
     10
     11        * wtf/text/TextStream.cpp:
     12        (WTF::TextStream::operator<<):
     13        * wtf/text/TextStream.h:
     14
    1152021-06-09  Alicia Boya García  <aboya@igalia.com>
    216
  • trunk/Source/WTF/wtf/URL.cpp

    r278253 r278669  
    379379    // Firefox and IE remove everything after the first ':'.
    380380    auto newProtocolPrefix = newProtocol.substring(0, newProtocol.find(':'));
    381     auto newProtocolCanonicalized = URLParser::maybeCanonicalizeScheme(newProtocolPrefix.toStringWithoutCopying());
     381    auto newProtocolCanonicalized = URLParser::maybeCanonicalizeScheme(newProtocolPrefix);
    382382    if (!newProtocolCanonicalized)
    383383        return false;
     
    530530}
    531531
    532 static String percentEncodeCharacters(const String& input, bool(*shouldEncode)(UChar))
    533 {
    534     auto encode = [shouldEncode] (const String& input) {
     532template<typename StringType>
     533static String percentEncodeCharacters(const StringType& input, bool(*shouldEncode)(UChar))
     534{
     535    auto encode = [shouldEncode] (const StringType& input) {
    535536        CString utf8 = input.utf8();
    536537        auto* data = utf8.data();
     
    553554            return encode(input);
    554555    }
    555     return input;
     556    if constexpr (std::is_same_v<StringType, StringView>)
     557        return input.toString();
     558    else
     559        return input;
    556560}
    557561
     
    585589            StringView(m_string).left(m_userStart),
    586590            slashSlashNeeded ? "//" : "",
    587             percentEncodeCharacters(newUser.toStringWithoutCopying(), URLParser::isInUserInfoEncodeSet),
     591            percentEncodeCharacters(newUser, URLParser::isInUserInfoEncodeSet),
    588592            needSeparator ? "@" : "",
    589593            StringView(m_string).substring(end)
     
    607611            StringView(m_string).left(m_userEnd),
    608612            needLeadingSlashes ? "//:" : ":",
    609             percentEncodeCharacters(newPassword.toStringWithoutCopying(), URLParser::isInUserInfoEncodeSet),
     613            percentEncodeCharacters(newPassword, URLParser::isInUserInfoEncodeSet),
    610614            '@',
    611615            StringView(m_string).substring(credentialsEnd())
     
    671675        return character == '?' || character == '#' || !isASCII(character);
    672676    };
    673     return percentEncodeCharacters(path.toStringWithoutCopying(), questionMarkOrNumberSignOrNonASCII);
     677    return percentEncodeCharacters(path, questionMarkOrNumberSignOrNonASCII);
    674678}
    675679
  • trunk/Source/WTF/wtf/URLParser.cpp

    r278619 r278669  
    699699}
    700700
    701 std::optional<String> URLParser::maybeCanonicalizeScheme(const String& scheme)
     701std::optional<String> URLParser::maybeCanonicalizeScheme(StringView scheme)
    702702{
    703703    if (scheme.isEmpty())
  • trunk/Source/WTF/wtf/URLParser.h

    r278253 r278669  
    4747
    4848    WTF_EXPORT_PRIVATE static bool isSpecialScheme(const String& scheme);
    49     WTF_EXPORT_PRIVATE static std::optional<String> maybeCanonicalizeScheme(const String& scheme);
     49    WTF_EXPORT_PRIVATE static std::optional<String> maybeCanonicalizeScheme(StringView scheme);
    5050
    5151    static const UIDNA& internationalDomainNameTranscoder();
  • trunk/Source/WTF/wtf/text/StringView.cpp

    r278340 r278669  
    246246        return convertASCIICase<ASCIICase::Upper>(static_cast<const LChar*>(m_characters), m_length);
    247247    return convertASCIICase<ASCIICase::Upper>(static_cast<const UChar*>(m_characters), m_length);
     248}
     249
     250template<typename CharacterType>
     251static AtomString convertASCIILowercaseAtom(const CharacterType* input, unsigned length)
     252{
     253    for (unsigned i = 0; i < length; ++i) {
     254        if (UNLIKELY(isASCIIUpper(input[i]))) {
     255            CharacterType* characters;
     256            auto result = String::createUninitialized(length, characters);
     257            StringImpl::copyCharacters(characters, input, i);
     258            for (; i < length; ++i)
     259                characters[i] = toASCIILower(input[i]);
     260            return result;
     261        }
     262    }
     263    // Fast path when the StringView is already all lowercase.
     264    return AtomString(input, length);
     265}
     266
     267AtomString StringView::convertToASCIILowercaseAtom() const
     268{
     269    if (m_is8Bit)
     270        return convertASCIILowercaseAtom(characters8(), m_length);
     271    return convertASCIILowercaseAtom(characters16(), m_length);
    248272}
    249273
  • trunk/Source/WTF/wtf/text/StringView.h

    r278340 r278669  
    149149    WTF_EXPORT_PRIVATE String convertToASCIILowercase() const;
    150150    WTF_EXPORT_PRIVATE String convertToASCIIUppercase() const;
     151    WTF_EXPORT_PRIVATE AtomString convertToASCIILowercaseAtom() const;
    151152
    152153    bool contains(UChar) const;
  • trunk/Source/WTF/wtf/text/TextStream.cpp

    r277437 r278669  
    119119}
    120120
     121TextStream& TextStream::operator<<(const AtomString& string)
     122{
     123    m_text.append(string);
     124    return *this;
     125}
     126
    121127TextStream& TextStream::operator<<(const String& string)
     128{
     129    m_text.append(string);
     130    return *this;
     131}
     132
     133TextStream& TextStream::operator<<(StringView string)
    122134{
    123135    m_text.append(string);
  • trunk/Source/WTF/wtf/text/TextStream.h

    r278340 r278669  
    7171    WTF_EXPORT_PRIVATE TextStream& operator<<(const char*);
    7272    WTF_EXPORT_PRIVATE TextStream& operator<<(const void*);
     73    WTF_EXPORT_PRIVATE TextStream& operator<<(const AtomString&);
    7374    WTF_EXPORT_PRIVATE TextStream& operator<<(const String&);
     75    WTF_EXPORT_PRIVATE TextStream& operator<<(StringView);
    7476    // Deprecated. Use the NumberRespectingIntegers FormattingFlag instead.
    7577    WTF_EXPORT_PRIVATE TextStream& operator<<(const FormatNumberRespectingIntegers&);
  • trunk/Source/WebCore/ChangeLog

    r278667 r278669  
     12021-06-09  Chris Dumez  <cdumez@apple.com>
     2
     3        Avoid some calls to StringView::toString() / StringView::toStringWithoutCopying()
     4        https://bugs.webkit.org/show_bug.cgi?id=226803
     5
     6        Reviewed by Darin Adler.
     7
     8        * css/parser/CSSPropertyParser.cpp:
     9        (WebCore::consumeFontVariationTag):
     10        * page/FrameView.cpp:
     11        (WebCore::FrameView::scrollToFragmentInternal):
     12        * platform/text/hyphen/HyphenationLibHyphen.cpp:
     13        (WebCore::lastHyphenLocation):
     14        * rendering/RenderTreeAsText.cpp:
     15        (WebCore::writeDebugInfo):
     16
    1172021-06-09  Tyler Wilcock  <twilco.o@protonmail.com>
    218
  • trunk/Source/WebCore/Modules/cache/DOMCacheEngine.cpp

    r260707 r278669  
    100100            return;
    101101        }
    102         auto name = nameView.toString();
     102        auto name = nameView.toStringWithoutCopying();
    103103        isVarying = cachedRequest.httpHeaderField(name) != request.httpHeaderField(name);
    104104    });
  • trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp

    r278619 r278669  
    9999            && isValidHTTPToken(parameterName)
    100100            && parameterValue.isAllSpecialCharacters<isHTTPQuotedStringTokenCodePoint>()) {
    101             String nameString = parameterName.toString();
    102             if (!parameters.contains(nameString))
    103                 parameters.set(nameString, parameterValue.toString());
     101            parameters.ensure(parameterName.toString(), [&] { return parameterValue.toString(); });
    104102        }
    105103    }
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r278253 r278669  
    10051005        return nullptr;
    10061006
    1007     auto linkedNode = m_renderer->document().findAnchor(fragmentIdentifier.toStringWithoutCopying());
     1007    auto linkedNode = m_renderer->document().findAnchor(fragmentIdentifier);
    10081008    if (!linkedNode)
    10091009        return nullptr;
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r278540 r278669  
    537537        return nullptr;
    538538   
    539     auto string = range.consumeIncludingWhitespace().value().toString();
     539    auto string = range.consumeIncludingWhitespace().value();
    540540   
    541541    FontTag tag;
     
    23042304   
    23052305    CSSParserToken token = args.consumeIncludingWhitespace();
    2306     auto attrName = token.value().toAtomString();
     2306    AtomString attrName;
    23072307    if (context.isHTMLDocument)
    2308         attrName = attrName.convertToASCIILowercase();
     2308        attrName = token.value().convertToASCIILowercaseAtom();
     2309    else
     2310        attrName = token.value().toAtomString();
    23092311
    23102312    if (!args.atEnd())
     
    33303332}
    33313333
    3332 static Vector<String> parseGridTemplateAreasColumnNames(const String& gridRowNames)
     3334static Vector<String> parseGridTemplateAreasColumnNames(StringView gridRowNames)
    33333335{
    33343336    ASSERT(!gridRowNames.isEmpty());
    33353337    Vector<String> columnNames;
    3336     // Using StringImpl to avoid checks and indirection in every call to String::operator[].
    3337     StringImpl& text = *gridRowNames.impl();
    3338 
    33393338    StringBuilder areaName;
    3340     for (unsigned i = 0; i < text.length(); ++i) {
    3341         if (isCSSSpace(text[i])) {
     3339    for (auto character : gridRowNames.codeUnits()) {
     3340        if (isCSSSpace(character)) {
    33423341            if (!areaName.isEmpty()) {
    33433342                columnNames.append(areaName.toString());
     
    33463345            continue;
    33473346        }
    3348         if (text[i] == '.') {
     3347        if (character == '.') {
    33493348            if (areaName == ".")
    33503349                continue;
     
    33543353            }
    33553354        } else {
    3356             if (!isNameCodePoint(text[i]))
     3355            if (!isNameCodePoint(character))
    33573356                return Vector<String>();
    33583357            if (areaName == ".") {
     
    33623361        }
    33633362
    3364         areaName.append(text[i]);
     3363        areaName.append(character);
    33653364    }
    33663365
     
    33713370}
    33723371
    3373 static bool parseGridTemplateAreasRow(const String& gridRowNames, NamedGridAreaMap& gridAreaMap, const size_t rowCount, size_t& columnCount)
     3372static bool parseGridTemplateAreasRow(StringView gridRowNames, NamedGridAreaMap& gridAreaMap, const size_t rowCount, size_t& columnCount)
    33743373{
    33753374    if (gridRowNames.isAllSpecialCharacters<isCSSSpace>())
     
    35963595
    35973596    while (range.peek().type() == StringToken) {
    3598         if (!parseGridTemplateAreasRow(range.consumeIncludingWhitespace().value().toString(), gridAreaMap, rowCount, columnCount))
     3597        if (!parseGridTemplateAreasRow(range.consumeIncludingWhitespace().value(), gridAreaMap, rowCount, columnCount))
    35993598            return nullptr;
    36003599        ++rowCount;
     
    56125611
    56135612        // Handle a template-area's row.
    5614         if (m_range.peek().type() != StringToken || !parseGridTemplateAreasRow(m_range.consumeIncludingWhitespace().value().toString(), gridAreaMap, rowCount, columnCount))
     5613        if (m_range.peek().type() != StringToken || !parseGridTemplateAreasRow(m_range.consumeIncludingWhitespace().value(), gridAreaMap, rowCount, columnCount))
    56155614            return false;
    56165615        ++rowCount;
  • trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp

    r278540 r278669  
    24432443        if (!acceptQuirkyColors)
    24442444            return std::nullopt;
    2445         if (token.type() == IdentToken)
    2446             string = token.value().toString(); // e.g. FF0000
    2447         else if (token.type() == NumberToken || token.type() == DimensionToken) {
     2445        if (token.type() == IdentToken) {
     2446            view = token.value(); // e.g. FF0000
     2447            if (view.length() != 3 && view.length() != 6)
     2448                return std::nullopt;
     2449        } else if (token.type() == NumberToken || token.type() == DimensionToken) {
    24482450            if (token.numericValueType() != IntegerValueType)
    24492451                return std::nullopt;
     
    24582460            if (string.length() < 6)
    24592461                string = makeString(&"000000"[string.length()], string);
    2460         }
    2461         if (string.length() != 3 && string.length() != 6)
     2462
     2463            if (string.length() != 3 && string.length() != 6)
     2464                return std::nullopt;
     2465            view = string;
     2466        } else
    24622467            return std::nullopt;
    2463         view = string;
    24642468    }
    24652469    auto result = CSSParser::parseHexColor(view);
     
    35603564        return AtomString();
    35613565    auto name = nameToken.value();
    3562     return isPredefinedCounterStyle(nameToken.id()) ? name.convertToASCIILowercase() : name.toString();
     3566    return isPredefinedCounterStyle(nameToken.id()) ? name.convertToASCIILowercaseAtom() : name.toAtomString();
    35633567}
    35643568
  • trunk/Source/WebCore/dom/ScriptElement.cpp

    r278253 r278669  
    369369    const auto& contentSecurityPolicy = *m_element.document().contentSecurityPolicy();
    370370    bool hasKnownNonce = contentSecurityPolicy.allowScriptWithNonce(nonce, m_element.isInUserAgentShadowTree());
    371     if (!contentSecurityPolicy.allowInlineScript(m_element.document().url().string(), m_startLineNumber, sourceCode.source().toStringWithoutCopying(), hasKnownNonce))
     371    if (!contentSecurityPolicy.allowInlineScript(m_element.document().url().string(), m_startLineNumber, sourceCode.source(), hasKnownNonce))
    372372        return false;
    373373
     
    390390        const ContentSecurityPolicy& contentSecurityPolicy = *m_element.document().contentSecurityPolicy();
    391391        bool hasKnownNonce = contentSecurityPolicy.allowScriptWithNonce(m_element.attributeWithoutSynchronization(HTMLNames::nonceAttr), m_element.isInUserAgentShadowTree());
    392         if (!contentSecurityPolicy.allowInlineScript(m_element.document().url().string(), m_startLineNumber, sourceCode.source().toStringWithoutCopying(), hasKnownNonce))
     392        if (!contentSecurityPolicy.allowInlineScript(m_element.document().url().string(), m_startLineNumber, sourceCode.source(), hasKnownNonce))
    393393            return;
    394394    }
  • trunk/Source/WebCore/dom/StyledElement.cpp

    r278277 r278669  
    197197        startLineNumber = document().scriptableDocumentParser()->textPosition().m_line;
    198198
    199     if (reason == ModifiedByCloning || document().contentSecurityPolicy()->allowInlineStyle(document().url().string(), startLineNumber, String(), isInUserAgentShadowTree()))
     199    if (reason == ModifiedByCloning || document().contentSecurityPolicy()->allowInlineStyle(document().url().string(), startLineNumber, { }, isInUserAgentShadowTree()))
    200200        setInlineStyleFromString(newStyleString);
    201201
  • trunk/Source/WebCore/dom/TreeScope.cpp

    r278253 r278669  
    444444// FIXME: Would be nice to change this to take a StringView, since that's what callers have
    445445// and there is no particular advantage to already having a String.
    446 Element* TreeScope::findAnchor(const String& name)
     446Element* TreeScope::findAnchor(StringView name)
    447447{
    448448    if (name.isEmpty())
  • trunk/Source/WebCore/dom/TreeScope.h

    r261028 r278669  
    105105    // Anchor name matching is case sensitive in strict mode and not case sensitive in
    106106    // quirks mode for historical compatibility reasons.
    107     Element* findAnchor(const String& name);
     107    Element* findAnchor(StringView name);
    108108
    109109    ContainerNode& rootNode() const { return m_rootNode; }
  • trunk/Source/WebCore/editing/cocoa/DataDetection.mm

    r278575 r278669  
    169169bool DataDetection::canBePresentedByDataDetectors(const URL& url)
    170170{
    171     return [PAL::softLink_DataDetectorsCore_DDURLTapAndHoldSchemes() containsObject:(NSString *)url.protocol().toStringWithoutCopying().convertToASCIILowercase()];
     171    return [PAL::softLink_DataDetectorsCore_DDURLTapAndHoldSchemes() containsObject:(NSString *)url.protocol().convertToASCIILowercase()];
    172172}
    173173
  • trunk/Source/WebCore/page/FrameView.cpp

    r278484 r278669  
    22102210{
    22112211    auto fragmentIdentifier = url.fragmentIdentifier();
    2212     if (scrollToFragmentInternal(fragmentIdentifier.toString()))
     2212    if (scrollToFragmentInternal(fragmentIdentifier))
    22132213        return true;
    22142214
     
    22202220}
    22212221
    2222 bool FrameView::scrollToFragmentInternal(const String& fragmentIdentifier)
     2222bool FrameView::scrollToFragmentInternal(StringView fragmentIdentifier)
    22232223{
    22242224    // If our URL has no ref, then we have no place we need to jump to.
  • trunk/Source/WebCore/page/FrameView.h

    r278338 r278669  
    810810    void updateWidgetPositionsTimerFired();
    811811
    812     bool scrollToFragmentInternal(const String&);
     812    bool scrollToFragmentInternal(StringView);
    813813    void scrollToAnchor();
    814814    void scrollPositionChanged(const ScrollPosition& oldPosition, const ScrollPosition& newPosition);
  • trunk/Source/WebCore/page/SecurityOrigin.cpp

    r278253 r278669  
    154154
    155155// https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy (Editor's Draft, 17 November 2016)
    156 static bool shouldTreatAsPotentiallyTrustworthy(const String& protocol, const String& host)
     156static bool shouldTreatAsPotentiallyTrustworthy(const String& protocol, StringView host)
    157157{
    158158    if (LegacySchemeRegistry::shouldTreatURLSchemeAsSecure(protocol))
  • trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp

    r278185 r278669  
    323323
    324324template<typename Predicate>
    325 ContentSecurityPolicy::HashInEnforcedAndReportOnlyPoliciesPair ContentSecurityPolicy::findHashOfContentInPolicies(Predicate&& predicate, const String& content, OptionSet<ContentSecurityPolicyHashAlgorithm> algorithms) const
     325ContentSecurityPolicy::HashInEnforcedAndReportOnlyPoliciesPair ContentSecurityPolicy::findHashOfContentInPolicies(Predicate&& predicate, StringView content, OptionSet<ContentSecurityPolicyHashAlgorithm> algorithms) const
    326326{
    327327    if (algorithms.isEmpty() || content.isEmpty())
     
    405405}
    406406
    407 bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& scriptContent, bool overrideContentSecurityPolicy) const
     407bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, StringView scriptContent, bool overrideContentSecurityPolicy) const
    408408{
    409409    if (overrideContentSecurityPolicy)
     
    428428}
    429429
    430 bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& styleContent, bool overrideContentSecurityPolicy) const
     430bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, StringView styleContent, bool overrideContentSecurityPolicy) const
    431431{
    432432    if (overrideContentSecurityPolicy)
  • trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h

    r278253 r278669  
    9292    bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy = false) const;
    9393    bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, bool overrideContentSecurityPolicy = false) const;
    94     bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& scriptContent, bool overrideContentSecurityPolicy = false) const;
    95     bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, const String& styleContent, bool overrideContentSecurityPolicy = false) const;
     94    bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, StringView scriptContent, bool overrideContentSecurityPolicy = false) const;
     95    bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, StringView styleContent, bool overrideContentSecurityPolicy = false) const;
    9696
    9797    bool allowEval(JSC::JSGlobalObject*, bool overrideContentSecurityPolicy = false) const;
     
    207207
    208208    using HashInEnforcedAndReportOnlyPoliciesPair = std::pair<bool, bool>;
    209     template<typename Predicate> HashInEnforcedAndReportOnlyPoliciesPair findHashOfContentInPolicies(Predicate&&, const String& content, OptionSet<ContentSecurityPolicyHashAlgorithm>) const WARN_UNUSED_RETURN;
     209    template<typename Predicate> HashInEnforcedAndReportOnlyPoliciesPair findHashOfContentInPolicies(Predicate&&, StringView content, OptionSet<ContentSecurityPolicyHashAlgorithm>) const WARN_UNUSED_RETURN;
    210210
    211211    void reportViolation(const String& effectiveViolatedDirective, const ContentSecurityPolicyDirective& violatedDirective, const URL& blockedURL, const String& consoleMessage, JSC::JSGlobalObject*) const;
  • trunk/Source/WebCore/platform/LegacySchemeRegistry.cpp

    r277958 r278669  
    254254{
    255255    Locker locker { schemeRegistryLock };
    256     return schemesHandledBySchemeHandler().contains(scheme.toString());
     256    return schemesHandledBySchemeHandler().contains(scheme.toStringWithoutCopying());
    257257}
    258258
  • trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp

    r278253 r278669  
    447447        auto slashLocation = codecID.find('/');
    448448        auto length = slashLocation == notFound ? codecID.length() - 2 : slashLocation - 2;
    449         m_codec = AtomString { codecID.substring(2, length).convertToASCIILowercase() };
     449        m_codec = codecID.substring(2, length).convertToASCIILowercaseAtom();
    450450        return *m_codec;
    451451    }
  • trunk/Source/WebCore/platform/network/ParsedContentType.cpp

    r278253 r278669  
    123123{
    124124    if (mode == Mode::MimeSniff)
    125         return !isValidHTTPToken(input.toStringWithoutCopying());
     125        return !isValidHTTPToken(input);
    126126    for (unsigned index = 0; index < input.length(); ++index) {
    127127        if (!isTokenCharacter(input[index]))
  • trunk/Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp

    r277357 r278669  
    279279    // reasons and we should consider switching to a more flexible hyphenation library
    280280    // if it is available.
    281     CString utf8StringCopy = string.toStringWithoutCopying().utf8();
     281    CString utf8StringCopy = string.utf8();
    282282
    283283    // WebCore often passes strings like " wordtohyphenate" to the platform layer. Since
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r278525 r278669  
    472472        if (Element* element = is<Element>(object.node()) ? downcast<Element>(object.node()) : nullptr) {
    473473            if (element->hasID())
    474                 ts << " id=\"" + element->getIdAttribute() + "\"";
     474                ts << " id=\"" << element->getIdAttribute() << "\"";
    475475
    476476            if (element->hasClass()) {
  • trunk/Source/WebCore/svg/SVGSVGElement.cpp

    r278277 r278669  
    547547}
    548548
    549 SVGViewElement* SVGSVGElement::findViewAnchor(const String& fragmentIdentifier) const
     549SVGViewElement* SVGSVGElement::findViewAnchor(StringView fragmentIdentifier) const
    550550{
    551551    auto* anchorElement = document().findAnchor(fragmentIdentifier);
     
    559559}
    560560
    561 SVGSVGElement* SVGSVGElement::findRootAnchor(const String& fragmentIdentifier) const
     561SVGSVGElement* SVGSVGElement::findRootAnchor(StringView fragmentIdentifier) const
    562562{
    563563    if (auto* viewElement = findViewAnchor(fragmentIdentifier))
     
    566566}
    567567
    568 bool SVGSVGElement::scrollToFragment(const String& fragmentIdentifier)
     568bool SVGSVGElement::scrollToFragment(StringView fragmentIdentifier)
    569569{
    570570    auto renderer = this->renderer();
     
    617617            if (auto* renderer = rootElement->renderer())
    618618                RenderSVGResource::markForLayoutAndParentResourceInvalidation(*renderer);
    619             m_currentViewFragmentIdentifier = fragmentIdentifier;
     619            m_currentViewFragmentIdentifier = fragmentIdentifier.toString();
    620620            return true;
    621621        }
  • trunk/Source/WebCore/svg/SVGSVGElement.h

    r251527 r278669  
    8585    static Ref<SVGSVGElement> create(const QualifiedName&, Document&);
    8686    static Ref<SVGSVGElement> create(Document&);
    87     bool scrollToFragment(const String& fragmentIdentifier);
     87    bool scrollToFragment(StringView fragmentIdentifier);
    8888    void resetScrollAnchor();
    8989
     
    142142    Ref<NodeList> collectIntersectionOrEnclosureList(SVGRect&, SVGElement*, bool (*checkFunction)(SVGElement&, SVGRect&));
    143143
    144     SVGViewElement* findViewAnchor(const String& fragmentIdentifier) const;
     144    SVGViewElement* findViewAnchor(StringView fragmentIdentifier) const;
    145145    SVGSVGElement* findRootAnchor(const SVGViewElement*) const;
    146     SVGSVGElement* findRootAnchor(const String&) const;
     146    SVGSVGElement* findRootAnchor(StringView) const;
    147147
    148148    bool m_useCurrentView { false };
  • trunk/Source/WebCore/svg/SVGViewSpec.cpp

    r263617 r278669  
    6969template<typename CharacterType> static constexpr CharacterType viewTargetSpec[] =  {'v', 'i', 'e', 'w', 'T', 'a', 'r', 'g', 'e', 't'};
    7070
    71 bool SVGViewSpec::parseViewSpec(const StringView& string)
     71bool SVGViewSpec::parseViewSpec(StringView string)
    7272{
    7373    return readCharactersForParsing(string, [&](auto buffer) -> bool {
  • trunk/Source/WebCore/svg/SVGViewSpec.h

    r263617 r278669  
    3737    }
    3838
    39     bool parseViewSpec(const StringView&);
     39    bool parseViewSpec(StringView);
    4040    void reset();
    4141    void resetContextElement() { m_contextElement = nullptr; }
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm

    r278475 r278669  
    566566        [NSException raise:NSInvalidArgumentException format:@"'%@' is a URL scheme that WKWebView handles natively", urlScheme];
    567567
    568     auto canonicalScheme = WTF::URLParser::maybeCanonicalizeScheme(urlScheme);
     568    auto canonicalScheme = WTF::URLParser::maybeCanonicalizeScheme(String(urlScheme));
    569569    if (!canonicalScheme)
    570570        [NSException raise:NSInvalidArgumentException format:@"'%@' is not a valid URL scheme", urlScheme];
     
    578578- (id <WKURLSchemeHandler>)urlSchemeHandlerForURLScheme:(NSString *)urlScheme
    579579{
    580     auto canonicalScheme = WTF::URLParser::maybeCanonicalizeScheme(urlScheme);
     580    auto canonicalScheme = WTF::URLParser::maybeCanonicalizeScheme(String(urlScheme));
    581581    if (!canonicalScheme)
    582582        return nil;
Note: See TracChangeset for help on using the changeset viewer.