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

Changeset 293309 in webkit


Ignore:
Timestamp:
Apr 24, 2022, 9:45:02 PM (4 years ago)
Author:
Chris Dumez
Message:

Use equalLettersIgnoringASCIICase() and SortedArrayMap in more places
https://bugs.webkit.org/show_bug.cgi?id=239714

Reviewed by Darin Adler.

Use equalLettersIgnoringASCIICase() and SortedArrayMap in more places, for performance.

  • Source/WebKit/NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::preconnectTo):

  • Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:

(WebKit::NetworkResourceLoader::didReceiveResponse):

  • Source/WTF/wtf/unix/LanguageUnix.cpp:

(WTF::platformLanguage):

  • Source/WebCore/Modules/applepay/PaymentCoordinator.cpp:

(WebCore::PaymentCoordinator::validatedPaymentNetwork const):

  • Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp:

(WebCore::FetchBodyConsumer::packageFormData):

  • Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp:

(WebCore::PropertySetCSSStyleDeclaration::setProperty):

  • Source/WebCore/css/parser/CSSAtRuleID.cpp:

(WebCore::cssAtRuleID):

  • Source/WebCore/css/parser/CSSParserImpl.cpp:

(WebCore::consumeStringOrURI):
(WebCore::CSSParserImpl::consumeImportRule):
(WebCore::CSSParserImpl::consumeDeclaration):
(WebCore::CSSParserImpl::consumeKeyframeKeyList):

  • Source/WebCore/css/parser/CSSPropertyParser.cpp:

(WebCore::consumeAnimationName):

  • Source/WebCore/css/parser/CSSSelectorParser.cpp:

(WebCore::CSSSelectorParser::consumePseudo):
(WebCore::CSSSelectorParser::consumeAttributeFlags):
(WebCore::consumeANPlusB):

  • Source/WebCore/css/parser/CSSSupportsParser.cpp:

(WebCore::CSSSupportsParser::consumeCondition):

  • Source/WebCore/css/parser/CSSTokenizer.cpp:

(WebCore::CSSTokenizer::consumeIdentLikeToken):

  • Source/WebCore/css/parser/MediaQueryParser.cpp:

(WebCore::MediaQueryParser::readMediaNot):
(WebCore::isRestrictorOrLogicalOperator):
(WebCore::MediaQueryParser::readMediaType):
(WebCore::MediaQueryParser::readAnd):

  • Source/WebCore/css/parser/SizesCalcParser.cpp:

(WebCore::SizesCalcParser::calcToReversePolishNotation):

  • Source/WebCore/css/typedom/transform/CSSPerspective.cpp:

(WebCore::checkLength):

  • Source/WebCore/editing/cocoa/DataDetection.mm:

(WebCore::DataDetection::requiresExtendedContext):
(WebCore::removeResultLinksFromAnchor):
(WebCore::searchForLinkRemovingExistingDDLinks):
(WebCore::DataDetection::isDataDetectorElement):

  • Source/WebCore/html/Autofill.cpp:

(WebCore::AutofillData::createFromHTMLFormControlElement):

  • Source/WebCore/html/EnterKeyHint.cpp:

(WebCore::enterKeyHintForAttributeValue):

  • Source/WebCore/html/EnterKeyHint.h:
  • Source/WebCore/html/HTMLAnchorElement.cpp:

(WebCore::HTMLAnchorElement::relList):

  • Source/WebCore/html/HTMLFormElement.cpp:

(WebCore::parseFormRelAttributes):
(WebCore::HTMLFormElement::relList):

  • Source/WebCore/html/HTMLImageElement.cpp:

(WebCore::parseCrossoriginState):

  • Source/WebCore/html/InputType.cpp:

(WebCore::InputType::applyStep):

  • Source/WebCore/html/LinkRelAttribute.cpp:

(WebCore::LinkRelAttribute::isSupported):

  • Source/WebCore/html/parser/HTMLParserIdioms.cpp:

(WebCore::parseCORSSettingsAttribute):

  • Source/WebCore/loader/DocumentLoader.cpp:

(WebCore::DocumentLoader::loadApplicationManifest):

  • Source/WebCore/loader/LinkLoader.cpp:

(WebCore::LinkLoader::preconnectIfNeeded):

  • Source/WebCore/loader/ServerTiming.cpp:

(WebCore::ServerTiming::setParameter):

  • Source/WebCore/page/PageConsoleClient.cpp:

(WebCore::PageConsoleClient::screenshot):

  • Source/WebCore/page/Quirks.cpp:

(WebCore::Quirks::isGoogleMaps const):
(WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
(WebCore::Quirks::needsDeferKeyDownAndKeyPressTimersUntilNextEditingCommand const):

  • Source/WebCore/page/SecurityOriginData.cpp:

(WebCore::SecurityOriginData::databaseIdentifier const):

  • Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp:

(WebCore::schemeIsInHttpFamily):
(WebCore::ContentSecurityPolicySourceList::isValidSourceForExtensionMode):

  • Source/WebCore/platform/graphics/FontGenericFamilies.cpp:

(WebCore::computeUserPrefersSimplified):

  • Source/WebCore/platform/graphics/MIMETypeCache.cpp:

(WebCore::MIMETypeCache::shouldOverrideExtendedType):

  • Source/WebCore/platform/graphics/MediaPlayer.cpp:

(WebCore::MediaPlayer::supportsType):

  • Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:

(WebCore::willUseWebMFormatReaderForType):
(WebCore::keySystemIsSupported):
(WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem):

  • Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp:

(WebCore::SourceBufferParserWebM::isContentTypeSupported):

  • Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp:

(WebCore::Font::platformInit):

  • Source/WebCore/platform/graphics/gstreamer/DMABufVideoSinkGStreamer.cpp:

(webKitDMABufVideoSinkIsEnabled):

  • Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.cpp:

(WebCore::isThunderRanked):

  • Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:

(WebCore::LibWebRTCProvider::createDecodingConfiguration):
(WebCore::LibWebRTCProvider::createEncodingConfiguration):

  • Source/WebCore/platform/network/curl/CookieUtil.cpp:

(WebCore::CookieUtil::parseCookieAttributes):

  • Source/WebCore/platform/network/curl/CurlMultipartHandle.cpp:

(WebCore::CurlMultipartHandle::extractBoundary):

  • Source/WebCore/rendering/RenderThemeMac.mm:

(WebCore::iconForAttachment):

  • Source/WebCore/svg/SVGAElement.cpp:

(WebCore::SVGAElement::relList):

  • Source/WebCore/testing/MockCDMFactory.cpp:

(WebCore::MockCDMFactory::supportsKeySystem):
(WebCore::MockCDMInstance::setServerCertificate):

Canonical link: https://commits.webkit.org/249932@main

Location:
trunk/Source
Files:
43 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/Modules/applepay/PaymentCoordinator.cpp

    r290329 r293309  
    266266std::optional<String> PaymentCoordinator::validatedPaymentNetwork(Document&, unsigned version, const String& paymentNetwork) const
    267267{
    268     if (version < 2 && equalIgnoringASCIICase(paymentNetwork, "jcb"))
     268    if (version < 2 && equalLettersIgnoringASCIICase(paymentNetwork, "jcb"))
    269269        return std::nullopt;
    270270
  • trunk/Source/WebCore/Modules/fetch/FetchBodyConsumer.cpp

    r292939 r293309  
    176176        if (!mimeType)
    177177            return std::nullopt;
    178         if (equalIgnoringASCIICase(mimeType->type, "multipart") && equalIgnoringASCIICase(mimeType->subtype, "form-data")) {
     178        if (equalLettersIgnoringASCIICase(mimeType->type, "multipart") && equalLettersIgnoringASCIICase(mimeType->subtype, "form-data")) {
    179179            auto iterator = mimeType->parameters.find<HashTranslatorASCIILiteral>("boundary"_s);
    180180            if (iterator != mimeType->parameters.end())
     
    202202            nextBoundary = static_cast<const uint8_t*>(memmem(nextBoundary + boundaryLength, length - (nextBoundary + boundaryLength - data), boundary.data(), boundaryLength));
    203203        }
    204     } else if (mimeType && equalIgnoringASCIICase(mimeType->type, "application") && equalIgnoringASCIICase(mimeType->subtype, "x-www-form-urlencoded")) {
     204    } else if (mimeType && equalLettersIgnoringASCIICase(mimeType->type, "application") && equalLettersIgnoringASCIICase(mimeType->subtype, "x-www-form-urlencoded")) {
    205205        auto dataString = String::fromUTF8(data, length);
    206206        for (auto& pair : WTF::URLParser::parseURLEncodedForm(dataString))
  • trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp

    r292636 r293309  
    243243        return { };
    244244
    245     bool important = equalIgnoringASCIICase(priority, "important");
     245    bool important = equalLettersIgnoringASCIICase(priority, "important");
    246246    if (!important && !priority.isEmpty())
    247247        return { };
  • trunk/Source/WebCore/css/parser/CSSAtRuleID.cpp

    r286845 r293309  
    3131#include "CSSAtRuleID.h"
    3232
     33#include <wtf/SortedArrayMap.h>
     34
    3335namespace WebCore {
    3436
    3537CSSAtRuleID cssAtRuleID(StringView name)
    3638{
    37     if (equalIgnoringASCIICase(name, "charset"))
    38         return CSSAtRuleCharset;
    39     if (equalIgnoringASCIICase(name, "font-face"))
    40         return CSSAtRuleFontFace;
    41     if (equalIgnoringASCIICase(name, "font-palette-values"))
    42         return CSSAtRuleFontPaletteValues;
    43     if (equalIgnoringASCIICase(name, "import"))
    44         return CSSAtRuleImport;
    45     if (equalIgnoringASCIICase(name, "keyframes"))
    46         return CSSAtRuleKeyframes;
    47     if (equalIgnoringASCIICase(name, "media"))
    48         return CSSAtRuleMedia;
    49     if (equalIgnoringASCIICase(name, "namespace"))
    50         return CSSAtRuleNamespace;
    51     if (equalIgnoringASCIICase(name, "page"))
    52         return CSSAtRulePage;
    53     if (equalIgnoringASCIICase(name, "supports"))
    54         return CSSAtRuleSupports;
    55     if (equalIgnoringASCIICase(name, "viewport"))
    56         return CSSAtRuleViewport;
    57     if (equalIgnoringASCIICase(name, "-webkit-keyframes"))
    58         return CSSAtRuleWebkitKeyframes;
    59     if (equalIgnoringASCIICase(name, "counter-style"))
    60         return CSSAtRuleCounterStyle;
    61     if (equalIgnoringASCIICase(name, "layer"))
    62         return CSSAtRuleLayer;
    63     if (equalIgnoringASCIICase(name, "container"))
    64         return CSSAtRuleContainer;
    65     return CSSAtRuleInvalid;
     39    static constexpr std::pair<ComparableLettersLiteral, CSSAtRuleID> mappings[] = {
     40        { "-webkit-keyframes", CSSAtRuleWebkitKeyframes },
     41        { "charset", CSSAtRuleCharset },
     42        { "container", CSSAtRuleContainer },
     43        { "counter-style", CSSAtRuleCounterStyle },
     44        { "font-face", CSSAtRuleFontFace },
     45        { "font-palette-values", CSSAtRuleFontPaletteValues },
     46        { "import", CSSAtRuleImport },
     47        { "keyframes", CSSAtRuleKeyframes },
     48        { "layer", CSSAtRuleLayer },
     49        { "media", CSSAtRuleMedia },
     50        { "namespace", CSSAtRuleNamespace },
     51        { "page", CSSAtRulePage },
     52        { "supports", CSSAtRuleSupports },
     53        { "viewport", CSSAtRuleViewport },
     54    };
     55    static constexpr SortedArrayMap cssAtRules { mappings };
     56    return cssAtRules.get(name, CSSAtRuleInvalid);
    6657}
    6758
  • trunk/Source/WebCore/css/parser/CSSParserImpl.cpp

    r292636 r293309  
    487487        return range.consumeIncludingWhitespace().value().toAtomString();
    488488
    489     if (token.type() != FunctionToken || !equalIgnoringASCIICase(token.value(), "url"))
     489    if (token.type() != FunctionToken || !equalLettersIgnoringASCIICase(token.value(), "url"))
    490490        return AtomString();
    491491
     
    552552
    553553        auto& token = prelude.peek();
    554         if (token.type() == FunctionToken && equalIgnoringASCIICase(token.value(), "layer")) {
     554        if (token.type() == FunctionToken && equalLettersIgnoringASCIICase(token.value(), "layer")) {
    555555            auto savedPreludeForFailure = prelude;
    556556            auto contents = CSSPropertyParserHelpers::consumeFunction(prelude);
     
    562562            return layerName;
    563563        }
    564         if (token.type() == IdentToken && equalIgnoringASCIICase(token.value(), "layer")) {
     564        if (token.type() == IdentToken && equalLettersIgnoringASCIICase(token.value(), "layer")) {
    565565            prelude.consumeIncludingWhitespace();
    566566            return CascadeLayerName { };
     
    10151015        removeTrailingWhitespace(range, end);
    10161016        declarationValueEnd = end;
    1017         if (end[-1].type() == IdentToken && equalIgnoringASCIICase(end[-1].value(), "important")) {
     1017        if (end[-1].type() == IdentToken && equalLettersIgnoringASCIICase(end[-1].value(), "important")) {
    10181018            --end;
    10191019            removeTrailingWhitespace(range, end);
     
    10711071        if (token.type() == PercentageToken && token.numericValue() >= 0 && token.numericValue() <= 100)
    10721072            result.append(token.numericValue() / 100);
    1073         else if (token.type() == IdentToken && equalIgnoringASCIICase(token.value(), "from"))
     1073        else if (token.type() == IdentToken && equalLettersIgnoringASCIICase(token.value(), "from"))
    10741074            result.append(0);
    1075         else if (token.type() == IdentToken && equalIgnoringASCIICase(token.value(), "to"))
     1075        else if (token.type() == IdentToken && equalLettersIgnoringASCIICase(token.value(), "to"))
    10761076            result.append(1);
    10771077        else
  • trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp

    r293090 r293309  
    13751375    if (range.peek().type() == StringToken) {
    13761376        const CSSParserToken& token = range.consumeIncludingWhitespace();
    1377         if (equalIgnoringASCIICase(token.value(), "none"))
     1377        if (equalLettersIgnoringASCIICase(token.value(), "none"))
    13781378            return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
    13791379        return CSSValuePool::singleton().createValue(token.value().toString(), CSSUnitType::CSS_STRING);
  • trunk/Source/WebCore/css/parser/CSSSelectorParser.cpp

    r292939 r293309  
    710710                    return nullptr;
    711711                const CSSParserToken& ident = block.consume();
    712                 if (!equalIgnoringASCIICase(ident.value(), "of"))
     712                if (!equalLettersIgnoringASCIICase(ident.value(), "of"))
    713713                    return nullptr;
    714714                if (block.peek().type() != WhitespaceToken)
     
    884884        return CSSSelector::CaseSensitive;
    885885    const CSSParserToken& flag = range.consumeIncludingWhitespace();
    886     if (equalIgnoringASCIICase(flag.value(), "i"))
     886    if (equalLettersIgnoringASCIICase(flag.value(), "i"))
    887887        return CSSSelector::CaseInsensitive;
    888888    m_failedParsing = true;
     
    921921    }
    922922    if (token.type() == IdentToken) {
    923         if (equalIgnoringASCIICase(token.value(), "odd")) {
     923        if (equalLettersIgnoringASCIICase(token.value(), "odd")) {
    924924            result = std::make_pair(2, 1);
    925925            return true;
    926926        }
    927         if (equalIgnoringASCIICase(token.value(), "even")) {
     927        if (equalLettersIgnoringASCIICase(token.value(), "even")) {
    928928            result = std::make_pair(2, 0);
    929929            return true;
  • trunk/Source/WebCore/css/parser/CSSSupportsParser.cpp

    r267143 r293309  
    5858{
    5959    if (range.peek().type() == IdentToken || range.peek().type() == FunctionToken) {
    60         if (equalIgnoringASCIICase(range.peek().value(), "not"))
     60        if (equalLettersIgnoringASCIICase(range.peek().value(), "not"))
    6161            return consumeNegation(range);
    6262    }
     
    9393        if (clauseType == Unresolved)
    9494            clauseType = token.value().length() == 3 ? Conjunction : Disjunction;
    95         if ((clauseType == Conjunction && !equalIgnoringASCIICase(token.value(), "and"))
    96             || (clauseType == Disjunction && !equalIgnoringASCIICase(token.value(), "or")))
     95        if ((clauseType == Conjunction && !equalLettersIgnoringASCIICase(token.value(), "and"))
     96            || (clauseType == Disjunction && !equalLettersIgnoringASCIICase(token.value(), "or")))
    9797            return Invalid;
    9898
  • trunk/Source/WebCore/css/parser/CSSTokenizer.cpp

    r289493 r293309  
    596596    StringView name = consumeName();
    597597    if (consumeIfNext('(')) {
    598         if (equalIgnoringASCIICase(name, "url")) {
     598        if (equalLettersIgnoringASCIICase(name, "url")) {
    599599            // The spec is slightly different so as to avoid dropping whitespace
    600600            // tokens, but they wouldn't be used and this is easier.
  • trunk/Source/WebCore/css/parser/MediaQueryParser.cpp

    r291863 r293309  
    114114void MediaQueryParser::readMediaNot(CSSParserTokenType type, const CSSParserToken& token, CSSParserTokenRange& range)
    115115{
    116     if (type == IdentToken && equalIgnoringASCIICase(token.value(), "not"))
     116    if (type == IdentToken && equalLettersIgnoringASCIICase(token.value(), "not"))
    117117        setStateAndRestrict(ReadFeatureStart, MediaQuery::Not);
    118118    else
     
    129129{
    130130    // FIXME: it would be more efficient to use lower-case always for tokenValue.
    131     return equalIgnoringASCIICase(token.value(), "not")
    132         || equalIgnoringASCIICase(token.value(), "and")
    133         || equalIgnoringASCIICase(token.value(), "or")
    134         || equalIgnoringASCIICase(token.value(), "only");
     131    return equalLettersIgnoringASCIICase(token.value(), "not")
     132        || equalLettersIgnoringASCIICase(token.value(), "and")
     133        || equalLettersIgnoringASCIICase(token.value(), "or")
     134        || equalLettersIgnoringASCIICase(token.value(), "only");
    135135}
    136136
     
    143143            m_state = ReadFeature;
    144144    } else if (type == IdentToken) {
    145         if (m_state == ReadRestrictor && equalIgnoringASCIICase(token.value(), "not"))
     145        if (m_state == ReadRestrictor && equalLettersIgnoringASCIICase(token.value(), "not"))
    146146            setStateAndRestrict(ReadMediaType, MediaQuery::Not);
    147         else if (m_state == ReadRestrictor && equalIgnoringASCIICase(token.value(), "only"))
     147        else if (m_state == ReadRestrictor && equalLettersIgnoringASCIICase(token.value(), "only"))
    148148            setStateAndRestrict(ReadMediaType, MediaQuery::Only);
    149149        else if (m_mediaQueryData.restrictor() != MediaQuery::None
     
    175175void MediaQueryParser::readAnd(CSSParserTokenType type, const CSSParserToken& token, CSSParserTokenRange& /*range*/)
    176176{
    177     if (type == IdentToken && equalIgnoringASCIICase(token.value(), "and")) {
     177    if (type == IdentToken && equalLettersIgnoringASCIICase(token.value(), "and")) {
    178178        m_state = ReadFeatureStart;
    179179    } else if (type == CommaToken && m_parserType != MediaConditionParser) {
  • trunk/Source/WebCore/css/parser/SizesCalcParser.cpp

    r279498 r293309  
    131131            break;
    132132        case FunctionToken:
    133             if (!equalIgnoringASCIICase(token.value(), "calc"))
     133            if (!equalLettersIgnoringASCIICase(token.value(), "calc"))
    134134                return false;
    135135            // "calc(" is the same as "("
  • trunk/Source/WebCore/css/typedom/transform/CSSPerspective.cpp

    r293052 r293309  
    4848    auto checkKeywordValue = [] (RefPtr<CSSKeywordValue> value) -> ExceptionOr<CSSPerspectiveValue> {
    4949        RELEASE_ASSERT(value);
    50         if (!equalIgnoringASCIICase(value->value(), "none"))
     50        if (!equalLettersIgnoringASCIICase(value->value(), "none"))
    5151            return Exception { TypeError };
    5252        return { WTFMove(value) };
  • trunk/Source/WebCore/editing/cocoa/DataDetection.mm

    r293292 r293309  
    185185bool DataDetection::requiresExtendedContext(Element& element)
    186186{
    187     return equalIgnoringASCIICase(element.attributeWithoutSynchronization(x_apple_data_detectors_typeAttr), "calendar-event");
     187    return equalLettersIgnoringASCIICase(element.attributeWithoutSynchronization(x_apple_data_detectors_typeAttr), "calendar-event");
    188188}
    189189
     
    277277        return;
    278278   
    279     bool elementIsDDAnchor = is<HTMLAnchorElement>(element) && equalIgnoringASCIICase(element.attributeWithoutSynchronization(x_apple_data_detectorsAttr), "true");
     279    bool elementIsDDAnchor = is<HTMLAnchorElement>(element) && equalLettersIgnoringASCIICase(element.attributeWithoutSynchronization(x_apple_data_detectorsAttr), "true");
    280280    if (!elementIsDDAnchor)
    281281        return;
     
    293293        if (is<HTMLAnchorElement>(*node)) {
    294294            auto& anchor = downcast<HTMLAnchorElement>(*node);
    295             if (!equalIgnoringASCIICase(anchor.attributeWithoutSynchronization(x_apple_data_detectorsAttr), "true"))
     295            if (!equalLettersIgnoringASCIICase(anchor.attributeWithoutSynchronization(x_apple_data_detectorsAttr), "true"))
    296296                return true;
    297297            removeResultLinksFromAnchor(anchor);
     
    302302            // The only ancestors not tested at this point are in the direct line from self's parent to the top.
    303303            for (auto& anchor : ancestorsOfType<HTMLAnchorElement>(startNode)) {
    304                 if (!equalIgnoringASCIICase(anchor.attributeWithoutSynchronization(x_apple_data_detectorsAttr), "true"))
     304                if (!equalLettersIgnoringASCIICase(anchor.attributeWithoutSynchronization(x_apple_data_detectorsAttr), "true"))
    305305                    return true;
    306306                removeResultLinksFromAnchor(anchor);
     
    690690bool DataDetection::isDataDetectorElement(const Element& element)
    691691{
    692     return is<HTMLAnchorElement>(element) && equalIgnoringASCIICase(element.attributeWithoutSynchronization(x_apple_data_detectorsAttr), "true");
     692    return is<HTMLAnchorElement>(element) && equalLettersIgnoringASCIICase(element.attributeWithoutSynchronization(x_apple_data_detectorsAttr), "true");
    693693}
    694694
  • trunk/Source/WebCore/html/Autofill.cpp

    r293285 r293309  
    248248    // in the following list, then run the substeps that follow:
    249249    const auto& modeToken = tokens[index];
    250     if (equalIgnoringASCIICase(modeToken, "shipping") || equalIgnoringASCIICase(modeToken, "billing")) {
     250    if (equalLettersIgnoringASCIICase(modeToken, "shipping") || equalLettersIgnoringASCIICase(modeToken, "billing")) {
    251251        // 1. Let mode be the matching string from the list above.
    252252        const auto& mode = modeToken;
  • trunk/Source/WebCore/html/EnterKeyHint.cpp

    r293285 r293309  
    2828
    2929#include "CommonAtomStrings.h"
     30#include <wtf/SortedArrayMap.h>
    3031
    3132namespace WebCore {
    3233
    33 EnterKeyHint enterKeyHintForAttributeValue(const String& value)
     34EnterKeyHint enterKeyHintForAttributeValue(StringView value)
    3435{
    35     if (equalIgnoringASCIICase(value, "enter"))
    36         return EnterKeyHint::Enter;
    37     if (equalIgnoringASCIICase(value, "done"))
    38         return EnterKeyHint::Done;
    39     if (equalIgnoringASCIICase(value, "go"))
    40         return EnterKeyHint::Go;
    41     if (equalIgnoringASCIICase(value, "next"))
    42         return EnterKeyHint::Next;
    43     if (equalIgnoringASCIICase(value, "previous"))
    44         return EnterKeyHint::Previous;
    45     if (equalIgnoringASCIICase(value, "search"))
    46         return EnterKeyHint::Search;
    47     if (equalIgnoringASCIICase(value, "send"))
    48         return EnterKeyHint::Send;
    49     return EnterKeyHint::Unspecified;
     36    static constexpr std::pair<ComparableLettersLiteral, EnterKeyHint> mappings[] = {
     37        { "done", EnterKeyHint::Done },
     38        { "enter", EnterKeyHint::Enter },
     39        { "go", EnterKeyHint::Go },
     40        { "next", EnterKeyHint::Next },
     41        { "previous", EnterKeyHint::Previous },
     42        { "search", EnterKeyHint::Search },
     43        { "send", EnterKeyHint::Send }
     44    };
     45    static constexpr SortedArrayMap enterKeyHints { mappings };
     46    return enterKeyHints.get(value, EnterKeyHint::Unspecified);
    5047}
    5148
  • trunk/Source/WebCore/html/EnterKeyHint.h

    r262933 r293309  
    4242};
    4343
    44 EnterKeyHint enterKeyHintForAttributeValue(const String&);
     44EnterKeyHint enterKeyHintForAttributeValue(StringView);
    4545String attributeValueForEnterKeyHint(EnterKeyHint);
    4646
  • trunk/Source/WebCore/html/HTMLAnchorElement.cpp

    r293059 r293309  
    316316        m_relList = makeUnique<DOMTokenList>(*this, HTMLNames::relAttr, [](Document& document, StringView token) {
    317317#if USE(SYSTEM_PREVIEW)
    318             if (equalIgnoringASCIICase(token, "ar"))
     318            if (equalLettersIgnoringASCIICase(token, "ar"))
    319319                return document.settings().systemPreviewEnabled();
    320320#else
    321321            UNUSED_PARAM(document);
    322322#endif
    323             return equalIgnoringASCIICase(token, "noreferrer") || equalIgnoringASCIICase(token, "noopener") || equalIgnoringASCIICase(token, "opener");
     323            return equalLettersIgnoringASCIICase(token, "noreferrer") || equalLettersIgnoringASCIICase(token, "noopener") || equalLettersIgnoringASCIICase(token, "opener");
    324324        });
    325325    }
  • trunk/Source/WebCore/html/HTMLFormElement.cpp

    r293285 r293309  
    8282    FormRelAttributes attributes;
    8383    for (auto token : string.split(' ')) {
    84         if (equalIgnoringASCIICase(token, "noopener"))
     84        if (equalLettersIgnoringASCIICase(token, "noopener"))
    8585            attributes.noopener = true;
    86         else if (equalIgnoringASCIICase(token, "noreferrer"))
     86        else if (equalLettersIgnoringASCIICase(token, "noreferrer"))
    8787            attributes.noreferrer = true;
    88         else if (equalIgnoringASCIICase(token, "opener"))
     88        else if (equalLettersIgnoringASCIICase(token, "opener"))
    8989            attributes.opener = true;
    9090    }
     
    758758    if (!m_relList) {
    759759        m_relList = makeUnique<DOMTokenList>(*this, HTMLNames::relAttr, [](Document&, StringView token) {
    760             return equalIgnoringASCIICase(token, "noreferrer") || equalIgnoringASCIICase(token, "noopener") || equalIgnoringASCIICase(token, "opener");
     760            return equalLettersIgnoringASCIICase(token, "noreferrer") || equalLettersIgnoringASCIICase(token, "noopener") || equalLettersIgnoringASCIICase(token, "opener");
    761761        });
    762762    }
  • trunk/Source/WebCore/html/HTMLImageElement.cpp

    r293285 r293309  
    290290    if (crossoriginValue.isNull())
    291291        return NotSet;
    292     return equalIgnoringASCIICase(crossoriginValue, "use-credentials") ? UseCredentials : Anonymous;
     292    return equalLettersIgnoringASCIICase(crossoriginValue, "use-credentials") ? UseCredentials : Anonymous;
    293293}
    294294
  • trunk/Source/WebCore/html/InputType.cpp

    r293195 r293309  
    955955    newValue = newValue + stepRange.step() * Decimal::fromDouble(count);
    956956    const AtomString& stepString = element()->getAttribute(HTMLNames::stepAttr);
    957     if (!equalIgnoringASCIICase(stepString, "any"))
     957    if (!equalLettersIgnoringASCIICase(stepString, "any"))
    958958        newValue = stepRange.alignValueForStep(current, newValue);
    959959
  • trunk/Source/WebCore/html/LinkRelAttribute.cpp

    r266360 r293309  
    117117    }
    118118
    119     if (document.settings().linkPreconnectEnabled() && equalIgnoringASCIICase(attribute, "preconnect"))
     119    if (document.settings().linkPreconnectEnabled() && equalLettersIgnoringASCIICase(attribute, "preconnect"))
    120120        return true;
    121121
    122     if (document.settings().linkPreloadEnabled() && equalIgnoringASCIICase(attribute, "preload"))
     122    if (document.settings().linkPreloadEnabled() && equalLettersIgnoringASCIICase(attribute, "preload"))
    123123        return true;
    124124
    125     if (document.settings().linkPrefetchEnabled() && equalIgnoringASCIICase(attribute, "prefetch"))
     125    if (document.settings().linkPrefetchEnabled() && equalLettersIgnoringASCIICase(attribute, "prefetch"))
    126126        return true;
    127127
  • trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp

    r292951 r293309  
    358358    if (value.isNull())
    359359        return String();
    360     if (equalIgnoringASCIICase(value, "use-credentials"))
     360    if (equalLettersIgnoringASCIICase(value, "use-credentials"))
    361361        return "use-credentials"_s;
    362362    return "anonymous"_s;
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r293195 r293309  
    15511551
    15521552        manifestURL = href;
    1553         useCredentials = equalIgnoringASCIICase(link.attributeWithoutSynchronization(HTMLNames::crossoriginAttr), "use-credentials");
     1553        useCredentials = equalLettersIgnoringASCIICase(link.attributeWithoutSynchronization(HTMLNames::crossoriginAttr), "use-credentials");
    15541554        break;
    15551555    }
  • trunk/Source/WebCore/loader/LinkLoader.cpp

    r292810 r293309  
    215215    ASSERT(document.settings().linkPreconnectEnabled());
    216216    StoredCredentialsPolicy storageCredentialsPolicy = StoredCredentialsPolicy::Use;
    217     if (equalIgnoringASCIICase(params.crossOrigin, "anonymous") && document.securityOrigin().isSameOriginDomain(SecurityOrigin::create(href)))
     217    if (equalLettersIgnoringASCIICase(params.crossOrigin, "anonymous") && document.securityOrigin().isSameOriginDomain(SecurityOrigin::create(href)))
    218218        storageCredentialsPolicy = StoredCredentialsPolicy::DoNotUse;
    219219    ASSERT(document.frame()->loader().networkingContext());
  • trunk/Source/WebCore/loader/ServerTiming.cpp

    r290901 r293309  
    3131void ServerTiming::setParameter(const String& name, const String& value)
    3232{
    33     if (equalIgnoringASCIICase(name, "dur")) {
     33    if (equalLettersIgnoringASCIICase(name, "dur")) {
    3434        if (!durationSet) {
    3535            duration = value.toDouble();
     
    3838        return;
    3939    }
    40     if (equalIgnoringASCIICase(name, "desc")) {
     40    if (equalLettersIgnoringASCIICase(name, "desc")) {
    4141        if (!descriptionSet) {
    4242            description = value;
  • trunk/Source/WebCore/page/PageConsoleClient.cpp

    r292469 r293309  
    416416        } else {
    417417            String base64;
    418             if (possibleTarget.getString(lexicalGlobalObject, base64) && base64.startsWithIgnoringASCIICase("data:") && base64.length() > 5) {
     418            if (possibleTarget.getString(lexicalGlobalObject, base64) && startsWithLettersIgnoringASCIICase(base64, "data:") && base64.length() > 5) {
    419419                target = possibleTarget;
    420420                dataURL = base64;
  • trunk/Source/WebCore/page/Quirks.cpp

    r292810 r293309  
    364364{
    365365    auto& url = m_document->topDocument().url();
    366     return topPrivatelyControlledDomain(url.host().toString()).startsWith("google.") && url.path().startsWithIgnoringASCIICase("/maps/");
     366    return topPrivatelyControlledDomain(url.host().toString()).startsWith("google.") && startsWithLettersIgnoringASCIICase(url.path(), "/maps/");
    367367}
    368368
     
    390390        if (host == "wix.com" || host.endsWith(".wix.com")) {
    391391            // Disable simulated mouse dispatching for template selection.
    392             return url.path().startsWithIgnoringASCIICase("/website/templates/") ? ShouldDispatchSimulatedMouseEvents::No : ShouldDispatchSimulatedMouseEvents::Yes;
     392            return startsWithLettersIgnoringASCIICase(url.path(), "/website/templates/") ? ShouldDispatchSimulatedMouseEvents::No : ShouldDispatchSimulatedMouseEvents::Yes;
    393393        }
    394394
    395         if ((host == "desmos.com" || host.endsWith(".desmos.com")) && url.path().startsWithIgnoringASCIICase("/calculator/"))
     395        if ((host == "desmos.com" || host.endsWith(".desmos.com")) && startsWithLettersIgnoringASCIICase(url.path(), "/calculator/"))
    396396            return ShouldDispatchSimulatedMouseEvents::Yes;
    397397        if (host == "figma.com" || host.endsWith(".figma.com"))
     
    616616
    617617    auto& url = m_document->topDocument().url();
    618     return equalLettersIgnoringASCIICase(url.host(), "docs.google.com") && url.path().startsWithIgnoringASCIICase("/spreadsheets/");
     618    return equalLettersIgnoringASCIICase(url.host(), "docs.google.com") && startsWithLettersIgnoringASCIICase(url.path(), "/spreadsheets/");
    619619#else
    620620    return false;
  • trunk/Source/WebCore/page/SecurityOriginData.cpp

    r292857 r293309  
    8181    // Now that we've fixed that bug, we produce this string for compatibility
    8282    // with existing persistent state.
    83     if (equalIgnoringASCIICase(protocol, "file"))
     83    if (equalLettersIgnoringASCIICase(protocol, "file"))
    8484        return "file__0"_s;
    8585
  • trunk/Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp

    r292477 r293309  
    182182static bool schemeIsInHttpFamily(StringView scheme)
    183183{
    184     return equalIgnoringASCIICase(scheme, "https") || equalIgnoringASCIICase(scheme, "http");
     184    return equalLettersIgnoringASCIICase(scheme, "https") || equalLettersIgnoringASCIICase(scheme, "http");
    185185}
    186186
     
    220220            return false;
    221221
    222         if (equalIgnoringASCIICase(parsedSource.scheme, "blob"))
     222        if (equalLettersIgnoringASCIICase(parsedSource.scheme, "blob"))
    223223            return true;
    224224
    225         if (!equalIgnoringASCIICase(parsedSource.scheme, "https") || parsedSource.host.value.isEmpty())
     225        if (!equalLettersIgnoringASCIICase(parsedSource.scheme, "https") || parsedSource.host.value.isEmpty())
    226226            return false;
    227227        break;
  • trunk/Source/WebCore/platform/graphics/FontGenericFamilies.cpp

    r290901 r293309  
    4949    const Vector<String>& preferredLanguages = userPreferredLanguages();
    5050    for (auto& language : preferredLanguages) {
    51         if (equalIgnoringASCIICase(language, "zh-tw"))
     51        if (equalLettersIgnoringASCIICase(language, "zh-tw"))
    5252            return false;
    53         if (equalIgnoringASCIICase(language, "zh-cn"))
     53        if (equalLettersIgnoringASCIICase(language, "zh-cn"))
    5454            return true;
    5555    }
  • trunk/Source/WebCore/platform/graphics/MIMETypeCache.cpp

    r276880 r293309  
    139139    // Some sites (e.g. Modernizr) use 'audio/mpeg; codecs="mp3"' even though
    140140    // it is not RFC 3003 compliant.
    141     if (equalIgnoringASCIICase(type.containerType(), "audio/mpeg")) {
     141    if (equalLettersIgnoringASCIICase(type.containerType(), "audio/mpeg")) {
    142142        auto codecs = type.codecs();
    143143        return codecs.size() == 1 && codecs[0] == "mp3";
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp

    r293285 r293309  
    11081108        return SupportsType::IsNotSupported;
    11091109
    1110     if (!containerType.startsWithIgnoringASCIICase("video/") && !containerType.startsWithIgnoringASCIICase("audio/") && !containerType.startsWithIgnoringASCIICase("application/"))
     1110    if (!startsWithLettersIgnoringASCIICase(containerType.string(), "video/") && !startsWithLettersIgnoringASCIICase(containerType.string(), "audio/") && !startsWithLettersIgnoringASCIICase(containerType.string(), "application/"))
    11111111        return SupportsType::IsNotSupported;
    11121112
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r292810 r293309  
    809809        return false;
    810810
    811     return equalIgnoringASCIICase(type, "video/webm") || equalIgnoringASCIICase(type, "audio/webm");
     811    return equalLettersIgnoringASCIICase(type, "video/webm") || equalLettersIgnoringASCIICase(type, "audio/webm");
    812812#else
    813813    UNUSED_PARAM(type);
     
    20192019static bool keySystemIsSupported(const String& keySystem)
    20202020{
    2021     if (equalIgnoringASCIICase(keySystem, "com.apple.fps") || equalIgnoringASCIICase(keySystem, "com.apple.fps.1_0") || equalIgnoringASCIICase(keySystem, "org.w3c.clearkey"))
    2022         return true;
    2023     return false;
     2021    return equalLettersIgnoringASCIICase(keySystem, "com.apple.fps")
     2022        || equalIgnoringASCIICase(keySystem, "com.apple.fps.1_0")
     2023        || equalLettersIgnoringASCIICase(keySystem, "org.w3c.clearkey");
    20242024}
    20252025#endif
     
    20542054    if (!keySystem.isEmpty()) {
    20552055        // "Clear Key" is only supported with HLS:
    2056         if (equalIgnoringASCIICase(keySystem, "org.w3c.clearkey") && !mimeType.isEmpty() && !equalIgnoringASCIICase(mimeType, "application/x-mpegurl"))
     2056        if (equalLettersIgnoringASCIICase(keySystem, "org.w3c.clearkey") && !mimeType.isEmpty() && !equalLettersIgnoringASCIICase(mimeType, "application/x-mpegurl"))
    20572057            return false;
    20582058
  • trunk/Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp

    r291216 r293309  
    12811281
    12821282    auto containerType = type.containerType();
    1283     bool isAudioContainerType = equalIgnoringASCIICase(containerType, "audio/webm");
    1284     bool isVideoContainerType = equalIgnoringASCIICase(containerType, "video/webm");
     1283    bool isAudioContainerType = equalLettersIgnoringASCIICase(containerType, "audio/webm");
     1284    bool isVideoContainerType = equalLettersIgnoringASCIICase(containerType, "video/webm");
    12851285    if (!isAudioContainerType && !isVideoContainerType)
    12861286        return MediaPlayerEnums::SupportsType::IsNotSupported;
  • trunk/Source/WebCore/platform/graphics/gstreamer/DMABufVideoSinkGStreamer.cpp

    r291343 r293309  
    168168        [&] {
    169169            const char* value = g_getenv("WEBKIT_GST_DMABUF_SINK_ENABLED");
    170             s_enabled = value && (equalIgnoringASCIICase(value, "true") || equalIgnoringASCIICase(value, "1"));
     170            s_enabled = value && (equalLettersIgnoringASCIICase(value, "true") || equalLettersIgnoringASCIICase(value, "1"));
    171171        });
    172172    return s_enabled;
  • trunk/Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCProvider.cpp

    r292473 r293309  
    609609        }
    610610        auto containerType = contentType.containerType();
    611         if (equalIgnoringASCIICase(containerType, "video/vp8")) {
     611        if (equalLettersIgnoringASCIICase(containerType, "video/vp8")) {
    612612            info.powerEfficient = false;
    613613            info.smooth = isVPSoftwareDecoderSmooth(*info.supportedConfiguration.video);
    614         } else if (equalIgnoringASCIICase(containerType, "video/vp9")) {
     614        } else if (equalLettersIgnoringASCIICase(containerType, "video/vp9")) {
    615615            auto decodingInfo = computeVPParameters(*info.supportedConfiguration.video);
    616616            if (decodingInfo && !decodingInfo->supported && isSupportingVP9VTB()) {
     
    660660#if PLATFORM(COCOA)
    661661        auto containerType = contentType.containerType();
    662         if (equalIgnoringASCIICase(containerType, "video/vp8") || equalIgnoringASCIICase(containerType, "video/vp9")) {
     662        if (equalLettersIgnoringASCIICase(containerType, "video/vp8") || equalLettersIgnoringASCIICase(containerType, "video/vp9")) {
    663663            info.powerEfficient = false;
    664664            // FIXME: Provide more granular VPX encoder smoothness.
  • trunk/Source/WebCore/platform/network/curl/CookieUtil.cpp

    r292857 r293309  
    103103        attributeName = attribute.stripWhiteSpace();
    104104
    105     if (equalIgnoringASCIICase(attributeName, "httponly"))
     105    if (equalLettersIgnoringASCIICase(attributeName, "httponly"))
    106106        result.httpOnly = true;
    107     else if (equalIgnoringASCIICase(attributeName, "secure"))
     107    else if (equalLettersIgnoringASCIICase(attributeName, "secure"))
    108108        result.secure = true;
    109     else if (equalIgnoringASCIICase(attributeName, "domain")) {
     109    else if (equalLettersIgnoringASCIICase(attributeName, "domain")) {
    110110        if (attributeValue.isEmpty())
    111111            return;
     
    117117        result.domain = attributeValue.convertToASCIILowercase();
    118118
    119     } else if (equalIgnoringASCIICase(attributeName, "max-age")) {
     119    } else if (equalLettersIgnoringASCIICase(attributeName, "max-age")) {
    120120        if (auto maxAgeSeconds = parseIntegerAllowingTrailingJunk<int64_t>(attributeValue)) {
    121121            result.expires = (WallTime::now().secondsSinceEpoch().value() + *maxAgeSeconds) * msPerSecond;
     
    129129            result.expires = std::nullopt;
    130130        }
    131     } else if (equalIgnoringASCIICase(attributeName, "expires") && !hasMaxAge) {
     131    } else if (equalLettersIgnoringASCIICase(attributeName, "expires") && !hasMaxAge) {
    132132        if (auto expiryTime = parseExpiresMS(attributeValue.utf8().data())) {
    133133            result.expires = expiryTime.value();
     
    137137            result.expires = std::nullopt;
    138138        }
    139     } else if (equalIgnoringASCIICase(attributeName, "path")) {
     139    } else if (equalLettersIgnoringASCIICase(attributeName, "path")) {
    140140        if (!attributeValue.isEmpty() && attributeValue.startsWith('/'))
    141141            result.path = attributeValue;
  • trunk/Source/WebCore/platform/network/curl/CurlMultipartHandle.cpp

    r291800 r293309  
    6363        auto contentType = header.substring(splitPosition + 1).stripWhiteSpace();
    6464        auto mimeType = extractMIMETypeFromMediaType(contentType);
    65         if (!equalIgnoringASCIICase(mimeType, "multipart/x-mixed-replace"))
     65        if (!equalLettersIgnoringASCIICase(mimeType, "multipart/x-mixed-replace"))
    6666            continue;
    6767
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r292268 r293309  
    25922592{
    25932593    if (!attachmentType.isEmpty()) {
    2594         if (equalIgnoringASCIICase(attachmentType, "multipart/x-folder") || equalIgnoringASCIICase(attachmentType, "application/vnd.apple.folder")) {
     2594        if (equalLettersIgnoringASCIICase(attachmentType, "multipart/x-folder") || equalLettersIgnoringASCIICase(attachmentType, "application/vnd.apple.folder")) {
    25952595ALLOW_DEPRECATED_DECLARATIONS_BEGIN
    25962596            auto type = kUTTypeFolder;
  • trunk/Source/WebCore/svg/SVGAElement.cpp

    r290326 r293309  
    229229        m_relList = makeUnique<DOMTokenList>(*this, SVGNames::relAttr, [](Document&, StringView token) {
    230230#if USE(SYSTEM_PREVIEW)
    231             if (equalIgnoringASCIICase(token, "ar"))
     231            if (equalLettersIgnoringASCIICase(token, "ar"))
    232232                return true;
    233233#endif
    234             return equalIgnoringASCIICase(token, "noreferrer") || equalIgnoringASCIICase(token, "noopener");
     234            return equalLettersIgnoringASCIICase(token, "noreferrer") || equalLettersIgnoringASCIICase(token, "noopener");
    235235        });
    236236    }
  • trunk/Source/WebCore/testing/MockCDMFactory.cpp

    r290470 r293309  
    6161bool MockCDMFactory::supportsKeySystem(const String& keySystem)
    6262{
    63     return equalIgnoringASCIICase(keySystem, "org.webkit.mock");
     63    return equalLettersIgnoringASCIICase(keySystem, "org.webkit.mock");
    6464}
    6565
     
    275275    StringView certificateStringView(certificate->makeContiguous()->data(), certificate->size());
    276276
    277     callback(equalIgnoringASCIICase(certificateStringView, "valid") ? Succeeded : Failed);
     277    callback(equalLettersIgnoringASCIICase(certificateStringView, "valid") ? Succeeded : Failed);
    278278}
    279279
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r293296 r293309  
    13461346            session->networkLoadScheduler().finishedPreconnectForMainResource(url, userAgent, error);
    13471347#if ENABLE(ADDITIONAL_PRECONNECT_ON_HTTP_1X)
    1348             if (equalIgnoringASCIICase(metrics.protocol, "http/1.1")) {
     1348            if (equalLettersIgnoringASCIICase(metrics.protocol, "http/1.1")) {
    13491349                auto parameters = parametersForAdditionalPreconnect;
    13501350                auto task = new PreconnectTask(*session, WTFMove(parameters), [](const WebCore::ResourceError& error, const WebCore::NetworkLoadMetrics& metrics) { });
  • trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp

    r293056 r293309  
    767767
    768768    auto isMediaMIMEType = [] (const String& mimeType) {
    769         return mimeType.startsWithIgnoringASCIICase("audio/")
    770             || mimeType.startsWithIgnoringASCIICase("video/")
     769        return startsWithLettersIgnoringASCIICase(mimeType, "audio/")
     770            || startsWithLettersIgnoringASCIICase(mimeType, "video/")
    771771            || equalLettersIgnoringASCIICase(mimeType, "application/octet-stream");
    772772    };
Note: See TracChangeset for help on using the changeset viewer.