Reduce use of equalIgnoringCase to just ignore ASCII case
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jan 2016 17:17:04 +0000 (17:17 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Jan 2016 17:17:04 +0000 (17:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153266

Reviewed by Ryosuke Niwa.

Source/WebCore:

Changed many call sites that were using equalIgnoringCase to instead use
equalLettersIgnoringASCIICase. What these all have in common is that the
thing they are comparing with is a string literal that has all lowercase
letters, spaces, and a few simple examples of punctuation.

Not 100% sure that the new function name is just right, but it's a long name
so it's easy to change it with a global replace if we come up with a better one.

Or if we decide ther eis no need for the "letters" optimization, we can change
these all to just use equalIgnoringASCIICase, also with a global replace.

Also made a few tweaks to some code nearby and some includes.

* Modules/encryptedmedia/CDMPrivateClearKey.cpp:
(WebCore::CDMPrivateClearKey::supportsKeySystem): Use equalLettersIgnoringASCIICase.
(WebCore::CDMPrivateClearKey::supportsKeySystemAndMimeType): Ditto.
* Modules/encryptedmedia/CDMSessionClearKey.cpp:
(WebCore::CDMSessionClearKey::update): Ditto.
* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::YouTubePluginReplacement::supportsMimeType): Ditto.
(WebCore::YouTubePluginReplacement::supportsFileExtension): Ditto.
* Modules/webdatabase/DatabaseAuthorizer.cpp:
(WebCore::DatabaseAuthorizer::createVTable): Ditto.
(WebCore::DatabaseAuthorizer::dropVTable): Ditto.
* Modules/websockets/WebSocketHandshake.cpp:
(WebCore::WebSocketHandshake::readHTTPHeaders): Ditto.
(WebCore::WebSocketHandshake::checkResponseHeaders): Ditto.
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::findAriaModalNodes): Ditto.
(WebCore::AXObjectCache::handleMenuItemSelected): Ditto.
(WebCore::AXObjectCache::handleAriaModalChange): Ditto.
(WebCore::isNodeAriaVisible): Ditto.
* accessibility/AccessibilityListBoxOption.cpp:
(WebCore::AccessibilityListBoxOption::isEnabled): Ditto.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::determineAccessibilityRole): Use isColorControl
instead of checking the typeAttr of the HTMLInputElement directly.
(WebCore::AccessibilityNodeObject::isEnabled): Use equalLettersIgnoringASCIICase.
(WebCore::AccessibilityNodeObject::isPressed): Ditto.
(WebCore::AccessibilityNodeObject::isChecked): Ditto.
(WebCore::AccessibilityNodeObject::isMultiSelectable): Ditto.
(WebCore::AccessibilityNodeObject::isRequired): Ditto.
(WebCore::shouldUseAccessibilityObjectInnerText): Ditto.
(WebCore::AccessibilityNodeObject::colorValue): Ditto.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::contentEditableAttributeIsEnabled):
Use equalLettersIgnoringASCIICase.
(WebCore::AccessibilityObject::ariaIsMultiline): Ditto.
(WebCore::AccessibilityObject::liveRegionStatusIsEnabled): Ditto.
(WebCore::AccessibilityObject::sortDirection): Ditto.
(WebCore::AccessibilityObject::supportsARIAPressed): Ditto.
(WebCore::AccessibilityObject::supportsExpanded): Ditto.
(WebCore::AccessibilityObject::isExpanded): Ditto.
(WebCore::AccessibilityObject::checkboxOrRadioValue): Ditto.
(WebCore::AccessibilityObject::isARIAHidden): Ditto.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::supportsARIADragging): Ditto.
(WebCore::AccessibilityRenderObject::defaultObjectInclusion): Ditto.
(WebCore::AccessibilityRenderObject::elementAttributeValue): Ditto.
(WebCore::AccessibilityRenderObject::isSelected): Ditto.
(WebCore::AccessibilityRenderObject::determineAccessibilityRole): Ditto.
(WebCore::AccessibilityRenderObject::orientation): Ditto.
(WebCore::AccessibilityRenderObject::canSetExpandedAttribute): Ditto.
(WebCore::AccessibilityRenderObject::canSetValueAttribute): Ditto.
(WebCore::AccessibilityRenderObject::ariaLiveRegionAtomic): Ditto.

* accessibility/AccessibilityTableCell.cpp:
(WebCore::AccessibilityTableCell::ariaRowSpan): Use == to compare a string
with "0" since there is no need to "ignore case" when there are no letters.

* css/CSSCalculationValue.cpp:
(WebCore::CSSCalcValue::create): Use equalLettersIgnoringASCIICase.

* css/CSSCalculationValue.h: Removed unneeded include of CSSParserValues.h.
* css/CSSCustomPropertyValue.h: Ditto.

* css/CSSFontFaceSrcValue.cpp:
(WebCore::CSSFontFaceSrcValue::isSVGFontFaceSrc): Use equalLettersIgnoringASCIICase.

* css/CSSGrammar.y.in: Use equalLettersIgnoringASCIICase. Also restructured the code
a bit to have more normal formatting and reordered it slightly.

* css/CSSParser.cpp:
(WebCore::equal): Deleted.
(WebCore::equalIgnoringCase): Deleted.
(WebCore::equalLettersIgnoringASCIICase): Added. Replaces function templates named
equal and equalIgnoringCase that are no longer used.
(WebCore::CSSParser::parseValue): Use equalLettersIgnoringASCIICase.
(WebCore::CSSParser::parseNonElementSnapPoints): Ditto.
(WebCore::CSSParser::parseAlt): Ditto.
(WebCore::CSSParser::parseContent): Ditto.
(WebCore::CSSParser::parseFillImage): Ditto.
(WebCore::CSSParser::parseAnimationName): Ditto.
(WebCore::CSSParser::parseAnimationTrigger): Ditto.
(WebCore::CSSParser::parseAnimationProperty): Ditto.
(WebCore::CSSParser::parseKeyframeSelector): Ditto.
(WebCore::CSSParser::parseAnimationTimingFunction): Ditto.
(WebCore::CSSParser::parseGridTrackList): Ditto.
(WebCore::CSSParser::parseGridTrackSize): Ditto.
(WebCore::CSSParser::parseDashboardRegions): Ditto.
(WebCore::CSSParser::parseClipShape): Ditto.
(WebCore::CSSParser::parseBasicShapeInset): Ditto.
(WebCore::CSSParser::parseBasicShape): Ditto.
(WebCore::CSSParser::parseFontFaceSrcURI): Ditto.
(WebCore::CSSParser::parseFontFaceSrc): Ditto.
(WebCore::CSSParser::isCalculation): Ditto.
(WebCore::CSSParser::parseColorFromValue): Ditto.
(WebCore::CSSParser::parseBorderImage): Ditto.
(WebCore::parseDeprecatedGradientPoint): Ditto.
(WebCore::parseDeprecatedGradientColorStop): Ditto.
(WebCore::CSSParser::parseDeprecatedGradient): Ditto.
(WebCore::CSSParser::parseLinearGradient): Ditto.
(WebCore::CSSParser::parseRadialGradient): Ditto.
(WebCore::CSSParser::isGeneratedImageValue): Ditto.
(WebCore::CSSParser::parseGeneratedImage): Ditto.
(WebCore::filterInfoForName): Ditto.
(WebCore::validFlowName): Ditto.
(WebCore::CSSParser::realLex): Ditto.
(WebCore::isValidNthToken): Ditto.
* css/CSSParserValues.cpp:
(WebCore::CSSParserSelector::parsePagePseudoSelector): Ditto.

* css/CSSParserValues.h:
(WebCore::equalLettersIgnoringASCIICase): Added.

* css/CSSVariableDependentValue.h: Removed unneeded include of CSSParserValues.h.

* css/MediaList.cpp:
(WebCore::reportMediaQueryWarningIfNeeded): Use equalLettersIgnoringASCIICase.
* css/MediaQueryEvaluator.cpp:
(WebCore::MediaQueryEvaluator::mediaTypeMatch): Ditto.
(WebCore::MediaQueryEvaluator::mediaTypeMatchSpecific): Ditto.
(WebCore::evalResolution): Ditto.

* css/SelectorPseudoTypeMap.h: Removed unneeded include of CSSParserValues.h.

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertTouchCallout): Use equalLettersIgnoringASCIICase.

* css/makeSelectorPseudoClassAndCompatibilityElementMap.py: Added an include of
CSSParserValues.h since it's no longer included by SelectorPseudoTypeMap.h.

* dom/Document.cpp:
(WebCore::setParserFeature): Use equalLettersIgnoringASCIICase.
(WebCore::Document::processReferrerPolicy): Ditto.
(WebCore::Document::createEvent): Ditto.
(WebCore::Document::parseDNSPrefetchControlHeader): Ditto.

* dom/Element.cpp:
(WebCore::Element::spellcheckAttributeState): Use isNull instead of doing
checking equality with nullAtom. Use isEmpty instead of equalIgnoringCase("").
Use equalLettersIgnoringASCIICase.
(WebCore::Element::canContainRangeEndPoint): Ditto.

* dom/InlineStyleSheetOwner.cpp:
(WebCore::isValidCSSContentType): Use equalLettersIgnoringASCIICase.
Added comment about peculiar behavior where we do case-sensitive processing of
the MIME type if the document is XML.

* dom/ScriptElement.cpp:
(WebCore::ScriptElement::requestScript): Use equalLettersIgnoringASCIICase.
(WebCore::ScriptElement::isScriptForEventSupported): Ditto.
* dom/SecurityContext.cpp:
(WebCore::SecurityContext::parseSandboxPolicy): Ditto.
* dom/ViewportArguments.cpp:
(WebCore::findSizeValue): Ditto.
(WebCore::findScaleValue): Ditto.
(WebCore::findBooleanValue): Ditto.

* editing/EditorCommand.cpp:
(WebCore::executeDefaultParagraphSeparator): Use equalLettersIgnoringASCIICase.
(WebCore::executeInsertBacktab): Use ASCIILiteral.
(WebCore::executeInsertHTML): Use emptyString.
(WebCore::executeInsertLineBreak): Use ASCIILiteral.
(WebCore::executeInsertNewline): Ditto.
(WebCore::executeInsertTab): Ditto.
(WebCore::executeJustifyCenter): Ditto.
(WebCore::executeJustifyFull): Ditto.
(WebCore::executeJustifyLeft): Ditto.
(WebCore::executeJustifyRight): Ditto.
(WebCore::executeStrikethrough): Ditto.
(WebCore::executeStyleWithCSS): Use equalLettersIgnoringASCIICase.
(WebCore::executeUseCSS): Ditto.
(WebCore::executeSubscript): Use ASCIILiteral.
(WebCore::executeSuperscript): Ditto.
(WebCore::executeToggleBold): Ditto.
(WebCore::executeToggleItalic): Ditto.
(WebCore::executeUnderline): Ditto.
(WebCore::executeUnscript): Ditto.
(WebCore::stateBold): Ditto.
(WebCore::stateItalic): Ditto.
(WebCore::stateStrikethrough): Ditto.
(WebCore::stateSubscript): Ditto.
(WebCore::stateSuperscript): Ditto.
(WebCore::stateUnderline): Ditto.
(WebCore::stateJustifyCenter): Ditto.
(WebCore::stateJustifyFull): Ditto.
(WebCore::stateJustifyLeft): Ditto.
(WebCore::stateJustifyRight): Ditto.
(WebCore::valueFormatBlock): Use emptyString.
(WebCore::Editor::Command::value): Use ASCIILiteral.

* editing/TextIterator.cpp:
(WebCore::isRendererReplacedElement): Use equalLettersIgnoringASCIICase.

* fileapi/Blob.cpp:
(WebCore::Blob::isNormalizedContentType): Use isASCIIUpper.

* history/HistoryItem.cpp:
(WebCore::HistoryItem::setFormInfoFromRequest): Use equalLettersIgnoringASCIICase.

* html/Autocapitalize.cpp:
(WebCore::valueOn): Deleted.
(WebCore::valueOff): Deleted.
(WebCore::valueNone): Deleted.
(WebCore::valueWords): Deleted.
(WebCore::valueSentences): Deleted.
(WebCore::valueAllCharacters): Deleted.
(WebCore::autocapitalizeTypeForAttributeValue): Use equalLettersIgnoringASCIICase.
(WebCore::stringForAutocapitalizeType): Put the AtomicString globals right in the
switch statement instead of in separate functions.

* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::draggable): Use equalLettersIgnoringASCIICase.
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::parseAttribute): Ditto.
* html/HTMLBRElement.cpp:
(WebCore::HTMLBRElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::parseAttribute): Ditto.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toDataURL): Use ASCIILiteral.

* html/HTMLDivElement.cpp:
(WebCore::HTMLDivElement::collectStyleForPresentationAttribute):
Use equalLettersIgnoringASCIICase.

* html/HTMLDocument.cpp:
(WebCore::HTMLDocument::designMode): Use ASCIILiteral.
(WebCore::HTMLDocument::setDesignMode): Use equalLettersIgnoringASCIICase.

* html/HTMLElement.cpp:
(WebCore::HTMLElement::nodeName): Updated comment.
(WebCore::isLTROrRTLIgnoringCase): Use equalLettersIgnoringASCIICase.
(WebCore::contentEditableType): Ditto.
(WebCore::HTMLElement::collectStyleForPresentationAttribute): Ditto.
(WebCore::toValidDirValue): Ditto.
(WebCore::HTMLElement::insertAdjacent): Ditto.
(WebCore::contextElementForInsertion): Ditto.
(WebCore::HTMLElement::applyAlignmentAttributeToStyle): Ditto.
(WebCore::HTMLElement::setContentEditable): Ditto.
(WebCore::HTMLElement::draggable): Ditto.
(WebCore::HTMLElement::translateAttributeMode): Ditto.
(WebCore::HTMLElement::hasDirectionAuto): Ditto.
(WebCore::HTMLElement::directionality): Ditto.
(WebCore::HTMLElement::dirAttributeChanged): Ditto.
(WebCore::HTMLElement::addHTMLColorToStyle): Ditto.
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::autocorrect): Ditto.
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::autocorrect): Ditto.
(WebCore::HTMLFormElement::shouldAutocomplete): Ditto.
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::parseAttribute): Ditto.

* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::parseAttribute): Use equalLettersIgnoringASCIICase.
Use == when comparing with "0" and "1" since there is no need for case folding.

* html/HTMLHRElement.cpp:
(WebCore::HTMLHRElement::collectStyleForPresentationAttribute):
Use equalLettersIgnoringASCIICase.
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::draggable): Ditto.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute): Ditto.
* html/HTMLKeygenElement.cpp:
(WebCore::HTMLKeygenElement::appendFormData): Ditto.
* html/HTMLMarqueeElement.cpp:
(WebCore::HTMLMarqueeElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute): Ditto.
* html/HTMLMetaElement.cpp:
(WebCore::HTMLMetaElement::process): Ditto.

* html/HTMLObjectElement.cpp:
(WebCore::mapDataParamToSrc): Use references, modern for loops, simplify
logic to not use array indices, use ASCIILiteral and equalLettersIgnoringASCIICase.
(WebCore::HTMLObjectElement::parametersForPlugin): Update to call new function.
(WebCore::HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk): Use equalLettersIgnoringASCIICase.
(WebCore::HTMLObjectElement::containsJavaApplet): Ditto.
* html/HTMLParagraphElement.cpp:
(WebCore::HTMLParagraphElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLParamElement.cpp:
(WebCore::HTMLParamElement::isURLParameter): Ditto.
* html/HTMLTableElement.cpp:
(WebCore::getBordersFromFrameAttributeValue): Ditto.
(WebCore::HTMLTableElement::collectStyleForPresentationAttribute): Ditto.
(WebCore::HTMLTableElement::parseAttribute): Ditto.
* html/HTMLTablePartElement.cpp:
(WebCore::HTMLTablePartElement::collectStyleForPresentationAttribute): Ditto.
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::parseAttribute): Ditto.
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::setRangeText): Ditto.
(WebCore::HTMLTextFormControlElement::directionForFormData): Ditto.
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::parseAttribute): Ditto.
* html/InputType.cpp:
(WebCore::InputType::applyStep): Ditto.
* html/LinkRelAttribute.cpp:
(WebCore::LinkRelAttribute::LinkRelAttribute): Ditto.
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::wirelessVideoPlaybackDisabled): Ditto.
* html/NumberInputType.cpp:
(WebCore::NumberInputType::sizeShouldIncludeDecoration): Ditto.
* html/RangeInputType.cpp:
(WebCore::RangeInputType::createStepRange): Ditto.
(WebCore::RangeInputType::handleKeydownEvent): Ditto.
* html/StepRange.cpp:
(WebCore::StepRange::parseStep): Ditto.
* html/canvas/CanvasStyle.cpp:
(WebCore::parseColor): Ditto.
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::setCompatibilityModeFromDoctype): Ditto.
* html/parser/HTMLElementStack.cpp:
(WebCore::HTMLElementStack::isHTMLIntegrationPoint): Ditto.
* html/parser/HTMLMetaCharsetParser.cpp:
(WebCore::HTMLMetaCharsetParser::encodingFromMetaAttributes): Ditto.
* html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Ditto.
(WebCore::TokenPreloadScanner::StartTagScanner::crossOriginModeAllowsCookies): Ditto.
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTagForInBody): Ditto.
(WebCore::HTMLTreeBuilder::processStartTagForInTable): Ditto.
* html/parser/XSSAuditor.cpp:
(WebCore::isDangerousHTTPEquiv): Ditto.

* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::hasRequiredFileIdentifier): Removed unneeded special case
for empty string.

* inspector/InspectorPageAgent.cpp:
(WebCore::createXHRTextDecoder): Use equalLettersIgnoringASCIICase.
* inspector/NetworkResourcesData.cpp:
(WebCore::createOtherResourceTextDecoder): Ditto.
* loader/CrossOriginAccessControl.cpp:
(WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Ditto.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::continueAfterContentPolicy): Ditto.
* loader/FormSubmission.cpp:
(WebCore::appendMailtoPostFormDataToURL): Ditto.
(WebCore::FormSubmission::Attributes::parseEncodingType): Ditto.
(WebCore::FormSubmission::Attributes::parseMethodType): Ditto.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::shouldPerformFragmentNavigation): Ditto.
(WebCore::FrameLoader::shouldTreatURLAsSrcdocDocument): Ditto.
* loader/ImageLoader.cpp:
(WebCore::ImageLoader::updateFromElement): Ditto.
* loader/MediaResourceLoader.cpp:
(WebCore::MediaResourceLoader::start): Ditto.
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::createJavaAppletWidget): Ditto.
* loader/TextResourceDecoder.cpp:
(WebCore::TextResourceDecoder::determineContentType): Ditto.
* loader/TextTrackLoader.cpp:
(WebCore::TextTrackLoader::load): Ditto.
* loader/appcache/ApplicationCache.cpp:
(WebCore::ApplicationCache::requestIsHTTPOrHTTPSGet): Ditto.
* loader/cache/CachedCSSStyleSheet.cpp:
(WebCore::CachedCSSStyleSheet::canUseSheet): Ditto.
* loader/cache/CachedResource.cpp:
(WebCore::shouldCacheSchemeIndefinitely): Ditto.
* page/DOMSelection.cpp:
(WebCore::DOMSelection::modify): Ditto.
* page/EventSource.cpp:
(WebCore::EventSource::didReceiveResponse): Ditto.
* page/FrameView.cpp:
(WebCore::FrameView::scrollToAnchor): Ditto.
* page/Performance.cpp:
(WebCore::Performance::webkitGetEntriesByType): Ditto.
* page/PerformanceResourceTiming.cpp:
(WebCore::passesTimingAllowCheck): Ditto.

* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::SecurityOrigin): Use emptyString.
(WebCore::SecurityOrigin::toString): Use ASCIILiteral.
(WebCore::SecurityOrigin::databaseIdentifier): Ditto.

* page/UserContentURLPattern.cpp:
(WebCore::UserContentURLPattern::parse): Use equalLettersIgnoringASCIICase.
(WebCore::UserContentURLPattern::matches): Ditto.
* platform/URL.cpp:
(WebCore::URL::protocolIs): Ditto.

* platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
(WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType):
Changed to use early exit and equalLettersIgnoringASCIICase. Added comment
about inconsistency with next function.
(WebCore::CDMPrivateMediaSourceAVFObjC::supportsMIMEType): Added comment
about inconsistency with previous function.

* platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
(WebCore::CDMSessionAVContentKeySession::generateKeyRequest):
Use equalLettersIgnoringASCIICase.
* platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
(WebCore::CDMSessionAVStreamSession::generateKeyRequest): Ditto.
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::utiFromMIMEType): Ditto.

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontCache::similarFont): Changed to not use so many global
variables and use equalLettersIgnoringASCIICase.
* platform/graphics/ios/FontCacheIOS.mm:
(WebCore::platformFontWithFamilySpecialCase): Ditto.

* platform/graphics/mac/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::supportsFormat): Use equalLettersIgnoringASCIICase.
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::readString): Ditto.
* platform/network/BlobResourceHandle.cpp:
(WebCore::BlobResourceHandle::createAsync): Ditto.
(WebCore::BlobResourceHandle::loadResourceSynchronously): Ditto.
* platform/network/CacheValidation.cpp:
(WebCore::parseCacheControlDirectives): Ditto.
* platform/network/FormData.h:
(WebCore::FormData::parseEncodingType): Ditto.
* platform/network/HTTPParsers.cpp:
(WebCore::contentDispositionType): Ditto.
(WebCore::parseXFrameOptionsHeader): Ditto.

* platform/network/ResourceResponseBase.cpp:
(WebCore::ResourceResponseBase::isHTTP): Use protocolIsInHTTPFamily, which is
both clearer and more efficient.
(WebCore::ResourceResponseBase::isAttachment): Rewrite to be a bit more terse
and use equalLettersIgnoringASCIICase.

* platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegate::createResourceRequest):
Use equalLettersIgnoringASCIICase.
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::willSendRequest): Ditto.
* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::open): Ditto.
* platform/sql/SQLiteStatement.cpp:
(WebCore::SQLiteStatement::isColumnDeclaredAsBlob): Ditto.

* platform/text/TextEncodingRegistry.cpp:
(WebCore::defaultTextEncodingNameForSystemLanguage): Use ASCIILiteral
and equalLettersIgnoringASCIICase.

* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::updateFromElement): Use equalLettersIgnoringASCIICase.
* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::compareCodepointsLexicographically): Ditto.
(WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Ditto.
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setEditingBehavior): Ditto.
(WebCore::InternalSettings::setShouldDisplayTrackKind): Ditto.
(WebCore::InternalSettings::shouldDisplayTrackKind): Ditto.
* testing/Internals.cpp:
(WebCore::markerTypeFrom): Ditto.
(WebCore::markerTypesFrom): Ditto.
(WebCore::Internals::mediaElementHasCharacteristic): Ditto.
(WebCore::Internals::setCaptionDisplayMode): Ditto.
(WebCore::Internals::beginMediaSessionInterruption): Ditto.
(WebCore::Internals::endMediaSessionInterruption): Ditto.
(WebCore::Internals::setMediaSessionRestrictions): Ditto.
(WebCore::Internals::setMediaElementRestrictions): Ditto.
(WebCore::Internals::postRemoteControlCommand): Ditto.
(WebCore::Internals::setAudioContextRestrictions): Ditto.
(WebCore::Internals::setMockMediaPlaybackTargetPickerState): Ditto.
* testing/MockCDM.cpp:
(WebCore::MockCDM::supportsKeySystem): Ditto.
(WebCore::MockCDM::supportsKeySystemAndMimeType): Ditto.
(WebCore::MockCDM::supportsMIMEType): Ditto.
* xml/XMLHttpRequest.cpp:
(WebCore::isSetCookieHeader): Ditto.
(WebCore::XMLHttpRequest::responseXML): Ditto.
(WebCore::XMLHttpRequest::isAllowedHTTPMethod): Ditto.
(WebCore::XMLHttpRequest::didReceiveData): Ditto.

Source/WebKit:

* Storage/StorageTracker.cpp:
(WebCore::StorageTracker::syncFileSystemAndTrackerDatabase):
Removed extraneous unneeded ", true" in call to String::endsWith.
Preparation for later removing the boolean argument.

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::createPlugin): Use equalLettersIgnoringASCIICase.

Source/WebKit2:

* UIProcess/PageLoadState.cpp:
(WebKit::PageLoadState::hasOnlySecureContent): Use the protocolIs
function from WebCore instead of calling startsWith.
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::initialize): Use equalLettersIgnoringASCIICase.

Source/WTF:

* wtf/ASCIICType.h:
(WTF::isASCIIAlphaCaselessEqual): Loosened the assertion in this function
so it can work with ASCII spaces, numeric digits, and some punctuation.
Commented that we might want to change its name later.

* wtf/Assertions.cpp:
(WTFInitializeLogChannelStatesFromString): Use equalLettersIgnoringASCIICase.

* wtf/text/AtomicString.h:
(WTF::equalLettersIgnoringASCIICase): Added. Calls the version that takes a String.

* wtf/text/StringCommon.h:
(WTF::equalLettersIgnoringASCIICase): Added. Takes a pointer to characters.
(WTF::equalLettersIgnoringASCIICaseCommonWithoutLength): Added.
(WTF::equalLettersIgnoringASCIICaseCommon): Added.

* wtf/text/StringImpl.h:
(WTF::equalLettersIgnoringASCIICase): Added. Calls equalLettersIgnoringASCIICaseCommon.

* wtf/text/StringView.h:
(WTF::equalLettersIgnoringASCIICase): Added. Calls equalLettersIgnoringASCIICaseCommon.

* wtf/text/WTFString.h: Reordered/reformatted a little.
(WTF::equalIgnoringASCIICase): Added. Calls the version that takes a StringImpl.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195452 268f45cc-cd09-0410-ab3c-d52691b4dbfc

142 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/ASCIICType.h
Source/WTF/wtf/Assertions.cpp
Source/WTF/wtf/text/AtomicString.h
Source/WTF/wtf/text/StringCommon.h
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/StringView.h
Source/WTF/wtf/text/WTFString.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/CDMPrivateClearKey.cpp
Source/WebCore/Modules/encryptedmedia/CDMSessionClearKey.cpp
Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp
Source/WebCore/Modules/webdatabase/DatabaseAuthorizer.cpp
Source/WebCore/Modules/websockets/WebSocketHandshake.cpp
Source/WebCore/accessibility/AXObjectCache.cpp
Source/WebCore/accessibility/AccessibilityListBoxOption.cpp
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityTableCell.cpp
Source/WebCore/css/CSSCalculationValue.cpp
Source/WebCore/css/CSSCalculationValue.h
Source/WebCore/css/CSSCustomPropertyValue.h
Source/WebCore/css/CSSFontFaceSrcValue.cpp
Source/WebCore/css/CSSGrammar.y.in
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSParserValues.cpp
Source/WebCore/css/CSSParserValues.h
Source/WebCore/css/CSSVariableDependentValue.h
Source/WebCore/css/MediaList.cpp
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/css/SelectorPseudoTypeMap.h
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/makeSelectorPseudoClassAndCompatibilityElementMap.py
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/InlineStyleSheetOwner.cpp
Source/WebCore/dom/ScriptElement.cpp
Source/WebCore/dom/SecurityContext.cpp
Source/WebCore/dom/ViewportArguments.cpp
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/editing/TextIterator.cpp
Source/WebCore/fileapi/Blob.cpp
Source/WebCore/history/HistoryItem.cpp
Source/WebCore/html/Autocapitalize.cpp
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/html/HTMLAreaElement.cpp
Source/WebCore/html/HTMLBRElement.cpp
Source/WebCore/html/HTMLBodyElement.cpp
Source/WebCore/html/HTMLButtonElement.cpp
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/HTMLDivElement.cpp
Source/WebCore/html/HTMLDocument.cpp
Source/WebCore/html/HTMLElement.cpp
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFrameElementBase.cpp
Source/WebCore/html/HTMLFrameSetElement.cpp
Source/WebCore/html/HTMLHRElement.cpp
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLKeygenElement.cpp
Source/WebCore/html/HTMLMarqueeElement.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLMetaElement.cpp
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/html/HTMLParagraphElement.cpp
Source/WebCore/html/HTMLParamElement.cpp
Source/WebCore/html/HTMLTableElement.cpp
Source/WebCore/html/HTMLTablePartElement.cpp
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextFormControlElement.cpp
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/html/InputType.cpp
Source/WebCore/html/LinkRelAttribute.cpp
Source/WebCore/html/MediaElementSession.cpp
Source/WebCore/html/NumberInputType.cpp
Source/WebCore/html/RangeInputType.cpp
Source/WebCore/html/StepRange.cpp
Source/WebCore/html/canvas/CanvasStyle.cpp
Source/WebCore/html/parser/HTMLConstructionSite.cpp
Source/WebCore/html/parser/HTMLElementStack.cpp
Source/WebCore/html/parser/HTMLMetaCharsetParser.cpp
Source/WebCore/html/parser/HTMLPreloadScanner.cpp
Source/WebCore/html/parser/HTMLTreeBuilder.cpp
Source/WebCore/html/parser/XSSAuditor.cpp
Source/WebCore/html/track/WebVTTParser.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/inspector/NetworkResourcesData.cpp
Source/WebCore/loader/CrossOriginAccessControl.cpp
Source/WebCore/loader/DocumentLoader.cpp
Source/WebCore/loader/FormSubmission.cpp
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/ImageLoader.cpp
Source/WebCore/loader/MediaResourceLoader.cpp
Source/WebCore/loader/SubframeLoader.cpp
Source/WebCore/loader/TextResourceDecoder.cpp
Source/WebCore/loader/TextTrackLoader.cpp
Source/WebCore/loader/appcache/ApplicationCache.cpp
Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp
Source/WebCore/loader/cache/CachedResource.cpp
Source/WebCore/page/DOMSelection.cpp
Source/WebCore/page/EventSource.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/Performance.cpp
Source/WebCore/page/PerformanceResourceTiming.cpp
Source/WebCore/page/SecurityOrigin.cpp
Source/WebCore/page/UserContentURLPattern.cpp
Source/WebCore/platform/URL.cpp
Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/graphics/ios/FontCacheIOS.mm
Source/WebCore/platform/graphics/mac/FontCacheMac.mm
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
Source/WebCore/platform/mac/PasteboardMac.mm
Source/WebCore/platform/network/BlobResourceHandle.cpp
Source/WebCore/platform/network/CacheValidation.cpp
Source/WebCore/platform/network/FormData.h
Source/WebCore/platform/network/HTTPParsers.cpp
Source/WebCore/platform/network/ResourceResponseBase.cpp
Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/sql/SQLiteDatabase.cpp
Source/WebCore/platform/sql/SQLiteStatement.cpp
Source/WebCore/platform/text/TextEncodingRegistry.cpp
Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
Source/WebCore/svg/SVGToOTFFontConversion.cpp
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/MockCDM.cpp
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebKit/ChangeLog
Source/WebKit/Storage/StorageTracker.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/PageLoadState.cpp
Source/WebKit2/WebProcess/Plugins/Netscape/NetscapePlugin.cpp

index 42a7c1f..5261fbf 100644 (file)
@@ -1,3 +1,35 @@
+2016-01-22  Darin Adler  <darin@apple.com>
+
+        Reduce use of equalIgnoringCase to just ignore ASCII case
+        https://bugs.webkit.org/show_bug.cgi?id=153266
+
+        Reviewed by Ryosuke Niwa.
+
+        * wtf/ASCIICType.h:
+        (WTF::isASCIIAlphaCaselessEqual): Loosened the assertion in this function
+        so it can work with ASCII spaces, numeric digits, and some punctuation.
+        Commented that we might want to change its name later.
+
+        * wtf/Assertions.cpp:
+        (WTFInitializeLogChannelStatesFromString): Use equalLettersIgnoringASCIICase.
+
+        * wtf/text/AtomicString.h:
+        (WTF::equalLettersIgnoringASCIICase): Added. Calls the version that takes a String.
+
+        * wtf/text/StringCommon.h:
+        (WTF::equalLettersIgnoringASCIICase): Added. Takes a pointer to characters.
+        (WTF::equalLettersIgnoringASCIICaseCommonWithoutLength): Added.
+        (WTF::equalLettersIgnoringASCIICaseCommon): Added.
+
+        * wtf/text/StringImpl.h:
+        (WTF::equalLettersIgnoringASCIICase): Added. Calls equalLettersIgnoringASCIICaseCommon.
+
+        * wtf/text/StringView.h:
+        (WTF::equalLettersIgnoringASCIICase): Added. Calls equalLettersIgnoringASCIICaseCommon.
+
+        * wtf/text/WTFString.h: Reordered/reformatted a little.
+        (WTF::equalIgnoringASCIICase): Added. Calls the version that takes a StringImpl.
+
 2016-01-22  Csaba Osztrogon├íc  <ossy@webkit.org>
 
         Buildfix for older GCCs after r195142
index b76c40b..8a2e7a4 100644 (file)
@@ -189,7 +189,18 @@ inline char upperNibbleToASCIIHexDigit(uint8_t value)
 
 template<typename CharacterType> inline bool isASCIIAlphaCaselessEqual(CharacterType inputCharacter, char expectedASCIILowercaseLetter)
 {
-    ASSERT(isASCIILower(expectedASCIILowercaseLetter));
+    // Name of this argument says this must be a lowercase letter, but it can actually be:
+    //   - a lowercase letter
+    //   - a numeric digit
+    //   - a space
+    //   - punctuation in the range 0x21-0x3F, including "-", "/", and "+"
+    // It cannot be:
+    //   - an uppercase letter
+    //   - a non-ASCII character
+    //   - other punctuation, such as underscore and backslash
+    //   - a control character such as "\n"
+    // FIXME: Would be nice to make both the function name and expectedASCIILowercaseLetter argument name clearer.
+    ASSERT(toASCIILowerUnchecked(expectedASCIILowercaseLetter) == expectedASCIILowercaseLetter);
     return LIKELY(toASCIILowerUnchecked(inputCharacter) == expectedASCIILowercaseLetter);
 }
 
index ddf8054..5613ea5 100644 (file)
@@ -489,7 +489,7 @@ void WTFInitializeLogChannelStatesFromString(WTFLogChannel* channels[], size_t c
             component = component.substring(1);
         }
 
-        if (equalIgnoringCase(component, "all")) {
+        if (equalLettersIgnoringASCIICase(component, "all")) {
             setStateOfAllChannels(channels, count, logChannelState);
             continue;
         }
index 7235efa..a2bc28e 100644 (file)
@@ -223,8 +223,7 @@ inline bool equalIgnoringASCIICase(const AtomicString& a, const AtomicString& b)
 inline bool equalIgnoringASCIICase(const AtomicString& a, const String& b) { return equalIgnoringASCIICase(a.impl(), b.impl()); }
 inline bool equalIgnoringASCIICase(const String& a, const AtomicString& b) { return equalIgnoringASCIICase(a.impl(), b.impl()); }
 
-template <unsigned charactersCount>
-inline bool equalIgnoringASCIICase(const AtomicString& a, const char (&b)[charactersCount]) { return equalIgnoringASCIICase<charactersCount>(a.impl(), b); }
+template<unsigned length> bool equalLettersIgnoringASCIICase(const AtomicString&, const char (&lowercaseLetters)[length]);
 
 inline AtomicString::AtomicString()
 {
@@ -336,6 +335,11 @@ template<> struct DefaultHash<AtomicString> {
     typedef AtomicStringHash Hash;
 };
 
+template<unsigned length> inline bool equalLettersIgnoringASCIICase(const AtomicString& string, const char (&lowercaseLetters)[length])
+{
+    return equalLettersIgnoringASCIICase(string.string(), lowercaseLetters);
+}
+
 } // namespace WTF
 
 #ifndef ATOMICSTRING_HIDE_GLOBALS
@@ -351,4 +355,5 @@ using WTF::xlinkAtom;
 #endif
 
 #include <wtf/text/StringConcatenate.h>
+
 #endif // AtomicString_h
index 73e0ebb..09f4e34 100644 (file)
@@ -31,6 +31,9 @@
 
 namespace WTF {
 
+template<typename CharacterType> bool equalLettersIgnoringASCIICase(const CharacterType*, const char* lowercaseLetters, unsigned length);
+template<typename StringClass, unsigned length> bool equalLettersIgnoringASCIICaseCommon(const StringClass&, const char (&lowercaseLetters)[length]);
+
 template<typename T>
 inline T loadUnaligned(const char* s)
 {
@@ -545,6 +548,42 @@ size_t findCommon(const StringClass& haystack, const StringClass& needle, unsign
     return findInner(haystack.characters16() + start, needle.characters16(), start, searchLength, needleLength);
 }
 
+// This is marked inline since it's mostly used in non-inline functions for each string type.
+// When used directly in code it's probably OK to be inline; maybe the loop will be unrolled.
+template<typename CharacterType> inline bool equalLettersIgnoringASCIICase(const CharacterType* characters, const char* lowercaseLetters, unsigned length)
+{
+    for (unsigned i = 0; i < length; ++i) {
+        if (!isASCIIAlphaCaselessEqual(characters[i], lowercaseLetters[i]))
+            return false;
+    }
+    return true;
 }
 
+// This is intentionally not marked inline because it's used often and is not speed-critical enough to want it inlined everywhere.
+template<typename StringClass> bool equalLettersIgnoringASCIICaseCommonWithoutLength(const StringClass& string, const char* lowercaseLetters)
+{
+#if !ASSERT_DISABLED
+    ASSERT(*lowercaseLetters);
+    for (const char* letter = lowercaseLetters; *letter; ++letter)
+        ASSERT(toASCIILowerUnchecked(*letter) == *letter);
+#endif
+    unsigned length = string.length();
+    if (length != strlen(lowercaseLetters))
+        return false;
+    if (string.is8Bit())
+        return equalLettersIgnoringASCIICase(string.characters8(), lowercaseLetters, length);
+    return equalLettersIgnoringASCIICase(string.characters16(), lowercaseLetters, length);
+}
+
+template<typename StringClass, unsigned length> inline bool equalLettersIgnoringASCIICaseCommon(const StringClass& string, const char (&lowercaseLetters)[length])
+{
+    // Don't actually use the length; we are choosing code size over speed.
+    const char* pointer = lowercaseLetters;
+    return equalLettersIgnoringASCIICaseCommonWithoutLength(string, pointer);
+}
+
+}
+
+using WTF::equalLettersIgnoringASCIICase;
+
 #endif // StringCommon_h
index 4242473..63e630b 100644 (file)
@@ -968,6 +968,9 @@ bool equalIgnoringASCIICase(const StringImpl* a, const char (&b)[charactersCount
     return a ? equalIgnoringASCIICase(*a, b, charactersCount - 1) : false;
 }
 
+template<unsigned length> bool equalLettersIgnoringASCIICase(const StringImpl&, const char (&lowercaseLetters)[length]);
+template<unsigned length> bool equalLettersIgnoringASCIICase(const StringImpl*, const char (&lowercaseLetters)[length]);
+
 inline size_t find(const LChar* characters, unsigned length, CharacterMatchFunctionPtr matchFunction, unsigned index = 0)
 {
     while (index < length) {
@@ -1183,6 +1186,16 @@ template<> struct DefaultHash<RefPtr<StringImpl>> {
     typedef StringHash Hash;
 };
 
+template<unsigned length> inline bool equalLettersIgnoringASCIICase(const StringImpl& string, const char (&lowercaseLetters)[length])
+{
+    return equalLettersIgnoringASCIICaseCommon(string, lowercaseLetters);
+}
+
+template<unsigned length> inline bool equalLettersIgnoringASCIICase(const StringImpl* string, const char (&lowercaseLetters)[length])
+{
+    return string && equalLettersIgnoringASCIICase(*string, lowercaseLetters);
+}
+
 } // namespace WTF
 
 using WTF::StringImpl;
index fb72bb6..aff4c96 100644 (file)
@@ -170,6 +170,8 @@ bool equalIgnoringASCIICase(StringView a, const char (&b)[charactersCount])
     return equalIgnoringASCIICase(a, b, charactersCount - 1);
 }
 
+template<unsigned length> bool equalLettersIgnoringASCIICase(StringView, const char (&lowercaseLetters)[length]);
+
 inline bool operator==(StringView a, StringView b) { return equal(a, b); }
 inline bool operator==(StringView a, const LChar* b) { return equal(a, b); }
 inline bool operator==(StringView a, const char* b) { return equal(a, b); }
@@ -704,6 +706,11 @@ inline auto StringView::CodeUnits::end() const -> Iterator
     return Iterator(m_stringView, m_stringView.length());
 }
 
+template<unsigned length> inline bool equalLettersIgnoringASCIICase(StringView string, const char (&lowercaseLetters)[length])
+{
+    return equalLettersIgnoringASCIICaseCommon(string, lowercaseLetters);
+}
+
 } // namespace WTF
 
 using WTF::append;
index df3c8f2..e2376ca 100644 (file)
@@ -492,10 +492,8 @@ inline bool operator==(const String& a, const LChar* b) { return equal(a.impl(),
 inline bool operator==(const String& a, const char* b) { return equal(a.impl(), reinterpret_cast<const LChar*>(b)); }
 inline bool operator==(const LChar* a, const String& b) { return equal(a, b.impl()); }
 inline bool operator==(const char* a, const String& b) { return equal(reinterpret_cast<const LChar*>(a), b.impl()); }
-template<size_t inlineCapacity>
-inline bool operator==(const Vector<char, inlineCapacity>& a, const String& b) { return equal(b.impl(), a.data(), a.size()); }
-template<size_t inlineCapacity>
-inline bool operator==(const String& a, const Vector<char, inlineCapacity>& b) { return b == a; }
+template<size_t inlineCapacity> inline bool operator==(const Vector<char, inlineCapacity>& a, const String& b) { return equal(b.impl(), a.data(), a.size()); }
+template<size_t inlineCapacity> inline bool operator==(const String& a, const Vector<char, inlineCapacity>& b) { return b == a; }
 
 
 inline bool operator!=(const String& a, const String& b) { return !equal(a.impl(), b.impl()); }
@@ -503,10 +501,8 @@ inline bool operator!=(const String& a, const LChar* b) { return !equal(a.impl()
 inline bool operator!=(const String& a, const char* b) { return !equal(a.impl(), reinterpret_cast<const LChar*>(b)); }
 inline bool operator!=(const LChar* a, const String& b) { return !equal(a, b.impl()); }
 inline bool operator!=(const char* a, const String& b) { return !equal(reinterpret_cast<const LChar*>(a), b.impl()); }
-template<size_t inlineCapacity>
-inline bool operator!=(const Vector<char, inlineCapacity>& a, const String& b) { return !(a == b); }
-template<size_t inlineCapacity>
-inline bool operator!=(const String& a, const Vector<char, inlineCapacity>& b) { return b != a; }
+template<size_t inlineCapacity> inline bool operator!=(const Vector<char, inlineCapacity>& a, const String& b) { return !(a == b); }
+template<size_t inlineCapacity> inline bool operator!=(const String& a, const Vector<char, inlineCapacity>& b) { return b != a; }
 
 inline bool equalIgnoringCase(const String& a, const String& b) { return equalIgnoringCase(a.impl(), b.impl()); }
 inline bool equalIgnoringCase(const String& a, const LChar* b) { return equalIgnoringCase(a.impl(), b); }
@@ -514,19 +510,15 @@ inline bool equalIgnoringCase(const String& a, const char* b) { return equalIgno
 inline bool equalIgnoringCase(const LChar* a, const String& b) { return equalIgnoringCase(a, b.impl()); }
 inline bool equalIgnoringCase(const char* a, const String& b) { return equalIgnoringCase(reinterpret_cast<const LChar*>(a), b.impl()); }
 
+bool equalPossiblyIgnoringCase(const String&, const String&, bool ignoreCase);
+
 inline bool equalIgnoringASCIICase(const String& a, const String& b) { return equalIgnoringASCIICase(a.impl(), b.impl()); }
-template<unsigned charactersCount>
-inline bool equalIgnoringASCIICase(const String& a, const char (&b)[charactersCount]) { return equalIgnoringASCIICase<charactersCount>(a.impl(), b); }
+template<unsigned charactersCount> inline bool equalIgnoringASCIICase(const String& a, const char (&b)[charactersCount]) { return equalIgnoringASCIICase<charactersCount>(a.impl(), b); }
 
-inline bool equalPossiblyIgnoringCase(const String& a, const String& b, bool ignoreCase) 
-{
-    return ignoreCase ? equalIgnoringCase(a, b) : (a == b);
-}
+template<unsigned length> bool equalLettersIgnoringASCIICase(const String&, const char (&lowercaseLetters)[length]);
 
 inline bool equalIgnoringNullity(const String& a, const String& b) { return equalIgnoringNullity(a.impl(), b.impl()); }
-
-template<size_t inlineCapacity>
-inline bool equalIgnoringNullity(const Vector<UChar, inlineCapacity>& a, const String& b) { return equalIgnoringNullity(a, b.impl()); }
+template<size_t inlineCapacity> inline bool equalIgnoringNullity(const Vector<UChar, inlineCapacity>& a, const String& b) { return equalIgnoringNullity(a, b.impl()); }
 
 inline bool operator!(const String& str) { return str.isNull(); }
 
@@ -676,6 +668,11 @@ inline bool String::isAllSpecialCharacters() const
     return WTF::isAllSpecialCharacters<isSpecialCharacter, UChar>(characters16(), len);
 }
 
+inline bool equalPossiblyIgnoringCase(const String& a, const String& b, bool ignoreCase)
+{
+    return ignoreCase ? equalIgnoringCase(a, b) : (a == b);
+}
+
 // StringHash is the default hash for String
 template<typename T> struct DefaultHash;
 template<> struct DefaultHash<String> {
@@ -715,6 +712,11 @@ private:
 // Shared global empty string.
 WTF_EXPORT_STRING_API const String& emptyString();
 
+template<unsigned length> inline bool equalLettersIgnoringASCIICase(const String& string, const char (&lowercaseLetters)[length])
+{
+    return equalLettersIgnoringASCIICase(string.impl(), lowercaseLetters);
+}
+
 }
 
 using WTF::CString;
index 132ad59..f38c042 100644 (file)
@@ -1,3 +1,499 @@
+2016-01-22  Darin Adler  <darin@apple.com>
+
+        Reduce use of equalIgnoringCase to just ignore ASCII case
+        https://bugs.webkit.org/show_bug.cgi?id=153266
+
+        Reviewed by Ryosuke Niwa.
+
+        Changed many call sites that were using equalIgnoringCase to instead use
+        equalLettersIgnoringASCIICase. What these all have in common is that the
+        thing they are comparing with is a string literal that has all lowercase
+        letters, spaces, and a few simple examples of punctuation.
+
+        Not 100% sure that the new function name is just right, but it's a long name
+        so it's easy to change it with a global replace if we come up with a better one.
+
+        Or if we decide ther eis no need for the "letters" optimization, we can change
+        these all to just use equalIgnoringASCIICase, also with a global replace.
+
+        Also made a few tweaks to some code nearby and some includes.
+
+        * Modules/encryptedmedia/CDMPrivateClearKey.cpp:
+        (WebCore::CDMPrivateClearKey::supportsKeySystem): Use equalLettersIgnoringASCIICase.
+        (WebCore::CDMPrivateClearKey::supportsKeySystemAndMimeType): Ditto.
+        * Modules/encryptedmedia/CDMSessionClearKey.cpp:
+        (WebCore::CDMSessionClearKey::update): Ditto.
+        * Modules/plugins/YouTubePluginReplacement.cpp:
+        (WebCore::YouTubePluginReplacement::supportsMimeType): Ditto.
+        (WebCore::YouTubePluginReplacement::supportsFileExtension): Ditto.
+        * Modules/webdatabase/DatabaseAuthorizer.cpp:
+        (WebCore::DatabaseAuthorizer::createVTable): Ditto.
+        (WebCore::DatabaseAuthorizer::dropVTable): Ditto.
+        * Modules/websockets/WebSocketHandshake.cpp:
+        (WebCore::WebSocketHandshake::readHTTPHeaders): Ditto.
+        (WebCore::WebSocketHandshake::checkResponseHeaders): Ditto.
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::findAriaModalNodes): Ditto.
+        (WebCore::AXObjectCache::handleMenuItemSelected): Ditto.
+        (WebCore::AXObjectCache::handleAriaModalChange): Ditto.
+        (WebCore::isNodeAriaVisible): Ditto.
+        * accessibility/AccessibilityListBoxOption.cpp:
+        (WebCore::AccessibilityListBoxOption::isEnabled): Ditto.
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::determineAccessibilityRole): Use isColorControl
+        instead of checking the typeAttr of the HTMLInputElement directly.
+        (WebCore::AccessibilityNodeObject::isEnabled): Use equalLettersIgnoringASCIICase.
+        (WebCore::AccessibilityNodeObject::isPressed): Ditto.
+        (WebCore::AccessibilityNodeObject::isChecked): Ditto.
+        (WebCore::AccessibilityNodeObject::isMultiSelectable): Ditto.
+        (WebCore::AccessibilityNodeObject::isRequired): Ditto.
+        (WebCore::shouldUseAccessibilityObjectInnerText): Ditto.
+        (WebCore::AccessibilityNodeObject::colorValue): Ditto.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::contentEditableAttributeIsEnabled):
+        Use equalLettersIgnoringASCIICase.
+        (WebCore::AccessibilityObject::ariaIsMultiline): Ditto.
+        (WebCore::AccessibilityObject::liveRegionStatusIsEnabled): Ditto.
+        (WebCore::AccessibilityObject::sortDirection): Ditto.
+        (WebCore::AccessibilityObject::supportsARIAPressed): Ditto.
+        (WebCore::AccessibilityObject::supportsExpanded): Ditto.
+        (WebCore::AccessibilityObject::isExpanded): Ditto.
+        (WebCore::AccessibilityObject::checkboxOrRadioValue): Ditto.
+        (WebCore::AccessibilityObject::isARIAHidden): Ditto.
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::supportsARIADragging): Ditto.
+        (WebCore::AccessibilityRenderObject::defaultObjectInclusion): Ditto.
+        (WebCore::AccessibilityRenderObject::elementAttributeValue): Ditto.
+        (WebCore::AccessibilityRenderObject::isSelected): Ditto.
+        (WebCore::AccessibilityRenderObject::determineAccessibilityRole): Ditto.
+        (WebCore::AccessibilityRenderObject::orientation): Ditto.
+        (WebCore::AccessibilityRenderObject::canSetExpandedAttribute): Ditto.
+        (WebCore::AccessibilityRenderObject::canSetValueAttribute): Ditto.
+        (WebCore::AccessibilityRenderObject::ariaLiveRegionAtomic): Ditto.
+
+        * accessibility/AccessibilityTableCell.cpp:
+        (WebCore::AccessibilityTableCell::ariaRowSpan): Use == to compare a string
+        with "0" since there is no need to "ignore case" when there are no letters.
+
+        * css/CSSCalculationValue.cpp:
+        (WebCore::CSSCalcValue::create): Use equalLettersIgnoringASCIICase.
+
+        * css/CSSCalculationValue.h: Removed unneeded include of CSSParserValues.h.
+        * css/CSSCustomPropertyValue.h: Ditto.
+
+        * css/CSSFontFaceSrcValue.cpp:
+        (WebCore::CSSFontFaceSrcValue::isSVGFontFaceSrc): Use equalLettersIgnoringASCIICase.
+
+        * css/CSSGrammar.y.in: Use equalLettersIgnoringASCIICase. Also restructured the code
+        a bit to have more normal formatting and reordered it slightly.
+
+        * css/CSSParser.cpp:
+        (WebCore::equal): Deleted.
+        (WebCore::equalIgnoringCase): Deleted.
+        (WebCore::equalLettersIgnoringASCIICase): Added. Replaces function templates named
+        equal and equalIgnoringCase that are no longer used.
+        (WebCore::CSSParser::parseValue): Use equalLettersIgnoringASCIICase.
+        (WebCore::CSSParser::parseNonElementSnapPoints): Ditto.
+        (WebCore::CSSParser::parseAlt): Ditto.
+        (WebCore::CSSParser::parseContent): Ditto.
+        (WebCore::CSSParser::parseFillImage): Ditto.
+        (WebCore::CSSParser::parseAnimationName): Ditto.
+        (WebCore::CSSParser::parseAnimationTrigger): Ditto.
+        (WebCore::CSSParser::parseAnimationProperty): Ditto.
+        (WebCore::CSSParser::parseKeyframeSelector): Ditto.
+        (WebCore::CSSParser::parseAnimationTimingFunction): Ditto.
+        (WebCore::CSSParser::parseGridTrackList): Ditto.
+        (WebCore::CSSParser::parseGridTrackSize): Ditto.
+        (WebCore::CSSParser::parseDashboardRegions): Ditto.
+        (WebCore::CSSParser::parseClipShape): Ditto.
+        (WebCore::CSSParser::parseBasicShapeInset): Ditto.
+        (WebCore::CSSParser::parseBasicShape): Ditto.
+        (WebCore::CSSParser::parseFontFaceSrcURI): Ditto.
+        (WebCore::CSSParser::parseFontFaceSrc): Ditto.
+        (WebCore::CSSParser::isCalculation): Ditto.
+        (WebCore::CSSParser::parseColorFromValue): Ditto.
+        (WebCore::CSSParser::parseBorderImage): Ditto.
+        (WebCore::parseDeprecatedGradientPoint): Ditto.
+        (WebCore::parseDeprecatedGradientColorStop): Ditto.
+        (WebCore::CSSParser::parseDeprecatedGradient): Ditto.
+        (WebCore::CSSParser::parseLinearGradient): Ditto.
+        (WebCore::CSSParser::parseRadialGradient): Ditto.
+        (WebCore::CSSParser::isGeneratedImageValue): Ditto.
+        (WebCore::CSSParser::parseGeneratedImage): Ditto.
+        (WebCore::filterInfoForName): Ditto.
+        (WebCore::validFlowName): Ditto.
+        (WebCore::CSSParser::realLex): Ditto.
+        (WebCore::isValidNthToken): Ditto.
+        * css/CSSParserValues.cpp:
+        (WebCore::CSSParserSelector::parsePagePseudoSelector): Ditto.
+
+        * css/CSSParserValues.h:
+        (WebCore::equalLettersIgnoringASCIICase): Added.
+
+        * css/CSSVariableDependentValue.h: Removed unneeded include of CSSParserValues.h.
+
+        * css/MediaList.cpp:
+        (WebCore::reportMediaQueryWarningIfNeeded): Use equalLettersIgnoringASCIICase.
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::MediaQueryEvaluator::mediaTypeMatch): Ditto.
+        (WebCore::MediaQueryEvaluator::mediaTypeMatchSpecific): Ditto.
+        (WebCore::evalResolution): Ditto.
+
+        * css/SelectorPseudoTypeMap.h: Removed unneeded include of CSSParserValues.h.
+
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertTouchCallout): Use equalLettersIgnoringASCIICase.
+
+        * css/makeSelectorPseudoClassAndCompatibilityElementMap.py: Added an include of
+        CSSParserValues.h since it's no longer included by SelectorPseudoTypeMap.h.
+
+        * dom/Document.cpp:
+        (WebCore::setParserFeature): Use equalLettersIgnoringASCIICase.
+        (WebCore::Document::processReferrerPolicy): Ditto.
+        (WebCore::Document::createEvent): Ditto.
+        (WebCore::Document::parseDNSPrefetchControlHeader): Ditto.
+
+        * dom/Element.cpp:
+        (WebCore::Element::spellcheckAttributeState): Use isNull instead of doing
+        checking equality with nullAtom. Use isEmpty instead of equalIgnoringCase("").
+        Use equalLettersIgnoringASCIICase.
+        (WebCore::Element::canContainRangeEndPoint): Ditto.
+
+        * dom/InlineStyleSheetOwner.cpp:
+        (WebCore::isValidCSSContentType): Use equalLettersIgnoringASCIICase.
+        Added comment about peculiar behavior where we do case-sensitive processing of
+        the MIME type if the document is XML.
+
+        * dom/ScriptElement.cpp:
+        (WebCore::ScriptElement::requestScript): Use equalLettersIgnoringASCIICase.
+        (WebCore::ScriptElement::isScriptForEventSupported): Ditto.
+        * dom/SecurityContext.cpp:
+        (WebCore::SecurityContext::parseSandboxPolicy): Ditto.
+        * dom/ViewportArguments.cpp:
+        (WebCore::findSizeValue): Ditto.
+        (WebCore::findScaleValue): Ditto.
+        (WebCore::findBooleanValue): Ditto.
+
+        * editing/EditorCommand.cpp:
+        (WebCore::executeDefaultParagraphSeparator): Use equalLettersIgnoringASCIICase.
+        (WebCore::executeInsertBacktab): Use ASCIILiteral.
+        (WebCore::executeInsertHTML): Use emptyString.
+        (WebCore::executeInsertLineBreak): Use ASCIILiteral.
+        (WebCore::executeInsertNewline): Ditto.
+        (WebCore::executeInsertTab): Ditto.
+        (WebCore::executeJustifyCenter): Ditto.
+        (WebCore::executeJustifyFull): Ditto.
+        (WebCore::executeJustifyLeft): Ditto.
+        (WebCore::executeJustifyRight): Ditto.
+        (WebCore::executeStrikethrough): Ditto.
+        (WebCore::executeStyleWithCSS): Use equalLettersIgnoringASCIICase.
+        (WebCore::executeUseCSS): Ditto.
+        (WebCore::executeSubscript): Use ASCIILiteral.
+        (WebCore::executeSuperscript): Ditto.
+        (WebCore::executeToggleBold): Ditto.
+        (WebCore::executeToggleItalic): Ditto.
+        (WebCore::executeUnderline): Ditto.
+        (WebCore::executeUnscript): Ditto.
+        (WebCore::stateBold): Ditto.
+        (WebCore::stateItalic): Ditto.
+        (WebCore::stateStrikethrough): Ditto.
+        (WebCore::stateSubscript): Ditto.
+        (WebCore::stateSuperscript): Ditto.
+        (WebCore::stateUnderline): Ditto.
+        (WebCore::stateJustifyCenter): Ditto.
+        (WebCore::stateJustifyFull): Ditto.
+        (WebCore::stateJustifyLeft): Ditto.
+        (WebCore::stateJustifyRight): Ditto.
+        (WebCore::valueFormatBlock): Use emptyString.
+        (WebCore::Editor::Command::value): Use ASCIILiteral.
+
+        * editing/TextIterator.cpp:
+        (WebCore::isRendererReplacedElement): Use equalLettersIgnoringASCIICase.
+
+        * fileapi/Blob.cpp:
+        (WebCore::Blob::isNormalizedContentType): Use isASCIIUpper.
+
+        * history/HistoryItem.cpp:
+        (WebCore::HistoryItem::setFormInfoFromRequest): Use equalLettersIgnoringASCIICase.
+
+        * html/Autocapitalize.cpp:
+        (WebCore::valueOn): Deleted.
+        (WebCore::valueOff): Deleted.
+        (WebCore::valueNone): Deleted.
+        (WebCore::valueWords): Deleted.
+        (WebCore::valueSentences): Deleted.
+        (WebCore::valueAllCharacters): Deleted.
+        (WebCore::autocapitalizeTypeForAttributeValue): Use equalLettersIgnoringASCIICase.
+        (WebCore::stringForAutocapitalizeType): Put the AtomicString globals right in the
+        switch statement instead of in separate functions.
+
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::draggable): Use equalLettersIgnoringASCIICase.
+        * html/HTMLAreaElement.cpp:
+        (WebCore::HTMLAreaElement::parseAttribute): Ditto.
+        * html/HTMLBRElement.cpp:
+        (WebCore::HTMLBRElement::collectStyleForPresentationAttribute): Ditto.
+        * html/HTMLBodyElement.cpp:
+        (WebCore::HTMLBodyElement::collectStyleForPresentationAttribute): Ditto.
+        * html/HTMLButtonElement.cpp:
+        (WebCore::HTMLButtonElement::parseAttribute): Ditto.
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::toDataURL): Use ASCIILiteral.
+
+        * html/HTMLDivElement.cpp:
+        (WebCore::HTMLDivElement::collectStyleForPresentationAttribute):
+        Use equalLettersIgnoringASCIICase.
+
+        * html/HTMLDocument.cpp:
+        (WebCore::HTMLDocument::designMode): Use ASCIILiteral.
+        (WebCore::HTMLDocument::setDesignMode): Use equalLettersIgnoringASCIICase.
+
+        * html/HTMLElement.cpp:
+        (WebCore::HTMLElement::nodeName): Updated comment.
+        (WebCore::isLTROrRTLIgnoringCase): Use equalLettersIgnoringASCIICase.
+        (WebCore::contentEditableType): Ditto.
+        (WebCore::HTMLElement::collectStyleForPresentationAttribute): Ditto.
+        (WebCore::toValidDirValue): Ditto.
+        (WebCore::HTMLElement::insertAdjacent): Ditto.
+        (WebCore::contextElementForInsertion): Ditto.
+        (WebCore::HTMLElement::applyAlignmentAttributeToStyle): Ditto.
+        (WebCore::HTMLElement::setContentEditable): Ditto.
+        (WebCore::HTMLElement::draggable): Ditto.
+        (WebCore::HTMLElement::translateAttributeMode): Ditto.
+        (WebCore::HTMLElement::hasDirectionAuto): Ditto.
+        (WebCore::HTMLElement::directionality): Ditto.
+        (WebCore::HTMLElement::dirAttributeChanged): Ditto.
+        (WebCore::HTMLElement::addHTMLColorToStyle): Ditto.
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::collectStyleForPresentationAttribute): Ditto.
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::autocorrect): Ditto.
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::autocorrect): Ditto.
+        (WebCore::HTMLFormElement::shouldAutocomplete): Ditto.
+        * html/HTMLFrameElementBase.cpp:
+        (WebCore::HTMLFrameElementBase::parseAttribute): Ditto.
+
+        * html/HTMLFrameSetElement.cpp:
+        (WebCore::HTMLFrameSetElement::parseAttribute): Use equalLettersIgnoringASCIICase.
+        Use == when comparing with "0" and "1" since there is no need for case folding.
+
+        * html/HTMLHRElement.cpp:
+        (WebCore::HTMLHRElement::collectStyleForPresentationAttribute):
+        Use equalLettersIgnoringASCIICase.
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::draggable): Ditto.
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::parseAttribute): Ditto.
+        * html/HTMLKeygenElement.cpp:
+        (WebCore::HTMLKeygenElement::appendFormData): Ditto.
+        * html/HTMLMarqueeElement.cpp:
+        (WebCore::HTMLMarqueeElement::collectStyleForPresentationAttribute): Ditto.
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::parseAttribute): Ditto.
+        * html/HTMLMetaElement.cpp:
+        (WebCore::HTMLMetaElement::process): Ditto.
+
+        * html/HTMLObjectElement.cpp:
+        (WebCore::mapDataParamToSrc): Use references, modern for loops, simplify
+        logic to not use array indices, use ASCIILiteral and equalLettersIgnoringASCIICase.
+        (WebCore::HTMLObjectElement::parametersForPlugin): Update to call new function.
+        (WebCore::HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk): Use equalLettersIgnoringASCIICase.
+        (WebCore::HTMLObjectElement::containsJavaApplet): Ditto.
+        * html/HTMLParagraphElement.cpp:
+        (WebCore::HTMLParagraphElement::collectStyleForPresentationAttribute): Ditto.
+        * html/HTMLParamElement.cpp:
+        (WebCore::HTMLParamElement::isURLParameter): Ditto.
+        * html/HTMLTableElement.cpp:
+        (WebCore::getBordersFromFrameAttributeValue): Ditto.
+        (WebCore::HTMLTableElement::collectStyleForPresentationAttribute): Ditto.
+        (WebCore::HTMLTableElement::parseAttribute): Ditto.
+        * html/HTMLTablePartElement.cpp:
+        (WebCore::HTMLTablePartElement::collectStyleForPresentationAttribute): Ditto.
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::parseAttribute): Ditto.
+        * html/HTMLTextFormControlElement.cpp:
+        (WebCore::HTMLTextFormControlElement::setRangeText): Ditto.
+        (WebCore::HTMLTextFormControlElement::directionForFormData): Ditto.
+        * html/HTMLVideoElement.cpp:
+        (WebCore::HTMLVideoElement::parseAttribute): Ditto.
+        * html/InputType.cpp:
+        (WebCore::InputType::applyStep): Ditto.
+        * html/LinkRelAttribute.cpp:
+        (WebCore::LinkRelAttribute::LinkRelAttribute): Ditto.
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled): Ditto.
+        * html/NumberInputType.cpp:
+        (WebCore::NumberInputType::sizeShouldIncludeDecoration): Ditto.
+        * html/RangeInputType.cpp:
+        (WebCore::RangeInputType::createStepRange): Ditto.
+        (WebCore::RangeInputType::handleKeydownEvent): Ditto.
+        * html/StepRange.cpp:
+        (WebCore::StepRange::parseStep): Ditto.
+        * html/canvas/CanvasStyle.cpp:
+        (WebCore::parseColor): Ditto.
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::HTMLConstructionSite::setCompatibilityModeFromDoctype): Ditto.
+        * html/parser/HTMLElementStack.cpp:
+        (WebCore::HTMLElementStack::isHTMLIntegrationPoint): Ditto.
+        * html/parser/HTMLMetaCharsetParser.cpp:
+        (WebCore::HTMLMetaCharsetParser::encodingFromMetaAttributes): Ditto.
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Ditto.
+        (WebCore::TokenPreloadScanner::StartTagScanner::crossOriginModeAllowsCookies): Ditto.
+        * html/parser/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::processStartTagForInBody): Ditto.
+        (WebCore::HTMLTreeBuilder::processStartTagForInTable): Ditto.
+        * html/parser/XSSAuditor.cpp:
+        (WebCore::isDangerousHTTPEquiv): Ditto.
+
+        * html/track/WebVTTParser.cpp:
+        (WebCore::WebVTTParser::hasRequiredFileIdentifier): Removed unneeded special case
+        for empty string.
+
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::createXHRTextDecoder): Use equalLettersIgnoringASCIICase.
+        * inspector/NetworkResourcesData.cpp:
+        (WebCore::createOtherResourceTextDecoder): Ditto.
+        * loader/CrossOriginAccessControl.cpp:
+        (WebCore::isOnAccessControlSimpleRequestHeaderWhitelist): Ditto.
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::continueAfterContentPolicy): Ditto.
+        * loader/FormSubmission.cpp:
+        (WebCore::appendMailtoPostFormDataToURL): Ditto.
+        (WebCore::FormSubmission::Attributes::parseEncodingType): Ditto.
+        (WebCore::FormSubmission::Attributes::parseMethodType): Ditto.
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::shouldPerformFragmentNavigation): Ditto.
+        (WebCore::FrameLoader::shouldTreatURLAsSrcdocDocument): Ditto.
+        * loader/ImageLoader.cpp:
+        (WebCore::ImageLoader::updateFromElement): Ditto.
+        * loader/MediaResourceLoader.cpp:
+        (WebCore::MediaResourceLoader::start): Ditto.
+        * loader/SubframeLoader.cpp:
+        (WebCore::SubframeLoader::createJavaAppletWidget): Ditto.
+        * loader/TextResourceDecoder.cpp:
+        (WebCore::TextResourceDecoder::determineContentType): Ditto.
+        * loader/TextTrackLoader.cpp:
+        (WebCore::TextTrackLoader::load): Ditto.
+        * loader/appcache/ApplicationCache.cpp:
+        (WebCore::ApplicationCache::requestIsHTTPOrHTTPSGet): Ditto.
+        * loader/cache/CachedCSSStyleSheet.cpp:
+        (WebCore::CachedCSSStyleSheet::canUseSheet): Ditto.
+        * loader/cache/CachedResource.cpp:
+        (WebCore::shouldCacheSchemeIndefinitely): Ditto.
+        * page/DOMSelection.cpp:
+        (WebCore::DOMSelection::modify): Ditto.
+        * page/EventSource.cpp:
+        (WebCore::EventSource::didReceiveResponse): Ditto.
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollToAnchor): Ditto.
+        * page/Performance.cpp:
+        (WebCore::Performance::webkitGetEntriesByType): Ditto.
+        * page/PerformanceResourceTiming.cpp:
+        (WebCore::passesTimingAllowCheck): Ditto.
+
+        * page/SecurityOrigin.cpp:
+        (WebCore::SecurityOrigin::SecurityOrigin): Use emptyString.
+        (WebCore::SecurityOrigin::toString): Use ASCIILiteral.
+        (WebCore::SecurityOrigin::databaseIdentifier): Ditto.
+
+        * page/UserContentURLPattern.cpp:
+        (WebCore::UserContentURLPattern::parse): Use equalLettersIgnoringASCIICase.
+        (WebCore::UserContentURLPattern::matches): Ditto.
+        * platform/URL.cpp:
+        (WebCore::URL::protocolIs): Ditto.
+
+        * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
+        (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType):
+        Changed to use early exit and equalLettersIgnoringASCIICase. Added comment
+        about inconsistency with next function.
+        (WebCore::CDMPrivateMediaSourceAVFObjC::supportsMIMEType): Added comment
+        about inconsistency with previous function.
+
+        * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
+        (WebCore::CDMSessionAVContentKeySession::generateKeyRequest):
+        Use equalLettersIgnoringASCIICase.
+        * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
+        (WebCore::CDMSessionAVStreamSession::generateKeyRequest): Ditto.
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        (WebCore::utiFromMIMEType): Ditto.
+
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::FontCache::similarFont): Changed to not use so many global
+        variables and use equalLettersIgnoringASCIICase.
+        * platform/graphics/ios/FontCacheIOS.mm:
+        (WebCore::platformFontWithFamilySpecialCase): Ditto.
+
+        * platform/graphics/mac/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Use equalLettersIgnoringASCIICase.
+        * platform/mac/PasteboardMac.mm:
+        (WebCore::Pasteboard::readString): Ditto.
+        * platform/network/BlobResourceHandle.cpp:
+        (WebCore::BlobResourceHandle::createAsync): Ditto.
+        (WebCore::BlobResourceHandle::loadResourceSynchronously): Ditto.
+        * platform/network/CacheValidation.cpp:
+        (WebCore::parseCacheControlDirectives): Ditto.
+        * platform/network/FormData.h:
+        (WebCore::FormData::parseEncodingType): Ditto.
+        * platform/network/HTTPParsers.cpp:
+        (WebCore::contentDispositionType): Ditto.
+        (WebCore::parseXFrameOptionsHeader): Ditto.
+
+        * platform/network/ResourceResponseBase.cpp:
+        (WebCore::ResourceResponseBase::isHTTP): Use protocolIsInHTTPFamily, which is
+        both clearer and more efficient.
+        (WebCore::ResourceResponseBase::isAttachment): Rewrite to be a bit more terse
+        and use equalLettersIgnoringASCIICase.
+
+        * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
+        (WebCore::ResourceHandleCFURLConnectionDelegate::createResourceRequest):
+        Use equalLettersIgnoringASCIICase.
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::willSendRequest): Ditto.
+        * platform/sql/SQLiteDatabase.cpp:
+        (WebCore::SQLiteDatabase::open): Ditto.
+        * platform/sql/SQLiteStatement.cpp:
+        (WebCore::SQLiteStatement::isColumnDeclaredAsBlob): Ditto.
+
+        * platform/text/TextEncodingRegistry.cpp:
+        (WebCore::defaultTextEncodingNameForSystemLanguage): Use ASCIILiteral
+        and equalLettersIgnoringASCIICase.
+
+        * rendering/mathml/RenderMathMLFraction.cpp:
+        (WebCore::RenderMathMLFraction::updateFromElement): Use equalLettersIgnoringASCIICase.
+        * svg/SVGToOTFFontConversion.cpp:
+        (WebCore::SVGToOTFFontConverter::compareCodepointsLexicographically): Ditto.
+        (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Ditto.
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::setEditingBehavior): Ditto.
+        (WebCore::InternalSettings::setShouldDisplayTrackKind): Ditto.
+        (WebCore::InternalSettings::shouldDisplayTrackKind): Ditto.
+        * testing/Internals.cpp:
+        (WebCore::markerTypeFrom): Ditto.
+        (WebCore::markerTypesFrom): Ditto.
+        (WebCore::Internals::mediaElementHasCharacteristic): Ditto.
+        (WebCore::Internals::setCaptionDisplayMode): Ditto.
+        (WebCore::Internals::beginMediaSessionInterruption): Ditto.
+        (WebCore::Internals::endMediaSessionInterruption): Ditto.
+        (WebCore::Internals::setMediaSessionRestrictions): Ditto.
+        (WebCore::Internals::setMediaElementRestrictions): Ditto.
+        (WebCore::Internals::postRemoteControlCommand): Ditto.
+        (WebCore::Internals::setAudioContextRestrictions): Ditto.
+        (WebCore::Internals::setMockMediaPlaybackTargetPickerState): Ditto.
+        * testing/MockCDM.cpp:
+        (WebCore::MockCDM::supportsKeySystem): Ditto.
+        (WebCore::MockCDM::supportsKeySystemAndMimeType): Ditto.
+        (WebCore::MockCDM::supportsMIMEType): Ditto.
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::isSetCookieHeader): Ditto.
+        (WebCore::XMLHttpRequest::responseXML): Ditto.
+        (WebCore::XMLHttpRequest::isAllowedHTTPMethod): Ditto.
+        (WebCore::XMLHttpRequest::didReceiveData): Ditto.
+
 2016-01-22  Youenn Fablet  <youenn.fablet@crf.canon.fr>
 
         Remove PassRefPtr from ResourceRequest and FormData
index 8a36f3b..0332156 100644 (file)
@@ -38,7 +38,7 @@ namespace WebCore {
 
 bool CDMPrivateClearKey::supportsKeySystem(const String& keySystem)
 {
-    if (!equalIgnoringCase(keySystem, "org.w3c.clearkey"))
+    if (!equalLettersIgnoringASCIICase(keySystem, "org.w3c.clearkey"))
         return false;
 
     // The MediaPlayer must also support the key system:
@@ -47,7 +47,7 @@ bool CDMPrivateClearKey::supportsKeySystem(const String& keySystem)
 
 bool CDMPrivateClearKey::supportsKeySystemAndMimeType(const String& keySystem, const String& mimeType)
 {
-    if (!equalIgnoringCase(keySystem, "org.w3c.clearkey"))
+    if (!equalLettersIgnoringASCIICase(keySystem, "org.w3c.clearkey"))
         return false;
 
     // The MediaPlayer must also support the key system:
index 589acd2..daf8441 100644 (file)
@@ -137,13 +137,13 @@ bool CDMSessionClearKey::update(Uint8Array* rawKeysData, RefPtr<Uint8Array>& nex
             }
 
             String algorithm;
-            if (!keyDictionary.get("alg", algorithm) || !equalIgnoringCase(algorithm, "a128kw")) {
+            if (!keyDictionary.get("alg", algorithm) || !equalLettersIgnoringASCIICase(algorithm, "a128kw")) {
                 LOG(Media, "CDMSessionClearKey::update(%p) - failed: algorithm unsupported", this);
                 continue;
             }
 
             String keyType;
-            if (!keyDictionary.get("kty", keyType) || !equalIgnoringCase(keyType, "oct")) {
+            if (!keyDictionary.get("kty", keyType) || !equalLettersIgnoringASCIICase(keyType, "oct")) {
                 LOG(Media, "CDMSessionClearKey::update(%p) - failed: keyType unsupported", this);
                 continue;
             }
index bf6a70a..9a68650 100644 (file)
@@ -50,13 +50,13 @@ PassRefPtr<PluginReplacement> YouTubePluginReplacement::create(HTMLPlugInElement
 
 bool YouTubePluginReplacement::supportsMimeType(const String& mimeType)
 {
-    return equalIgnoringCase(mimeType, "application/x-shockwave-flash")
-        || equalIgnoringCase(mimeType, "application/futuresplash");
+    return equalLettersIgnoringASCIICase(mimeType, "application/x-shockwave-flash")
+        || equalLettersIgnoringASCIICase(mimeType, "application/futuresplash");
 }
 
 bool YouTubePluginReplacement::supportsFileExtension(const String& extension)
 {
-    return equalIgnoringCase(extension, "spl") || equalIgnoringCase(extension, "swf");
+    return equalLettersIgnoringASCIICase(extension, "spl") || equalLettersIgnoringASCIICase(extension, "swf");
 }
 
 YouTubePluginReplacement::YouTubePluginReplacement(HTMLPlugInElement& plugin, const Vector<String>& paramNames, const Vector<String>& paramValues)
index c5f99e1..3ed2eb6 100644 (file)
@@ -289,7 +289,7 @@ int DatabaseAuthorizer::createVTable(const String& tableName, const String& modu
         return SQLAuthDeny;
 
     // Allow only the FTS3 extension
-    if (!equalIgnoringCase(moduleName, "fts3"))
+    if (!equalLettersIgnoringASCIICase(moduleName, "fts3"))
         return SQLAuthDeny;
 
     m_lastActionChangedDatabase = true;
@@ -302,7 +302,7 @@ int DatabaseAuthorizer::dropVTable(const String& tableName, const String& module
         return SQLAuthDeny;
 
     // Allow only the FTS3 extension
-    if (!equalIgnoringCase(moduleName, "fts3"))
+    if (!equalLettersIgnoringASCIICase(moduleName, "fts3"))
         return SQLAuthDeny;
 
     return updateDeletesBasedOnTableName(tableName);
index ce51e69..f19de94 100644 (file)
@@ -470,34 +470,34 @@ const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* e
     for (; p < end; p++) {
         size_t consumedLength = parseHTTPHeader(p, end - p, m_failureReason, name, value);
         if (!consumedLength)
-            return 0;
+            return nullptr;
         p += consumedLength;
 
         // Stop once we consumed an empty line.
         if (name.isEmpty())
             break;
 
-        if (equalIgnoringCase("sec-websocket-extensions", name)) {
+        if (equalLettersIgnoringASCIICase(name, "sec-websocket-extensions")) {
             if (sawSecWebSocketExtensionsHeaderField) {
                 m_failureReason = "The Sec-WebSocket-Extensions header MUST NOT appear more than once in an HTTP response";
-                return 0;
+                return nullptr;
             }
             if (!m_extensionDispatcher.processHeaderValue(value)) {
                 m_failureReason = m_extensionDispatcher.failureReason();
-                return 0;
+                return nullptr;
             }
             sawSecWebSocketExtensionsHeaderField = true;
-        } else if (equalIgnoringCase("Sec-WebSocket-Accept", name)) {
+        } else if (equalLettersIgnoringASCIICase(name, "sec-websocket-accept")) {
             if (sawSecWebSocketAcceptHeaderField) {
                 m_failureReason = "The Sec-WebSocket-Accept header MUST NOT appear more than once in an HTTP response";
-                return 0;
+                return nullptr;
             }
             m_serverHandshakeResponse.addHTTPHeaderField(name, value);
             sawSecWebSocketAcceptHeaderField = true;
-        } else if (equalIgnoringCase("Sec-WebSocket-Protocol", name)) {
+        } else if (equalLettersIgnoringASCIICase(name, "sec-websocket-protocol")) {
             if (sawSecWebSocketProtocolHeaderField) {
                 m_failureReason = "The Sec-WebSocket-Protocol header MUST NOT appear more than once in an HTTP response";
-                return 0;
+                return nullptr;
             }
             m_serverHandshakeResponse.addHTTPHeaderField(name, value);
             sawSecWebSocketProtocolHeaderField = true;
@@ -527,11 +527,11 @@ bool WebSocketHandshake::checkResponseHeaders()
         return false;
     }
 
-    if (!equalIgnoringCase(serverUpgrade, "websocket")) {
+    if (!equalLettersIgnoringASCIICase(serverUpgrade, "websocket")) {
         m_failureReason = "Error during WebSocket handshake: 'Upgrade' header value is not 'WebSocket'";
         return false;
     }
-    if (!equalIgnoringCase(serverConnection, "upgrade")) {
+    if (!equalLettersIgnoringASCIICase(serverConnection, "upgrade")) {
         m_failureReason = "Error during WebSocket handshake: 'Connection' header value is not 'Upgrade'";
         return false;
     }
index 8afc8a6..8cedd43 100644 (file)
@@ -168,7 +168,7 @@ void AXObjectCache::findAriaModalNodes()
         // Must have dialog or alertdialog role
         if (!nodeHasRole(element, "dialog") && !nodeHasRole(element, "alertdialog"))
             continue;
-        if (!equalIgnoringCase(element->fastGetAttribute(aria_modalAttr), "true"))
+        if (!equalLettersIgnoringASCIICase(element->fastGetAttribute(aria_modalAttr), "true"))
             continue;
         
         m_ariaModalNodesSet.add(element);
@@ -948,7 +948,7 @@ void AXObjectCache::handleMenuItemSelected(Node* node)
     if (!nodeHasRole(node, "menuitem") && !nodeHasRole(node, "menuitemradio") && !nodeHasRole(node, "menuitemcheckbox"))
         return;
     
-    if (!downcast<Element>(*node).focused() && !equalIgnoringCase(downcast<Element>(*node).fastGetAttribute(aria_selectedAttr), "true"))
+    if (!downcast<Element>(*node).focused() && !equalLettersIgnoringASCIICase(downcast<Element>(*node).fastGetAttribute(aria_selectedAttr), "true"))
         return;
     
     postNotification(getOrCreate(node), &document(), AXMenuListItemSelected);
@@ -1357,7 +1357,7 @@ void AXObjectCache::handleAriaModalChange(Node* node)
         return;
     
     stopCachingComputedObjectAttributes();
-    if (equalIgnoringCase(downcast<Element>(*node).fastGetAttribute(aria_modalAttr), "true")) {
+    if (equalLettersIgnoringASCIICase(downcast<Element>(*node).fastGetAttribute(aria_modalAttr), "true")) {
         // Add the newly modified node to the modal nodes set, and set it to be the current valid aria modal node.
         // We will recompute the current valid aria modal node in ariaModalNode() when this node is not visible.
         m_ariaModalNodesSet.add(node);
@@ -1854,10 +1854,10 @@ bool isNodeAriaVisible(Node* node)
     for (Node* testNode = node; testNode; testNode = testNode->parentNode()) {
         if (is<Element>(*testNode)) {
             const AtomicString& ariaHiddenValue = downcast<Element>(*testNode).fastGetAttribute(aria_hiddenAttr);
-            if (equalIgnoringCase(ariaHiddenValue, "true"))
+            if (equalLettersIgnoringASCIICase(ariaHiddenValue, "true"))
                 return false;
             
-            bool ariaHiddenFalse = equalIgnoringCase(ariaHiddenValue, "false");
+            bool ariaHiddenFalse = equalLettersIgnoringASCIICase(ariaHiddenValue, "false");
             if (!testNode->renderer() && !ariaHiddenFalse)
                 return false;
             if (!ariaHiddenFalsePresent && ariaHiddenFalse)
index ea39eb5..9cb5a74 100644 (file)
@@ -64,7 +64,7 @@ bool AccessibilityListBoxOption::isEnabled() const
     if (is<HTMLOptGroupElement>(m_optionElement))
         return false;
 
-    if (equalIgnoringCase(getAttribute(aria_disabledAttr), "true"))
+    if (equalLettersIgnoringASCIICase(getAttribute(aria_disabledAttr), "true"))
         return false;
 
     if (m_optionElement->fastHasAttribute(disabledAttr))
index 759aec1..377e0b4 100644 (file)
@@ -308,13 +308,10 @@ AccessibilityRole AccessibilityNodeObject::determineAccessibilityRole()
             return IgnoredRole;
         if (input.isSearchField())
             return SearchFieldRole;
-        
 #if ENABLE(INPUT_TYPE_COLOR)
-        const AtomicString& type = input.getAttribute(typeAttr);
-        if (equalIgnoringCase(type, "color"))
+        if (input.isColorControl())
             return ColorWellRole;
 #endif
-
         return TextFieldRole;
     }
     if (node()->hasTagName(selectTag)) {
@@ -650,9 +647,9 @@ bool AccessibilityNodeObject::isEnabled() const
     // ARIA says that the disabled status applies to the current element and all descendant elements.
     for (AccessibilityObject* object = const_cast<AccessibilityNodeObject*>(this); object; object = object->parentObject()) {
         const AtomicString& disabledStatus = object->getAttribute(aria_disabledAttr);
-        if (equalIgnoringCase(disabledStatus, "true"))
+        if (equalLettersIgnoringASCIICase(disabledStatus, "true"))
             return false;
-        if (equalIgnoringCase(disabledStatus, "false"))
+        if (equalLettersIgnoringASCIICase(disabledStatus, "false"))
             break;
     }
     
@@ -684,7 +681,7 @@ bool AccessibilityNodeObject::isPressed() const
     // If this is an ARIA button, check the aria-pressed attribute rather than node()->active()
     AccessibilityRole ariaRole = ariaRoleAttribute();
     if (ariaRole == ButtonRole || ariaRole == ToggleButtonRole) {
-        if (equalIgnoringCase(getAttribute(aria_pressedAttr), "true"))
+        if (equalLettersIgnoringASCIICase(getAttribute(aria_pressedAttr), "true"))
             return true;
         return false;
     }
@@ -719,7 +716,7 @@ bool AccessibilityNodeObject::isChecked() const
         break;
     }
     
-    if (validRole && equalIgnoringCase(getAttribute(aria_checkedAttr), "true"))
+    if (validRole && equalLettersIgnoringASCIICase(getAttribute(aria_checkedAttr), "true"))
         return true;
 
     return false;
@@ -734,9 +731,9 @@ bool AccessibilityNodeObject::isHovered() const
 bool AccessibilityNodeObject::isMultiSelectable() const
 {
     const AtomicString& ariaMultiSelectable = getAttribute(aria_multiselectableAttr);
-    if (equalIgnoringCase(ariaMultiSelectable, "true"))
+    if (equalLettersIgnoringASCIICase(ariaMultiSelectable, "true"))
         return true;
-    if (equalIgnoringCase(ariaMultiSelectable, "false"))
+    if (equalLettersIgnoringASCIICase(ariaMultiSelectable, "false"))
         return false;
     
     return node() && node()->hasTagName(selectTag) && downcast<HTMLSelectElement>(*node()).multiple();
@@ -764,9 +761,9 @@ bool AccessibilityNodeObject::isRequired() const
 {
     // Explicit aria-required values should trump native required attributes.
     const AtomicString& requiredValue = getAttribute(aria_requiredAttr);
-    if (equalIgnoringCase(requiredValue, "true"))
+    if (equalLettersIgnoringASCIICase(requiredValue, "true"))
         return true;
-    if (equalIgnoringCase(requiredValue, "false"))
+    if (equalLettersIgnoringASCIICase(requiredValue, "false"))
         return false;
 
     Node* n = this->node();
@@ -1640,7 +1637,7 @@ static bool shouldUseAccessibilityObjectInnerText(AccessibilityObject* obj, Acce
         && !obj->accessibleNameDerivesFromContent())
         return false;
     
-    if (equalIgnoringCase(obj->getAttribute(aria_hiddenAttr), "true"))
+    if (equalLettersIgnoringASCIICase(obj->getAttribute(aria_hiddenAttr), "true"))
         return false;
     
     // If something doesn't expose any children, then we can always take the inner text content.
@@ -1855,8 +1852,7 @@ void AccessibilityNodeObject::colorValue(int& r, int& g, int& b) const
         return;
 
     HTMLInputElement& input = downcast<HTMLInputElement>(*node());
-    const AtomicString& type = input.getAttribute(typeAttr);
-    if (!equalIgnoringCase(type, "color"))
+    if (!input.isColorControl())
         return;
 
     // HTMLInputElement::value always returns a string parseable by Color().
index 1566732..65f3811 100644 (file)
@@ -1546,7 +1546,7 @@ bool AccessibilityObject::contentEditableAttributeIsEnabled(Element* element)
         return false;
     
     // Both "true" (case-insensitive) and the empty string count as true.
-    return contentEditableValue.isEmpty() || equalIgnoringCase(contentEditableValue, "true");
+    return contentEditableValue.isEmpty() || equalLettersIgnoringASCIICase(contentEditableValue, "true");
 }
     
 #if HAVE(ACCESSIBILITY)
@@ -1835,7 +1835,7 @@ const String& AccessibilityObject::actionVerb() const
 
 bool AccessibilityObject::ariaIsMultiline() const
 {
-    return equalIgnoringCase(getAttribute(aria_multilineAttr), "true");
+    return equalLettersIgnoringASCIICase(getAttribute(aria_multilineAttr), "true");
 }
 
 String AccessibilityObject::invalidStatus() const
@@ -2246,7 +2246,7 @@ bool AccessibilityObject::supportsARIAAttributes() const
     
 bool AccessibilityObject::liveRegionStatusIsEnabled(const AtomicString& liveRegionStatus)
 {
-    return equalIgnoringCase(liveRegionStatus, "polite") || equalIgnoringCase(liveRegionStatus, "assertive");
+    return equalLettersIgnoringASCIICase(liveRegionStatus, "polite") || equalLettersIgnoringASCIICase(liveRegionStatus, "assertive");
 }
     
 bool AccessibilityObject::supportsARIALiveRegion() const
@@ -2299,11 +2299,11 @@ AccessibilityObject* AccessibilityObject::focusedUIElement() const
 AccessibilitySortDirection AccessibilityObject::sortDirection() const
 {
     const AtomicString& sortAttribute = getAttribute(aria_sortAttr);
-    if (equalIgnoringCase(sortAttribute, "ascending"))
+    if (equalLettersIgnoringASCIICase(sortAttribute, "ascending"))
         return SortDirectionAscending;
-    if (equalIgnoringCase(sortAttribute, "descending"))
+    if (equalLettersIgnoringASCIICase(sortAttribute, "descending"))
         return SortDirectionDescending;
-    if (equalIgnoringCase(sortAttribute, "other"))
+    if (equalLettersIgnoringASCIICase(sortAttribute, "other"))
         return SortDirectionOther;
     
     return SortDirectionNone;
@@ -2358,14 +2358,14 @@ void AccessibilityObject::classList(Vector<String>& classList) const
 bool AccessibilityObject::supportsARIAPressed() const
 {
     const AtomicString& expanded = getAttribute(aria_pressedAttr);
-    return equalIgnoringCase(expanded, "true") || equalIgnoringCase(expanded, "false");
+    return equalLettersIgnoringASCIICase(expanded, "true") || equalLettersIgnoringASCIICase(expanded, "false");
 }
     
 bool AccessibilityObject::supportsExpanded() const
 {
     // Undefined values should not result in this attribute being exposed to ATs according to ARIA.
     const AtomicString& expanded = getAttribute(aria_expandedAttr);
-    if (equalIgnoringCase(expanded, "true") || equalIgnoringCase(expanded, "false"))
+    if (equalLettersIgnoringASCIICase(expanded, "true") || equalLettersIgnoringASCIICase(expanded, "false"))
         return true;
     switch (roleValue()) {
     case ComboBoxRole:
@@ -2379,7 +2379,7 @@ bool AccessibilityObject::supportsExpanded() const
     
 bool AccessibilityObject::isExpanded() const
 {
-    if (equalIgnoringCase(getAttribute(aria_expandedAttr), "true"))
+    if (equalLettersIgnoringASCIICase(getAttribute(aria_expandedAttr), "true"))
         return true;
     
     if (is<HTMLDetailsElement>(node()))
@@ -2410,17 +2410,17 @@ AccessibilityButtonState AccessibilityObject::checkboxOrRadioValue() const
 
     if (isToggleButton()) {
         const AtomicString& ariaPressed = getAttribute(aria_pressedAttr);
-        if (equalIgnoringCase(ariaPressed, "true"))
+        if (equalLettersIgnoringASCIICase(ariaPressed, "true"))
             return ButtonStateOn;
-        if (equalIgnoringCase(ariaPressed, "mixed"))
+        if (equalLettersIgnoringASCIICase(ariaPressed, "mixed"))
             return ButtonStateMixed;
         return ButtonStateOff;
     }
     
     const AtomicString& result = getAttribute(aria_checkedAttr);
-    if (equalIgnoringCase(result, "true"))
+    if (equalLettersIgnoringASCIICase(result, "true"))
         return ButtonStateOn;
-    if (equalIgnoringCase(result, "mixed")) {
+    if (equalLettersIgnoringASCIICase(result, "mixed")) {
         // ARIA says that radio, menuitemradio, and switch elements must NOT expose button state mixed.
         AccessibilityRole ariaRole = ariaRoleAttribute();
         if (ariaRole == RadioButtonRole || ariaRole == MenuItemRadioRole || ariaRole == SwitchRole)
@@ -2428,7 +2428,7 @@ AccessibilityButtonState AccessibilityObject::checkboxOrRadioValue() const
         return ButtonStateMixed;
     }
     
-    if (equalIgnoringCase(getAttribute(indeterminateAttr), "true"))
+    if (equalLettersIgnoringASCIICase(getAttribute(indeterminateAttr), "true"))
         return ButtonStateMixed;
     
     return ButtonStateOff;
@@ -2842,7 +2842,7 @@ bool AccessibilityObject::accessibilityIsIgnoredByDefault() const
 bool AccessibilityObject::isARIAHidden() const
 {
     for (const AccessibilityObject* object = this; object; object = object->parentObject()) {
-        if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true"))
+        if (equalLettersIgnoringASCIICase(object->getAttribute(aria_hiddenAttr), "true"))
             return true;
     }
     return false;
index a20e9c2..787ff34 100644 (file)
@@ -1052,7 +1052,7 @@ bool AccessibilityRenderObject::supportsARIADropping() const
 bool AccessibilityRenderObject::supportsARIADragging() const
 {
     const AtomicString& grabbed = getAttribute(aria_grabbedAttr);
-    return equalIgnoringCase(grabbed, "true") || equalIgnoringCase(grabbed, "false");   
+    return equalLettersIgnoringASCIICase(grabbed, "true") || equalLettersIgnoringASCIICase(grabbed, "false");
 }
 
 bool AccessibilityRenderObject::isARIAGrabbed()
@@ -1156,7 +1156,7 @@ AccessibilityObjectInclusion AccessibilityRenderObject::defaultObjectInclusion()
 
     if (m_renderer->style().visibility() != VISIBLE) {
         // aria-hidden is meant to override visibility as the determinant in AX hierarchy inclusion.
-        if (equalIgnoringCase(getAttribute(aria_hiddenAttr), "false"))
+        if (equalLettersIgnoringASCIICase(getAttribute(aria_hiddenAttr), "false"))
             return DefaultBehavior;
         
         return IgnoreObject;
@@ -1583,7 +1583,7 @@ bool AccessibilityRenderObject::elementAttributeValue(const QualifiedName& attri
     if (!m_renderer)
         return false;
     
-    return equalIgnoringCase(getAttribute(attributeName), "true");
+    return equalLettersIgnoringASCIICase(getAttribute(attributeName), "true");
 }
     
 bool AccessibilityRenderObject::isSelected() const
@@ -1591,12 +1591,10 @@ bool AccessibilityRenderObject::isSelected() const
     if (!m_renderer)
         return false;
     
-    Node* node = m_renderer->node();
-    if (!node)
+    if (!m_renderer->node())
         return false;
     
-    const AtomicString& ariaSelected = getAttribute(aria_selectedAttr);
-    if (equalIgnoringCase(ariaSelected, "true"))
+    if (equalLettersIgnoringASCIICase(getAttribute(aria_selectedAttr), "true"))
         return true;    
     
     if (isTabItem() && isTabItemSelected())
@@ -2558,11 +2556,8 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
         if (input.isDateField() || input.isTimeField())
             return PopUpButtonRole;
 #endif
-        
 #if ENABLE(INPUT_TYPE_COLOR)
-        // FIXME: Shouldn't this use input.isColorControl()?
-        const AtomicString& type = input.getAttribute(typeAttr);
-        if (equalIgnoringCase(type, "color"))
+        if (input.isColorControl())
             return ColorWellRole;
 #endif
     }
@@ -2728,11 +2723,11 @@ AccessibilityRole AccessibilityRenderObject::determineAccessibilityRole()
 AccessibilityOrientation AccessibilityRenderObject::orientation() const
 {
     const AtomicString& ariaOrientation = getAttribute(aria_orientationAttr);
-    if (equalIgnoringCase(ariaOrientation, "horizontal"))
+    if (equalLettersIgnoringASCIICase(ariaOrientation, "horizontal"))
         return AccessibilityOrientationHorizontal;
-    if (equalIgnoringCase(ariaOrientation, "vertical"))
+    if (equalLettersIgnoringASCIICase(ariaOrientation, "vertical"))
         return AccessibilityOrientationVertical;
-    if (equalIgnoringCase(ariaOrientation, "undefined"))
+    if (equalLettersIgnoringASCIICase(ariaOrientation, "undefined"))
         return AccessibilityOrientationUndefined;
 
     // ARIA 1.1 Implicit defaults are defined on some roles.
@@ -2832,7 +2827,7 @@ bool AccessibilityRenderObject::canSetExpandedAttribute() const
     
     // An object can be expanded if it aria-expanded is true or false.
     const AtomicString& ariaExpanded = getAttribute(aria_expandedAttr);
-    return equalIgnoringCase(ariaExpanded, "true") || equalIgnoringCase(ariaExpanded, "false");
+    return equalLettersIgnoringASCIICase(ariaExpanded, "true") || equalLettersIgnoringASCIICase(ariaExpanded, "false");
 }
 
 bool AccessibilityRenderObject::canSetValueAttribute() const
@@ -2846,10 +2841,10 @@ bool AccessibilityRenderObject::canSetValueAttribute() const
     if (isMeter())
         return false;
 
-    if (equalIgnoringCase(getAttribute(aria_readonlyAttr), "true"))
+    auto& readOnly = getAttribute(aria_readonlyAttr);
+    if (equalLettersIgnoringASCIICase(readOnly, "true"))
         return false;
-    
-    if (equalIgnoringCase(getAttribute(aria_readonlyAttr), "false"))
+    if (equalLettersIgnoringASCIICase(readOnly, "false"))
         return true;
 
     if (isProgressIndicator() || isSlider())
@@ -3190,10 +3185,11 @@ const AtomicString& AccessibilityRenderObject::ariaLiveRegionRelevant() const
 bool AccessibilityRenderObject::ariaLiveRegionAtomic() const
 {
     const AtomicString& atomic = getAttribute(aria_atomicAttr);
-    if (equalIgnoringCase(atomic, "true"))
+    if (equalLettersIgnoringASCIICase(atomic, "true"))
         return true;
-    if (equalIgnoringCase(atomic, "false"))
+    if (equalLettersIgnoringASCIICase(atomic, "false"))
         return false;
+
     // WAI-ARIA "alert" and "status" roles have an implicit aria-atomic value of true.
     switch (roleValue()) {
     case ApplicationAlertRole:
index 70dd0f9..287997b 100644 (file)
@@ -417,7 +417,7 @@ unsigned AccessibilityTableCell::ariaRowSpan() const
     
     // ARIA 1.1: Authors must set the value of aria-rowspan to an integer greater than or equal to 0.
     // Setting the value to 0 indicates that the cell or gridcell is to span all the remaining rows in the row group.
-    if (equalIgnoringCase(rowSpanValue, "0"))
+    if (rowSpanValue == "0")
         return 0;
     if (rowSpanValue.toInt() >= 1)
         return rowSpanValue.toInt();
index 24ff818..5d563b3 100644 (file)
@@ -757,7 +757,7 @@ RefPtr<CSSCalcValue> CSSCalcValue::create(CSSParserString name, CSSParserValueLi
     CSSCalcExpressionNodeParser parser;
     RefPtr<CSSCalcExpressionNode> expression;
 
-    if (name.equalIgnoringCase("calc(") || name.equalIgnoringCase("-webkit-calc("))
+    if (equalLettersIgnoringASCIICase(name, "calc(") || equalLettersIgnoringASCIICase(name, "-webkit-calc("))
         expression = parser.parseCalc(&parserValueList);
 
     return expression ? adoptRef(new CSSCalcValue(expression.releaseNonNull(), range != CalculationRangeAll)) : nullptr;
index 30b481d..2c20000 100644 (file)
 #ifndef CSSCalculationValue_h
 #define CSSCalculationValue_h
 
-#include "CSSParserValues.h"
 #include "CSSPrimitiveValue.h"
 #include "CalculationValue.h"
 
 namespace WebCore {
 
+class CSSParserValueList;
 class CSSToLengthConversionData;
 class RenderStyle;
 
+struct CSSParserString;
+
 enum CalculationCategory {
     CalcNumber = 0,
     CalcLength,
index 7c3d513..312d98e 100644 (file)
@@ -26,7 +26,6 @@
 #ifndef CSSCustomPropertyValue_h
 #define CSSCustomPropertyValue_h
 
-#include "CSSParserValues.h"
 #include "CSSValue.h"
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
index eb0ef12..14f2b16 100644 (file)
@@ -41,7 +41,7 @@ namespace WebCore {
 #if ENABLE(SVG_FONTS)
 bool CSSFontFaceSrcValue::isSVGFontFaceSrc() const
 {
-    return equalIgnoringCase(m_format, "svg");
+    return equalLettersIgnoringASCIICase(m_format, "svg");
 }
 
 bool CSSFontFaceSrcValue::isSVGFontTarget() const
index 65d48a9..fb53f75 100644 (file)
@@ -832,16 +832,17 @@ key_list:
 key:
     maybe_unary_operator PERCENTAGE { $$.id = CSSValueInvalid; $$.isInt = false; $$.fValue = $1 * $2; $$.unit = CSSPrimitiveValue::CSS_NUMBER; }
     | IDENT {
-        $$.id = CSSValueInvalid; $$.isInt = false; $$.unit = CSSPrimitiveValue::CSS_NUMBER;
-        CSSParserString& str = $1;
-        if (str.equalIgnoringCase("from"))
+        $$.id = CSSValueInvalid;
+        $$.isInt = false;
+        if (equalLettersIgnoringASCIICase($1, "from"))
             $$.fValue = 0;
-        else if (str.equalIgnoringCase("to"))
+        else if (equalLettersIgnoringASCIICase($1, "to"))
             $$.fValue = 100;
         else {
             $$.unit = 0;
             YYERROR;
         }
+        $$.unit = CSSPrimitiveValue::CSS_NUMBER;
     }
     | error {
         $$.unit = 0;
index d28696c..13e8e70 100644 (file)
@@ -167,31 +167,10 @@ namespace WebCore {
 static const unsigned INVALID_NUM_PARSED_PROPERTIES = UINT_MAX;
 static const double MAX_SCALE = 1000000;
 
-template <unsigned N>
-static bool equal(const CSSParserString& a, const char (&b)[N])
-{
-    unsigned length = N - 1; // Ignore the trailing null character
-    if (a.length() != length)
-        return false;
-
-    return a.is8Bit() ? WTF::equal(a.characters8(), reinterpret_cast<const LChar*>(b), length) : WTF::equal(a.characters16(), reinterpret_cast<const LChar*>(b), length);
-}
-
-template <unsigned N>
-static bool equalIgnoringCase(const CSSParserString& a, const char (&b)[N])
-{
-    unsigned length = N - 1; // Ignore the trailing null character
-    if (a.length() != length)
-        return false;
-
-    return a.is8Bit() ? WTF::equalIgnoringCase(b, a.characters8(), length) : WTF::equalIgnoringCase(b, a.characters16(), length);
-}
-
-template <unsigned N>
-static bool equalIgnoringCase(CSSParserValue& value, const char (&b)[N])
+template<unsigned length> bool equalLettersIgnoringASCIICase(const CSSParserValue& value, const char (&lowercaseLetters)[length])
 {
     ASSERT(value.unit == CSSPrimitiveValue::CSS_IDENT || value.unit == CSSPrimitiveValue::CSS_STRING);
-    return equalIgnoringCase(value.string, b);
+    return equalLettersIgnoringASCIICase(value.string, lowercaseLetters);
 }
 
 static bool hasPrefix(const char* string, unsigned length, const char* prefix)
@@ -2150,7 +2129,7 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
                 if (!uri.isNull())
                     image = CSSImageValue::create(completeURL(uri));
 #if ENABLE(CSS_IMAGE_SET) && ENABLE(MOUSE_CURSOR_SCALE)
-            } else if (value->unit == CSSParserValue::Function && equalIgnoringCase(value->function->name, "-webkit-image-set(")) {
+            } else if (value->unit == CSSParserValue::Function && equalLettersIgnoringASCIICase(value->function->name, "-webkit-image-set(")) {
                 image = parseImageSet();
                 if (!image)
                     break;
@@ -2283,7 +2262,7 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
                 return false;
         }
 #if ENABLE(CSS_IMAGE_SET)
-        else if (valueWithCalculation.value().unit == CSSParserValue::Function && equalIgnoringCase(valueWithCalculation.value().function->name, "-webkit-image-set(")) {
+        else if (valueWithCalculation.value().unit == CSSParserValue::Function && equalLettersIgnoringASCIICase(valueWithCalculation.value().function->name, "-webkit-image-set(")) {
             parsedValue = parseImageSet();
             if (!parsedValue)
                 return false;
@@ -3538,7 +3517,7 @@ bool CSSParser::parseNonElementSnapPoints(CSSPropertyID propId, bool important)
         else if (value->unit == CSSParserValue::Function
             && value->function->args
             && value->function->args->size() == 1
-            && equalIgnoringCase(value->function->name, "repeat(")) {
+            && equalLettersIgnoringASCIICase(value->function->name, "repeat(")) {
             ValueWithCalculation argumentWithCalculation(*value->function->args.get()->current());
             if (validateUnit(argumentWithCalculation, FLength | FPercent | FNonNeg)) {
                 values->append(CSSValuePool::singleton().createValue(LengthRepeat::create(createPrimitiveNumericValue(argumentWithCalculation))));
@@ -4213,7 +4192,7 @@ bool CSSParser::parseAlt(CSSPropertyID propID, bool important)
         CSSParserValueList* args = currentValue.function->args.get();
         if (!args)
             return false;
-        if (equalIgnoringCase(currentValue.function->name, "attr("))
+        if (equalLettersIgnoringASCIICase(currentValue.function->name, "attr("))
             parsedValue = parseAttr(*args);
     }
     
@@ -4270,20 +4249,20 @@ bool CSSParser::parseContent(CSSPropertyID propId, bool important)
             CSSParserValueList* args = value->function->args.get();
             if (!args)
                 return false;
-            if (equalIgnoringCase(value->function->name, "attr(")) {
+            if (equalLettersIgnoringASCIICase(value->function->name, "attr(")) {
                 parsedValue = parseAttr(*args);
                 if (!parsedValue)
                     return false;
-            } else if (equalIgnoringCase(value->function->name, "counter(")) {
+            } else if (equalLettersIgnoringASCIICase(value->function->name, "counter(")) {
                 parsedValue = parseCounterContent(*args, false);
                 if (!parsedValue)
                     return false;
-            } else if (equalIgnoringCase(value->function->name, "counters(")) {
+            } else if (equalLettersIgnoringASCIICase(value->function->name, "counters(")) {
                 parsedValue = parseCounterContent(*args, true);
                 if (!parsedValue)
                     return false;
 #if ENABLE(CSS_IMAGE_SET)
-            } else if (equalIgnoringCase(value->function->name, "-webkit-image-set(")) {
+            } else if (equalLettersIgnoringASCIICase(value->function->name, "-webkit-image-set(")) {
                 parsedValue = parseImageSet();
                 if (!parsedValue)
                     return false;
@@ -4379,7 +4358,7 @@ bool CSSParser::parseFillImage(CSSParserValueList& valueList, RefPtr<CSSValue>&
         return parseGeneratedImage(valueList, value);
     
 #if ENABLE(CSS_IMAGE_SET)
-    if (valueList.current()->unit == CSSParserValue::Function && equalIgnoringCase(valueList.current()->function->name, "-webkit-image-set(")) {
+    if (valueList.current()->unit == CSSParserValue::Function && equalLettersIgnoringASCIICase(valueList.current()->function->name, "-webkit-image-set(")) {
         value = parseImageSet();
         if (value)
             return true;
@@ -5059,7 +5038,7 @@ RefPtr<CSSValue> CSSParser::parseAnimationName()
 {
     CSSParserValue& value = *m_valueList->current();
     if (value.unit == CSSPrimitiveValue::CSS_STRING || value.unit == CSSPrimitiveValue::CSS_IDENT) {
-        if (value.id == CSSValueNone || (value.unit == CSSPrimitiveValue::CSS_STRING && equalIgnoringCase(value, "none"))) {
+        if (value.id == CSSValueNone || (value.unit == CSSPrimitiveValue::CSS_STRING && equalLettersIgnoringASCIICase(value, "none"))) {
             return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
         }
         return createPrimitiveStringValue(value);
@@ -5087,7 +5066,7 @@ RefPtr<CSSValue> CSSParser::parseAnimationTrigger()
 
     CSSParserValueList* args = value->function->args.get();
 
-    if (equalIgnoringCase(value->function->name, "container-scroll(")) {
+    if (equalLettersIgnoringASCIICase(value->function->name, "container-scroll(")) {
         if (!args || (args->size() != 1 && args->size() != 3))
             return nullptr;
 
@@ -5128,11 +5107,11 @@ RefPtr<CSSValue> CSSParser::parseAnimationProperty(AnimationParseContext& contex
     CSSPropertyID result = cssPropertyID(value.string);
     if (result && result != CSSPropertyAll) // "all" value in animation is not equivalent to the all property.
         return CSSValuePool::singleton().createIdentifierValue(result);
-    if (equalIgnoringCase(value, "all")) {
+    if (equalLettersIgnoringASCIICase(value, "all")) {
         context.sawAnimationPropertyKeyword();
         return CSSValuePool::singleton().createIdentifierValue(CSSValueAll);
     }
-    if (equalIgnoringCase(value, "none")) {
+    if (equalLettersIgnoringASCIICase(value, "none")) {
         context.commitAnimationPropertyKeyword();
         context.sawAnimationPropertyKeyword();
         return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
@@ -5151,9 +5130,9 @@ Vector<double> CSSParser::parseKeyframeSelector(const String& selector) {
         String cur = strings[i].stripWhiteSpace();
 
         // For now the syntax MUST be 'xxx%' or 'from' or 'to', where xxx is a legal floating point number
-        if (equalIgnoringCase(cur, "from"))
+        if (equalLettersIgnoringASCIICase(cur, "from"))
             key = 0;
-        else if (equalIgnoringCase(cur, "to"))
+        else if (equalLettersIgnoringASCIICase(cur, "to"))
             key = 1;
         else if (cur.endsWith('%')) {
             double k = cur.substring(0, cur.length() - 1).toDouble();
@@ -5218,7 +5197,7 @@ RefPtr<CSSValue> CSSParser::parseAnimationTimingFunction()
 
     CSSParserValueList* args = value.function->args.get();
 
-    if (equalIgnoringCase(value.function->name, "steps(")) {
+    if (equalLettersIgnoringASCIICase(value.function->name, "steps(")) {
         // For steps, 1 or 2 params must be specified (comma-separated)
         if (!args || (args->size() != 1 && args->size() != 3))
             return nullptr;
@@ -5249,7 +5228,7 @@ RefPtr<CSSValue> CSSParser::parseAnimationTimingFunction()
         return CSSStepsTimingFunctionValue::create(numSteps, stepAtStart);
     }
 
-    if (equalIgnoringCase(value.function->name, "cubic-bezier(")) {
+    if (equalLettersIgnoringASCIICase(value.function->name, "cubic-bezier(")) {
         // For cubic bezier, 4 values must be specified.
         if (!args || args->size() != 7)
             return nullptr;
@@ -5827,7 +5806,7 @@ RefPtr<CSSValue> CSSParser::parseGridTrackList()
     while (CSSParserValue* currentValue = m_valueList->current()) {
         if (isForwardSlashOperator(*currentValue))
             break;
-        if (currentValue->unit == CSSParserValue::Function && equalIgnoringCase(currentValue->function->name, "repeat(")) {
+        if (currentValue->unit == CSSParserValue::Function && equalLettersIgnoringASCIICase(currentValue->function->name, "repeat(")) {
             if (!parseGridTrackRepeatFunction(*values))
                 return nullptr;
         } else {
@@ -5913,7 +5892,7 @@ RefPtr<CSSValue> CSSParser::parseGridTrackSize(CSSParserValueList& inputList)
     if (currentValue.id == CSSValueAuto)
         return CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
 
-    if (currentValue.unit == CSSParserValue::Function && equalIgnoringCase(currentValue.function->name, "minmax(")) {
+    if (currentValue.unit == CSSParserValue::Function && equalLettersIgnoringASCIICase(currentValue.function->name, "minmax(")) {
         // The spec defines the following grammar: minmax( <track-breadth> , <track-breadth> )
         CSSParserValueList* arguments = currentValue.function->args.get();
         if (!arguments || arguments->size() != 3 || !isComma(arguments->valueAt(1)))
@@ -6066,7 +6045,7 @@ bool CSSParser::parseDashboardRegions(CSSPropertyID propId, bool important)
         // dashboard-region(label, type) or dashboard-region(label type)
         // dashboard-region(label, type) or dashboard-region(label type)
         CSSParserValueList* args = value->function->args.get();
-        if (!equalIgnoringCase(value->function->name, "dashboard-region(") || !args) {
+        if (!equalLettersIgnoringASCIICase(value->function->name, "dashboard-region(") || !args) {
             valid = false;
             break;
         }
@@ -6095,9 +6074,9 @@ bool CSSParser::parseDashboardRegions(CSSPropertyID propId, bool important)
             break;
         }
 
-        if (equalIgnoringCase(*arg, "circle"))
+        if (equalLettersIgnoringASCIICase(*arg, "circle"))
             region->m_isCircle = true;
-        else if (equalIgnoringCase(*arg, "rectangle"))
+        else if (equalLettersIgnoringASCIICase(*arg, "rectangle"))
             region->m_isRectangle = true;
         else {
             valid = false;
@@ -6325,7 +6304,7 @@ bool CSSParser::parseClipShape(CSSPropertyID propId, bool important)
     CSSParserValue& value = *m_valueList->current();
     CSSParserValueList* args = value.function->args.get();
 
-    if (!equalIgnoringCase(value.function->name, "rect(") || !args)
+    if (!equalLettersIgnoringASCIICase(value.function->name, "rect(") || !args)
         return false;
 
     // rect(t, r, b, l) || rect(t r b l)
@@ -6454,7 +6433,7 @@ RefPtr<CSSBasicShape> CSSParser::parseBasicShapeInset(CSSParserValueList& args)
     Vector<RefPtr<CSSPrimitiveValue> > widthArguments;
     bool hasRoundedInset = false;
     while (argument) {
-        if (argument->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(argument->string, "round")) {
+        if (argument->unit == CSSPrimitiveValue::CSS_IDENT && equalLettersIgnoringASCIICase(argument->string, "round")) {
             hasRoundedInset = true;
             break;
         }
@@ -6779,15 +6758,15 @@ RefPtr<CSSPrimitiveValue> CSSParser::parseBasicShape()
         return nullptr;
 
     RefPtr<CSSBasicShape> shape;
-    if (equalIgnoringCase(value.function->name, "circle("))
+    if (equalLettersIgnoringASCIICase(value.function->name, "circle("))
         shape = parseBasicShapeCircle(*args);
-    else if (equalIgnoringCase(value.function->name, "ellipse("))
+    else if (equalLettersIgnoringASCIICase(value.function->name, "ellipse("))
         shape = parseBasicShapeEllipse(*args);
-    else if (equalIgnoringCase(value.function->name, "polygon("))
+    else if (equalLettersIgnoringASCIICase(value.function->name, "polygon("))
         shape = parseBasicShapePolygon(*args);
-    else if (equalIgnoringCase(value.function->name, "path("))
+    else if (equalLettersIgnoringASCIICase(value.function->name, "path("))
         shape = parseBasicShapePath(*args);
-    else if (equalIgnoringCase(value.function->name, "inset("))
+    else if (equalLettersIgnoringASCIICase(value.function->name, "inset("))
         shape = parseBasicShapeInset(*args);
 
     if (!shape)
@@ -7115,7 +7094,7 @@ bool CSSParser::parseFontFaceSrcURI(CSSValueList& valueList)
         return true;
     }
 
-    if (value->unit != CSSParserValue::Function || !equalIgnoringCase(value->function->name, "format("))
+    if (value->unit != CSSParserValue::Function || !equalLettersIgnoringASCIICase(value->function->name, "format("))
         return false;
 
     // FIXME: http://www.w3.org/TR/2011/WD-css3-fonts-20111004/ says that format() contains a comma-separated list of strings,
@@ -7167,7 +7146,7 @@ bool CSSParser::parseFontFaceSrc()
         if (value->unit == CSSPrimitiveValue::CSS_URI) {
             if (!parseFontFaceSrcURI(*values))
                 return false;
-        } else if (value->unit == CSSParserValue::Function && equalIgnoringCase(value->function->name, "local(")) {
+        } else if (value->unit == CSSParserValue::Function && equalLettersIgnoringASCIICase(value->function->name, "local(")) {
             if (!parseFontFaceSrcLocal(*values))
                 return false;
         } else
@@ -7593,9 +7572,9 @@ inline double CSSParser::parsedDouble(ValueWithCalculation& valueWithCalculation
 
 bool CSSParser::isCalculation(CSSParserValue& value)
 {
-    return (value.unit == CSSParserValue::Function)
-        && (equalIgnoringCase(value.function->name, "calc(")
-            || equalIgnoringCase(value.function->name, "-webkit-calc("));
+    return value.unit == CSSParserValue::Function
+        && (equalLettersIgnoringASCIICase(value.function->name, "calc(")
+            || equalLettersIgnoringASCIICase(value.function->name, "-webkit-calc("));
 }
 
 inline int CSSParser::colorIntFromValue(ValueWithCalculation& valueWithCalculation)
@@ -7721,7 +7700,7 @@ bool CSSParser::parseColorFromValue(CSSParserValue& value, RGBA32& c)
     } else if (value.unit == CSSParserValue::Function
         && value.function->args
         && value.function->args->size() == 5 /* rgb + two commas */
-        && equalIgnoringCase(value.function->name, "rgb(")) {
+        && equalLettersIgnoringASCIICase(value.function->name, "rgb(")) {
         int colorValues[3];
         if (!parseColorParameters(value, colorValues, false))
             return false;
@@ -7730,7 +7709,7 @@ bool CSSParser::parseColorFromValue(CSSParserValue& value, RGBA32& c)
         if (value.unit == CSSParserValue::Function
             && value.function->args
             && value.function->args->size() == 7 /* rgba + three commas */
-            && equalIgnoringCase(value.function->name, "rgba(")) {
+            && equalLettersIgnoringASCIICase(value.function->name, "rgba(")) {
             int colorValues[4];
             if (!parseColorParameters(value, colorValues, true))
                 return false;
@@ -7738,7 +7717,7 @@ bool CSSParser::parseColorFromValue(CSSParserValue& value, RGBA32& c)
         } else if (value.unit == CSSParserValue::Function
             && value.function->args
             && value.function->args->size() == 5 /* hsl + two commas */
-            && equalIgnoringCase(value.function->name, "hsl(")) {
+            && equalLettersIgnoringASCIICase(value.function->name, "hsl(")) {
             double colorValues[3];
             if (!parseHSLParameters(value, colorValues, false))
                 return false;
@@ -7746,7 +7725,7 @@ bool CSSParser::parseColorFromValue(CSSParserValue& value, RGBA32& c)
         } else if (value.unit == CSSParserValue::Function
             && value.function->args
             && value.function->args->size() == 7 /* hsla + three commas */
-            && equalIgnoringCase(value.function->name, "hsla(")) {
+            && equalLettersIgnoringASCIICase(value.function->name, "hsla(")) {
             double colorValues[4];
             if (!parseHSLParameters(value, colorValues, true))
                 return false;
@@ -8179,7 +8158,7 @@ bool CSSParser::parseBorderImage(CSSPropertyID propId, RefPtr<CSSValue>& result,
                 else
                     return false;
 #if ENABLE(CSS_IMAGE_SET)
-            } else if (currentValue->unit == CSSParserValue::Function && equalIgnoringCase(currentValue->function->name, "-webkit-image-set(")) {
+            } else if (currentValue->unit == CSSParserValue::Function && equalLettersIgnoringASCIICase(currentValue->function->name, "-webkit-image-set(")) {
                 RefPtr<CSSValue> value = parseImageSet();
                 if (value)
                     context.commitImage(value.release());
@@ -8638,13 +8617,13 @@ static PassRefPtr<CSSPrimitiveValue> parseDeprecatedGradientPoint(CSSParserValue
 {
     RefPtr<CSSPrimitiveValue> result;
     if (value.unit == CSSPrimitiveValue::CSS_IDENT) {
-        if ((equalIgnoringCase(value, "left") && horizontal)
-            || (equalIgnoringCase(value, "top") && !horizontal))
+        if ((equalLettersIgnoringASCIICase(value, "left") && horizontal)
+            || (equalLettersIgnoringASCIICase(value, "top") && !horizontal))
             result = CSSValuePool::singleton().createValue(0., CSSPrimitiveValue::CSS_PERCENTAGE);
-        else if ((equalIgnoringCase(value, "right") && horizontal)
-            || (equalIgnoringCase(value, "bottom") && !horizontal))
+        else if ((equalLettersIgnoringASCIICase(value, "right") && horizontal)
+            || (equalLettersIgnoringASCIICase(value, "bottom") && !horizontal))
             result = CSSValuePool::singleton().createValue(100., CSSPrimitiveValue::CSS_PERCENTAGE);
-        else if (equalIgnoringCase(value, "center"))
+        else if (equalLettersIgnoringASCIICase(value, "center"))
             result = CSSValuePool::singleton().createValue(50., CSSPrimitiveValue::CSS_PERCENTAGE);
     } else if (value.unit == CSSPrimitiveValue::CSS_NUMBER || value.unit == CSSPrimitiveValue::CSS_PERCENTAGE)
         result = CSSValuePool::singleton().createValue(value.fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value.unit));
@@ -8656,22 +8635,22 @@ static bool parseDeprecatedGradientColorStop(CSSParser& parser, CSSParserValue&
     if (value.unit != CSSParserValue::Function)
         return false;
 
-    if (!equalIgnoringCase(value.function->name, "from(")
-        && !equalIgnoringCase(value.function->name, "to(")
-        && !equalIgnoringCase(value.function->name, "color-stop("))
+    if (!equalLettersIgnoringASCIICase(value.function->name, "from(")
+        && !equalLettersIgnoringASCIICase(value.function->name, "to(")
+        && !equalLettersIgnoringASCIICase(value.function->name, "color-stop("))
         return false;
 
     CSSParserValueList* args = value.function->args.get();
     if (!args)
         return false;
 
-    if (equalIgnoringCase(value.function->name, "from(")
-        || equalIgnoringCase(value.function->name, "to(")) {
+    if (equalLettersIgnoringASCIICase(value.function->name, "from(")
+        || equalLettersIgnoringASCIICase(value.function->name, "to(")) {
         // The "from" and "to" stops expect 1 argument.
         if (args->size() != 1)
             return false;
 
-        if (equalIgnoringCase(value.function->name, "from("))
+        if (equalLettersIgnoringASCIICase(value.function->name, "from("))
             stop.m_position = CSSValuePool::singleton().createValue(0, CSSPrimitiveValue::CSS_NUMBER);
         else
             stop.m_position = CSSValuePool::singleton().createValue(1, CSSPrimitiveValue::CSS_NUMBER);
@@ -8686,7 +8665,7 @@ static bool parseDeprecatedGradientColorStop(CSSParser& parser, CSSParserValue&
     }
 
     // The "color-stop" function expects 3 arguments.
-    if (equalIgnoringCase(value.function->name, "color-stop(")) {
+    if (equalLettersIgnoringASCIICase(value.function->name, "color-stop(")) {
         if (args->size() != 3)
             return false;
 
@@ -8727,9 +8706,9 @@ bool CSSParser::parseDeprecatedGradient(CSSParserValueList& valueList, RefPtr<CS
     CSSParserValue* argument = args->current();
     if (!argument || argument->unit != CSSPrimitiveValue::CSS_IDENT)
         return false;
-    if (equalIgnoringCase(*argument, "linear"))
+    if (equalLettersIgnoringASCIICase(*argument, "linear"))
         gradientType = CSSDeprecatedLinearGradient;
-    else if (equalIgnoringCase(*argument, "radial"))
+    else if (equalLettersIgnoringASCIICase(*argument, "radial"))
         gradientType = CSSDeprecatedRadialGradient;
     else
         return false;
@@ -9090,7 +9069,7 @@ bool CSSParser::parseLinearGradient(CSSParserValueList& valueList, RefPtr<CSSVal
 
         args->next();
         expectComma = true;
-    } else if (firstArgumentWithCalculation.value().unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(firstArgumentWithCalculation, "to")) {
+    } else if (firstArgumentWithCalculation.value().unit == CSSPrimitiveValue::CSS_IDENT && equalLettersIgnoringASCIICase(firstArgumentWithCalculation, "to")) {
         // to [ [left | right] || [top | bottom] ]
         CSSParserValue* nextArgument = args->next();
         if (!nextArgument)
@@ -9239,7 +9218,7 @@ bool CSSParser::parseRadialGradient(CSSParserValueList& valueList, RefPtr<CSSVal
     // at <position>
     RefPtr<CSSValue> centerX;
     RefPtr<CSSValue> centerY;
-    if (argument->unit == CSSPrimitiveValue::CSS_IDENT && equalIgnoringCase(*argument, "at")) {
+    if (argument->unit == CSSPrimitiveValue::CSS_IDENT && equalLettersIgnoringASCIICase(*argument, "at")) {
         argument = args->next();
         if (!argument)
             return false;
@@ -9325,20 +9304,20 @@ bool CSSParser::isGeneratedImageValue(CSSParserValue& value) const
     if (value.unit != CSSParserValue::Function)
         return false;
 
-    return equalIgnoringCase(value.function->name, "-webkit-gradient(")
-        || equalIgnoringCase(value.function->name, "-webkit-linear-gradient(")
-        || equalIgnoringCase(value.function->name, "linear-gradient(")
-        || equalIgnoringCase(value.function->name, "-webkit-repeating-linear-gradient(")
-        || equalIgnoringCase(value.function->name, "repeating-linear-gradient(")
-        || equalIgnoringCase(value.function->name, "-webkit-radial-gradient(")
-        || equalIgnoringCase(value.function->name, "radial-gradient(")
-        || equalIgnoringCase(value.function->name, "-webkit-repeating-radial-gradient(")
-        || equalIgnoringCase(value.function->name, "repeating-radial-gradient(")
-        || equalIgnoringCase(value.function->name, "-webkit-canvas(")
-        || equalIgnoringCase(value.function->name, "-webkit-cross-fade(")
-        || equalIgnoringCase(value.function->name, "filter(")
-        || equalIgnoringCase(value.function->name, "-webkit-filter(")
-        || equalIgnoringCase(value.function->name, "-webkit-named-image(");
+    return equalLettersIgnoringASCIICase(value.function->name, "-webkit-gradient(")
+        || equalLettersIgnoringASCIICase(value.function->name, "-webkit-linear-gradient(")
+        || equalLettersIgnoringASCIICase(value.function->name, "linear-gradient(")
+        || equalLettersIgnoringASCIICase(value.function->name, "-webkit-repeating-linear-gradient(")
+        || equalLettersIgnoringASCIICase(value.function->name, "repeating-linear-gradient(")
+        || equalLettersIgnoringASCIICase(value.function->name, "-webkit-radial-gradient(")
+        || equalLettersIgnoringASCIICase(value.function->name, "radial-gradient(")
+        || equalLettersIgnoringASCIICase(value.function->name, "-webkit-repeating-radial-gradient(")
+        || equalLettersIgnoringASCIICase(value.function->name, "repeating-radial-gradient(")
+        || equalLettersIgnoringASCIICase(value.function->name, "-webkit-canvas(")
+        || equalLettersIgnoringASCIICase(value.function->name, "-webkit-cross-fade(")
+        || equalLettersIgnoringASCIICase(value.function->name, "filter(")
+        || equalLettersIgnoringASCIICase(value.function->name, "-webkit-filter(")
+        || equalLettersIgnoringASCIICase(value.function->name, "-webkit-named-image(");
 }
 
 bool CSSParser::parseGeneratedImage(CSSParserValueList& valueList, RefPtr<CSSValue>& value)
@@ -9348,43 +9327,43 @@ bool CSSParser::parseGeneratedImage(CSSParserValueList& valueList, RefPtr<CSSVal
     if (parserValue.unit != CSSParserValue::Function)
         return false;
 
-    if (equalIgnoringCase(parserValue.function->name, "-webkit-gradient("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-gradient("))
         return parseDeprecatedGradient(valueList, value);
 
-    if (equalIgnoringCase(parserValue.function->name, "-webkit-linear-gradient("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-linear-gradient("))
         return parseDeprecatedLinearGradient(valueList, value, NonRepeating);
 
-    if (equalIgnoringCase(parserValue.function->name, "linear-gradient("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "linear-gradient("))
         return parseLinearGradient(valueList, value, NonRepeating);
 
-    if (equalIgnoringCase(parserValue.function->name, "-webkit-repeating-linear-gradient("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-repeating-linear-gradient("))
         return parseDeprecatedLinearGradient(valueList, value, Repeating);
 
-    if (equalIgnoringCase(parserValue.function->name, "repeating-linear-gradient("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "repeating-linear-gradient("))
         return parseLinearGradient(valueList, value, Repeating);
 
-    if (equalIgnoringCase(parserValue.function->name, "-webkit-radial-gradient("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-radial-gradient("))
         return parseDeprecatedRadialGradient(valueList, value, NonRepeating);
 
-    if (equalIgnoringCase(parserValue.function->name, "radial-gradient("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "radial-gradient("))
         return parseRadialGradient(valueList, value, NonRepeating);
 
-    if (equalIgnoringCase(parserValue.function->name, "-webkit-repeating-radial-gradient("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-repeating-radial-gradient("))
         return parseDeprecatedRadialGradient(valueList, value, Repeating);
 
-    if (equalIgnoringCase(parserValue.function->name, "repeating-radial-gradient("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "repeating-radial-gradient("))
         return parseRadialGradient(valueList, value, Repeating);
 
-    if (equalIgnoringCase(parserValue.function->name, "-webkit-canvas("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-canvas("))
         return parseCanvas(valueList, value);
 
-    if (equalIgnoringCase(parserValue.function->name, "-webkit-cross-fade("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-cross-fade("))
         return parseCrossfade(valueList, value);
 
-    if (equalIgnoringCase(parserValue.function->name, "filter(") || equalIgnoringCase(parserValue.function->name, "-webkit-filter("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "filter(") || equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-filter("))
         return parseFilterImage(valueList, value);
 
-    if (equalIgnoringCase(parserValue.function->name, "-webkit-named-image("))
+    if (equalLettersIgnoringASCIICase(parserValue.function->name, "-webkit-named-image("))
         return parseNamedImage(valueList, value);
 
     return false;
@@ -9957,25 +9936,25 @@ bool CSSParser::isCompositeOperator(CSSValueID valueID)
 
 static void filterInfoForName(const CSSParserString& name, WebKitCSSFilterValue::FilterOperationType& filterType, unsigned& maximumArgumentCount)
 {
-    if (equalIgnoringCase(name, "grayscale("))
+    if (equalLettersIgnoringASCIICase(name, "grayscale("))
         filterType = WebKitCSSFilterValue::GrayscaleFilterOperation;
-    else if (equalIgnoringCase(name, "sepia("))
+    else if (equalLettersIgnoringASCIICase(name, "sepia("))
         filterType = WebKitCSSFilterValue::SepiaFilterOperation;
-    else if (equalIgnoringCase(name, "saturate("))
+    else if (equalLettersIgnoringASCIICase(name, "saturate("))
         filterType = WebKitCSSFilterValue::SaturateFilterOperation;
-    else if (equalIgnoringCase(name, "hue-rotate("))
+    else if (equalLettersIgnoringASCIICase(name, "hue-rotate("))
         filterType = WebKitCSSFilterValue::HueRotateFilterOperation;
-    else if (equalIgnoringCase(name, "invert("))
+    else if (equalLettersIgnoringASCIICase(name, "invert("))
         filterType = WebKitCSSFilterValue::InvertFilterOperation;
-    else if (equalIgnoringCase(name, "opacity("))
+    else if (equalLettersIgnoringASCIICase(name, "opacity("))
         filterType = WebKitCSSFilterValue::OpacityFilterOperation;
-    else if (equalIgnoringCase(name, "brightness("))
+    else if (equalLettersIgnoringASCIICase(name, "brightness("))
         filterType = WebKitCSSFilterValue::BrightnessFilterOperation;
-    else if (equalIgnoringCase(name, "contrast("))
+    else if (equalLettersIgnoringASCIICase(name, "contrast("))
         filterType = WebKitCSSFilterValue::ContrastFilterOperation;
-    else if (equalIgnoringCase(name, "blur("))
+    else if (equalLettersIgnoringASCIICase(name, "blur("))
         filterType = WebKitCSSFilterValue::BlurFilterOperation;
-    else if (equalIgnoringCase(name, "drop-shadow(")) {
+    else if (equalLettersIgnoringASCIICase(name, "drop-shadow(")) {
         filterType = WebKitCSSFilterValue::DropShadowFilterOperation;
         maximumArgumentCount = 4;  // x-offset, y-offset, blur-radius, color -- spread and inset style not allowed.
     }
@@ -10116,11 +10095,11 @@ bool CSSParser::parseFilter(CSSParserValueList& valueList, RefPtr<CSSValue>& res
 #if ENABLE(CSS_REGIONS)
 static bool validFlowName(const String& flowName)
 {
-    return !(equalIgnoringCase(flowName, "auto")
-            || equalIgnoringCase(flowName, "default")
-            || equalIgnoringCase(flowName, "inherit")
-            || equalIgnoringCase(flowName, "initial")
-            || equalIgnoringCase(flowName, "none"));
+    return !(equalLettersIgnoringASCIICase(flowName, "auto")
+        || equalLettersIgnoringASCIICase(flowName, "default")
+        || equalLettersIgnoringASCIICase(flowName, "inherit")
+        || equalLettersIgnoringASCIICase(flowName, "initial")
+        || equalLettersIgnoringASCIICase(flowName, "none"));
 }
 #endif
 
@@ -12364,7 +12343,7 @@ restartAfterComment:
                 }
             }
         }
-        if (m_parsingMode == NthChildMode && m_token == IDENT && yylval->string.length() == 2 && yylval->string.equalIgnoringCase("of")) {
+        if (m_parsingMode == NthChildMode && m_token == IDENT && yylval->string.length() == 2 && equalLettersIgnoringASCIICase(yylval->string, "of")) {
             m_parsingMode = NormalMode;
             m_token = NTHCHILDSELECTORSEPARATOR;
         }
@@ -12647,7 +12626,7 @@ restartAfterComment:
             parseIdentifier(result, yylval->string, hasEscape);
             m_token = IDENT;
         }
-        if (m_parsingMode == NthChildMode && m_token == IDENT && yylval->string.length() == 2 && yylval->string.equalIgnoringCase("of")) {
+        if (m_parsingMode == NthChildMode && m_token == IDENT && yylval->string.length() == 2 && equalLettersIgnoringASCIICase(yylval->string, "of")) {
             m_parsingMode = NormalMode;
             m_token = NTHCHILDSELECTORSEPARATOR;
         }
@@ -13642,8 +13621,10 @@ bool isValidNthToken(const CSSParserString& token)
     // However, since the {ident} rule precedes the {nth} rule, some of those
     // tokens are identified as string literal. Furthermore we need to accept
     // "odd" and "even" which does not match to an+b.
-    return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
-        || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
+    return equalLettersIgnoringASCIICase(token, "odd")
+        || equalLettersIgnoringASCIICase(token, "even")
+        || equalLettersIgnoringASCIICase(token, "n")
+        || equalLettersIgnoringASCIICase(token, "-n");
 }
 
 }
index fd9b9d5..e8f20e6 100644 (file)
@@ -182,11 +182,11 @@ PassRefPtr<CSSValue> CSSParserValue::createCSSValue()
 CSSParserSelector* CSSParserSelector::parsePagePseudoSelector(const CSSParserString& pseudoTypeString)
 {
     CSSSelector::PagePseudoClassType pseudoType;
-    if (pseudoTypeString.equalIgnoringCase("first"))
+    if (equalLettersIgnoringASCIICase(pseudoTypeString, "first"))
         pseudoType = CSSSelector::PagePseudoClassFirst;
-    else if (pseudoTypeString.equalIgnoringCase("left"))
+    else if (equalLettersIgnoringASCIICase(pseudoTypeString, "left"))
         pseudoType = CSSSelector::PagePseudoClassLeft;
-    else if (pseudoTypeString.equalIgnoringCase("right"))
+    else if (equalLettersIgnoringASCIICase(pseudoTypeString, "right"))
         pseudoType = CSSSelector::PagePseudoClassRight;
     else
         return nullptr;
index ce9b532..ecb79ac 100644 (file)
@@ -107,6 +107,8 @@ struct CSSParserString {
     bool m_is8Bit;
 };
 
+template<unsigned length> bool equalLettersIgnoringASCIICase(const CSSParserString&, const char (&lowercaseLetters)[length]);
+
 struct CSSParserFunction;
 struct CSSParserVariable;
 
@@ -275,6 +277,12 @@ inline void CSSParserValue::setFromValueList(std::unique_ptr<CSSParserValueList>
     this->valueList = valueList.release();
     unit = ValueList;
 }
+
+template<unsigned length> inline bool equalLettersIgnoringASCIICase(const CSSParserString& string, const char (&lowercaseLetters)[length])
+{
+    return WTF::equalLettersIgnoringASCIICaseCommon(string, lowercaseLetters);
+}
+
 }
 
 #endif
index d2753be..0b0647c 100644 (file)
@@ -26,7 +26,6 @@
 #ifndef CSSVariableDependentValue_h
 #define CSSVariableDependentValue_h
 
-#include "CSSParserValues.h"
 #include "CSSPropertyNames.h"
 #include "CSSValueList.h"
 #include <wtf/RefPtr.h>
index 2834f69..b7bdb10 100644 (file)
@@ -322,7 +322,7 @@ void reportMediaQueryWarningIfNeeded(Document* document, const MediaQuerySet* me
     for (size_t i = 0; i < queryCount; ++i) {
         const MediaQuery* query = mediaQueries[i].get();
         String mediaType = query->mediaType();
-        if (!query->ignored() && !equalIgnoringCase(mediaType, "print")) {
+        if (!query->ignored() && !equalLettersIgnoringASCIICase(mediaType, "print")) {
             auto& expressions = query->expressions();
             for (size_t j = 0; j < expressions.size(); ++j) {
                 const MediaQueryExp* exp = expressions.at(j).get();
index 49ff022..99b54ae 100644 (file)
@@ -104,7 +104,7 @@ MediaQueryEvaluator::~MediaQueryEvaluator()
 bool MediaQueryEvaluator::mediaTypeMatch(const String& mediaTypeToMatch) const
 {
     return mediaTypeToMatch.isEmpty()
-        || equalIgnoringCase(mediaTypeToMatch, "all")
+        || equalLettersIgnoringASCIICase(mediaTypeToMatch, "all")
         || equalIgnoringCase(mediaTypeToMatch, m_mediaType);
 }
 
@@ -113,7 +113,7 @@ bool MediaQueryEvaluator::mediaTypeMatchSpecific(const char* mediaTypeToMatch) c
     // Like mediaTypeMatch, but without the special cases for "" and "all".
     ASSERT(mediaTypeToMatch);
     ASSERT(mediaTypeToMatch[0] != '\0');
-    ASSERT(!equalIgnoringCase(mediaTypeToMatch, String("all")));
+    ASSERT(!equalLettersIgnoringASCIICase(StringView(mediaTypeToMatch), "all"));
     return equalIgnoringCase(mediaTypeToMatch, m_mediaType);
 }
 
@@ -332,9 +332,9 @@ static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op)
     // in the query. Thus, if if the document's media type is "print", the
     // media type of the query will either be "print" or "all".
     String mediaType = view->mediaType();
-    if (equalIgnoringCase(mediaType, "screen"))
+    if (equalLettersIgnoringASCIICase(mediaType, "screen"))
         deviceScaleFactor = frame->page()->deviceScaleFactor();
-    else if (equalIgnoringCase(mediaType, "print")) {
+    else if (equalLettersIgnoringASCIICase(mediaType, "print")) {
         // The resolution of images while printing should not depend on the dpi
         // of the screen. Until we support proper ways of querying this info
         // we use 300px which is considered minimum for current printers.
index 8d81ace..7f1b7c4 100644 (file)
 #ifndef SelectorPseudoTypeMap_h
 #define SelectorPseudoTypeMap_h
 
-#include "CSSParserValues.h"
 #include "CSSSelector.h"
 
 namespace WebCore {
 
+struct CSSParserString;
+
 struct PseudoClassOrCompatibilityPseudoElement {
     CSSSelector::PseudoClassType pseudoClass;
     CSSSelector::PseudoElementType compatibilityPseudoElement;
index f6f7316..395be91 100644 (file)
@@ -1025,7 +1025,7 @@ inline FontFeatureSettings StyleBuilderConverter::convertFontFeatureSettings(Sty
 #if PLATFORM(IOS)
 inline bool StyleBuilderConverter::convertTouchCallout(StyleResolver&, CSSValue& value)
 {
-    return !equalIgnoringCase(downcast<CSSPrimitiveValue>(value).getStringValue(), "none");
+    return !equalLettersIgnoringASCIICase(downcast<CSSPrimitiveValue>(value).getStringValue(), "none");
 }
 #endif
 
index a56f8a2..63cffe4 100644 (file)
@@ -91,6 +91,8 @@ output_file.write("""
 #include "config.h"
 #include "SelectorPseudoTypeMap.h"
 
+#include "CSSParserValues.h"
+
 #if defined(__clang__)
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wunknown-pragmas"
index 9e4efd0..15479bd 100644 (file)
@@ -3342,7 +3342,7 @@ void Document::updateViewportArguments()
 // FIXME: Find a better place for this functionality.
 void setParserFeature(const String& key, const String& value, Document* document, void*)
 {
-    if (key == "telephone" && equalIgnoringCase(value, "no"))
+    if (key == "telephone" && equalLettersIgnoringASCIICase(value, "no"))
         document->setIsTelephoneNumberParsingAllowed(false);
 }
 
@@ -3370,13 +3370,13 @@ void Document::processReferrerPolicy(const String& policy)
 
     // Note that we're supporting both the standard and legacy keywords for referrer
     // policies, as defined by http://www.w3.org/TR/referrer-policy/#referrer-policy-delivery-meta
-    if (equalIgnoringCase(policy, "no-referrer") || equalIgnoringCase(policy, "never"))
+    if (equalLettersIgnoringASCIICase(policy, "no-referrer") || equalLettersIgnoringASCIICase(policy, "never"))
         setReferrerPolicy(ReferrerPolicyNever);
-    else if (equalIgnoringCase(policy, "unsafe-url") || equalIgnoringCase(policy, "always"))
+    else if (equalLettersIgnoringASCIICase(policy, "unsafe-url") || equalLettersIgnoringASCIICase(policy, "always"))
         setReferrerPolicy(ReferrerPolicyAlways);
-    else if (equalIgnoringCase(policy, "origin"))
+    else if (equalLettersIgnoringASCIICase(policy, "origin"))
         setReferrerPolicy(ReferrerPolicyOrigin);
-    else if (equalIgnoringCase(policy, "no-referrer-when-downgrade") || equalIgnoringCase(policy, "default"))
+    else if (equalLettersIgnoringASCIICase(policy, "no-referrer-when-downgrade") || equalLettersIgnoringASCIICase(policy, "default"))
         setReferrerPolicy(ReferrerPolicyDefault);
     else {
         addConsoleMessage(MessageSource::Rendering, MessageLevel::Error, "Failed to set referrer policy: The value '" + policy + "' is not one of 'no-referrer', 'origin', 'no-referrer-when-downgrade', or 'unsafe-url'. Defaulting to 'no-referrer'.");
@@ -4161,21 +4161,21 @@ RefPtr<Event> Document::createEvent(const String& type, ExceptionCode& ec)
     // The following strings are the ones from the DOM specification
     // <https://dom.spec.whatwg.org/#dom-document-createevent>.
 
-    if (equalIgnoringASCIICase(type, "customevent"))
+    if (equalLettersIgnoringASCIICase(type, "customevent"))
         return CustomEvent::create();
-    if (equalIgnoringASCIICase(type, "event") || equalIgnoringASCIICase(type, "events") || equalIgnoringASCIICase(type, "htmlevents"))
+    if (equalLettersIgnoringASCIICase(type, "event") || equalLettersIgnoringASCIICase(type, "events") || equalLettersIgnoringASCIICase(type, "htmlevents"))
         return Event::create();
-    if (equalIgnoringASCIICase(type, "keyboardevent") || equalIgnoringASCIICase(type, "keyboardevents"))
+    if (equalLettersIgnoringASCIICase(type, "keyboardevent") || equalLettersIgnoringASCIICase(type, "keyboardevents"))
         return KeyboardEvent::create();
-    if (equalIgnoringASCIICase(type, "messageevent"))
+    if (equalLettersIgnoringASCIICase(type, "messageevent"))
         return MessageEvent::create();
-    if (equalIgnoringASCIICase(type, "mouseevent") || equalIgnoringASCIICase(type, "mouseevents"))
+    if (equalLettersIgnoringASCIICase(type, "mouseevent") || equalLettersIgnoringASCIICase(type, "mouseevents"))
         return MouseEvent::create();
-    if (equalIgnoringASCIICase(type, "uievent") || equalIgnoringASCIICase(type, "uievents"))
+    if (equalLettersIgnoringASCIICase(type, "uievent") || equalLettersIgnoringASCIICase(type, "uievents"))
         return UIEvent::create();
 
 #if ENABLE(TOUCH_EVENTS)
-    if (equalIgnoringASCIICase(type, "touchevent"))
+    if (equalLettersIgnoringASCIICase(type, "touchevent"))
         return TouchEvent::create();
 #endif
 
@@ -4185,7 +4185,7 @@ RefPtr<Event> Document::createEvent(const String& type, ExceptionCode& ec)
     // However, since there is no provision for initializing the event once it is created,
     // there is no practical value in this feature.
 
-    if (equalIgnoringASCIICase(type, "svgzoomevents"))
+    if (equalLettersIgnoringASCIICase(type, "svgzoomevents"))
         return SVGZoomEvent::create();
 
     // The following strings are for event classes where WebKit supplies an init function.
@@ -4195,25 +4195,25 @@ RefPtr<Event> Document::createEvent(const String& type, ExceptionCode& ec)
     // FIXME: For each of the strings below, prove there is no content depending on it and remove
     // both the string and the corresponding init function for that class.
 
-    if (equalIgnoringASCIICase(type, "compositionevent"))
+    if (equalLettersIgnoringASCIICase(type, "compositionevent"))
         return CompositionEvent::create();
-    if (equalIgnoringASCIICase(type, "hashchangeevent"))
+    if (equalLettersIgnoringASCIICase(type, "hashchangeevent"))
         return HashChangeEvent::create();
-    if (equalIgnoringASCIICase(type, "mutationevent") || equalIgnoringASCIICase(type, "mutationevents"))
+    if (equalLettersIgnoringASCIICase(type, "mutationevent") || equalLettersIgnoringASCIICase(type, "mutationevents"))
         return MutationEvent::create();
-    if (equalIgnoringASCIICase(type, "overflowevent"))
+    if (equalLettersIgnoringASCIICase(type, "overflowevent"))
         return OverflowEvent::create();
-    if (equalIgnoringASCIICase(type, "storageevent"))
+    if (equalLettersIgnoringASCIICase(type, "storageevent"))
         return StorageEvent::create();
-    if (equalIgnoringASCIICase(type, "textevent"))
+    if (equalLettersIgnoringASCIICase(type, "textevent"))
         return TextEvent::create();
-    if (equalIgnoringASCIICase(type, "wheelevent"))
+    if (equalLettersIgnoringASCIICase(type, "wheelevent"))
         return WheelEvent::create();
 
 #if ENABLE(DEVICE_ORIENTATION)
-    if (equalIgnoringASCIICase(type, "devicemotionevent"))
+    if (equalLettersIgnoringASCIICase(type, "devicemotionevent"))
         return DeviceMotionEvent::create();
-    if (equalIgnoringASCIICase(type, "deviceorientationevent"))
+    if (equalLettersIgnoringASCIICase(type, "deviceorientationevent"))
         return DeviceOrientationEvent::create();
 #endif
 
@@ -5338,7 +5338,7 @@ void Document::initDNSPrefetch()
 
 void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl)
 {
-    if (equalIgnoringCase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabledDNSPrefetch) {
+    if (equalLettersIgnoringASCIICase(dnsPrefetchControl, "on") && !m_haveExplicitlyDisabledDNSPrefetch) {
         m_isDNSPrefetchEnabled = true;
         return;
     }
index 43c3122..9b6d086 100644 (file)
@@ -2873,11 +2873,11 @@ void Element::requestPointerLock()
 SpellcheckAttributeState Element::spellcheckAttributeState() const
 {
     const AtomicString& value = fastGetAttribute(HTMLNames::spellcheckAttr);
-    if (value == nullAtom)
+    if (value.isNull())
         return SpellcheckAttributeDefault;
-    if (equalIgnoringCase(value, "true") || equalIgnoringCase(value, ""))
+    if (value.isEmpty() || equalLettersIgnoringASCIICase(value, "true"))
         return SpellcheckAttributeTrue;
-    if (equalIgnoringCase(value, "false"))
+    if (equalLettersIgnoringASCIICase(value, "false"))
         return SpellcheckAttributeFalse;
 
     return SpellcheckAttributeDefault;
@@ -3372,7 +3372,7 @@ void Element::clearHasPendingResources()
 
 bool Element::canContainRangeEndPoint() const
 {
-    return !equalIgnoringCase(fastGetAttribute(roleAttr), "img");
+    return !equalLettersIgnoringASCIICase(fastGetAttribute(roleAttr), "img");
 }
 
 String Element::completeURLsInAttributeValue(const URL& base, const Attribute& attribute) const
index 41a2056..e6e7acd 100644 (file)
@@ -114,10 +114,13 @@ void InlineStyleSheetOwner::clearSheet()
 
 inline bool isValidCSSContentType(Element& element, const AtomicString& type)
 {
-    static NeverDestroyed<const AtomicString> cssContentType("text/css", AtomicString::ConstructFromLiteral);
     if (type.isEmpty())
         return true;
-    return element.isHTMLElement() ? equalIgnoringCase(type, cssContentType) : type == cssContentType;
+    // FIXME: Should MIME types really be case sensitive in XML documents? Doesn't seem like they should,
+    // even though other things are case sensitive in that context. MIME types should never be case sensitive.
+    // We should verify this and then remove the isHTMLElement check here.
+    static NeverDestroyed<const AtomicString> cssContentType("text/css", AtomicString::ConstructFromLiteral);
+    return element.isHTMLElement() ? equalLettersIgnoringASCIICase(type, "text/css") : type == cssContentType;
 }
 
 void InlineStyleSheetOwner::createSheet(Element& element, const String& text)
index 18791f2..d9c56fe 100644 (file)
@@ -262,7 +262,7 @@ bool ScriptElement::requestScript(const String& sourceUrl)
         String crossOriginMode = m_element.fastGetAttribute(HTMLNames::crossoriginAttr);
         if (!crossOriginMode.isNull()) {
             m_requestUsesAccessControl = true;
-            StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
+            StoredCredentials allowCredentials = equalLettersIgnoringASCIICase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
             updateRequestForAccessControl(request.mutableResourceRequest(), m_element.document().securityOrigin(), allowCredentials);
         }
         request.setCharset(scriptCharset());
@@ -371,11 +371,11 @@ bool ScriptElement::isScriptForEventSupported() const
     String forAttribute = forAttributeValue();
     if (!eventAttribute.isNull() && !forAttribute.isNull()) {
         forAttribute = stripLeadingAndTrailingHTMLSpaces(forAttribute);
-        if (!equalIgnoringCase(forAttribute, "window"))
+        if (!equalLettersIgnoringASCIICase(forAttribute, "window"))
             return false;
 
         eventAttribute = stripLeadingAndTrailingHTMLSpaces(eventAttribute);
-        if (!equalIgnoringCase(eventAttribute, "onload") && !equalIgnoringCase(eventAttribute, "onload()"))
+        if (!equalLettersIgnoringASCIICase(eventAttribute, "onload") && !equalLettersIgnoringASCIICase(eventAttribute, "onload()"))
             return false;
     }
     return true;
index c5d4124..03ef40c 100644 (file)
@@ -104,18 +104,18 @@ SandboxFlags SecurityContext::parseSandboxPolicy(const String& policy, String& i
 
         // Turn off the corresponding sandbox flag if it's set as "allowed".
         String sandboxToken = policy.substring(start, end - start);
-        if (equalIgnoringCase(sandboxToken, "allow-same-origin"))
+        if (equalLettersIgnoringASCIICase(sandboxToken, "allow-same-origin"))
             flags &= ~SandboxOrigin;
-        else if (equalIgnoringCase(sandboxToken, "allow-forms"))
+        else if (equalLettersIgnoringASCIICase(sandboxToken, "allow-forms"))
             flags &= ~SandboxForms;
-        else if (equalIgnoringCase(sandboxToken, "allow-scripts")) {
+        else if (equalLettersIgnoringASCIICase(sandboxToken, "allow-scripts")) {
             flags &= ~SandboxScripts;
             flags &= ~SandboxAutomaticFeatures;
-        } else if (equalIgnoringCase(sandboxToken, "allow-top-navigation"))
+        } else if (equalLettersIgnoringASCIICase(sandboxToken, "allow-top-navigation"))
             flags &= ~SandboxTopNavigation;
-        else if (equalIgnoringCase(sandboxToken, "allow-popups"))
+        else if (equalLettersIgnoringASCIICase(sandboxToken, "allow-popups"))
             flags &= ~SandboxPopups;
-        else if (equalIgnoringCase(sandboxToken, "allow-pointer-lock"))
+        else if (equalLettersIgnoringASCIICase(sandboxToken, "allow-pointer-lock"))
             flags &= ~SandboxPointerLock;
         else {
             if (numberOfTokenErrors)
index a2b04a7..111d42e 100644 (file)
@@ -314,9 +314,9 @@ static float findSizeValue(const String& keyString, const String& valueString, D
     // 3) device-width and device-height are used as keywords.
     // 4) Other keywords and unknown values translate to 0.0.
 
-    if (equalIgnoringCase(valueString, "device-width"))
+    if (equalLettersIgnoringASCIICase(valueString, "device-width"))
         return ViewportArguments::ValueDeviceWidth;
-    if (equalIgnoringCase(valueString, "device-height"))
+    if (equalLettersIgnoringASCIICase(valueString, "device-height"))
         return ViewportArguments::ValueDeviceHeight;
 
     float value = numericPrefix(keyString, valueString, document);
@@ -335,13 +335,13 @@ static float findScaleValue(const String& keyString, const String& valueString,
     // 4) device-width and device-height are translated to 10.0.
     // 5) no and unknown values are translated to 0.0
 
-    if (equalIgnoringCase(valueString, "yes"))
+    if (equalLettersIgnoringASCIICase(valueString, "yes"))
         return 1;
-    if (equalIgnoringCase(valueString, "no"))
+    if (equalLettersIgnoringASCIICase(valueString, "no"))
         return 0;
-    if (equalIgnoringCase(valueString, "device-width"))
+    if (equalLettersIgnoringASCIICase(valueString, "device-width"))
         return 10;
-    if (equalIgnoringCase(valueString, "device-height"))
+    if (equalLettersIgnoringASCIICase(valueString, "device-height"))
         return 10;
 
     float value = numericPrefix(keyString, valueString, document);
@@ -361,13 +361,13 @@ static float findBooleanValue(const String& keyString, const String& valueString
     // Numbers >= 1, numbers <= -1, device-width and device-height are mapped to yes.
     // Numbers in the range <-1, 1>, and unknown values, are mapped to no.
 
-    if (equalIgnoringCase(valueString, "yes"))
+    if (equalLettersIgnoringASCIICase(valueString, "yes"))
         return 1;
-    if (equalIgnoringCase(valueString, "no"))
+    if (equalLettersIgnoringASCIICase(valueString, "no"))
         return 0;
-    if (equalIgnoringCase(valueString, "device-width"))
+    if (equalLettersIgnoringASCIICase(valueString, "device-width"))
         return 1;
-    if (equalIgnoringCase(valueString, "device-height"))
+    if (equalLettersIgnoringASCIICase(valueString, "device-height"))
         return 1;
 
     float value = numericPrefix(keyString, valueString, document);
index c923598..62cf7ec 100644 (file)
@@ -279,9 +279,9 @@ static bool executeClearText(Frame& frame, Event*, EditorCommandSource, const St
 
 static bool executeDefaultParagraphSeparator(Frame& frame, Event*, EditorCommandSource, const String& value)
 {
-    if (equalIgnoringCase(value, "div"))
+    if (equalLettersIgnoringASCIICase(value, "div"))
         frame.editor().setDefaultParagraphSeparator(EditorParagraphSeparatorIsDiv);
-    else if (equalIgnoringCase(value, "p"))
+    else if (equalLettersIgnoringASCIICase(value, "p"))
         frame.editor().setDefaultParagraphSeparator(EditorParagraphSeparatorIsP);
 
     return true;
@@ -459,7 +459,7 @@ static bool executeIndent(Frame& frame, Event*, EditorCommandSource, const Strin
 
 static bool executeInsertBacktab(Frame& frame, Event* event, EditorCommandSource, const String&)
 {
-    return targetFrame(frame, event)->eventHandler().handleTextInputEvent("\t", event, TextEventInputBackTab);
+    return targetFrame(frame, event)->eventHandler().handleTextInputEvent(ASCIILiteral("\t"), event, TextEventInputBackTab);
 }
 
 static bool executeInsertHorizontalRule(Frame& frame, Event*, EditorCommandSource, const String& value)
@@ -472,7 +472,7 @@ static bool executeInsertHorizontalRule(Frame& frame, Event*, EditorCommandSourc
 
 static bool executeInsertHTML(Frame& frame, Event*, EditorCommandSource, const String& value)
 {
-    return executeInsertFragment(frame, createFragmentFromMarkup(*frame.document(), value, ""));
+    return executeInsertFragment(frame, createFragmentFromMarkup(*frame.document(), value, emptyString()));
 }
 
 static bool executeInsertImage(Frame& frame, Event*, EditorCommandSource, const String& value)
@@ -487,7 +487,7 @@ static bool executeInsertLineBreak(Frame& frame, Event* event, EditorCommandSour
 {
     switch (source) {
     case CommandFromMenuOrKeyBinding:
-        return targetFrame(frame, event)->eventHandler().handleTextInputEvent("\n", event, TextEventInputLineBreak);
+        return targetFrame(frame, event)->eventHandler().handleTextInputEvent(ASCIILiteral("\n"), event, TextEventInputLineBreak);
     case CommandFromDOM:
     case CommandFromDOMWithUserInterface:
         // Doesn't scroll to make the selection visible, or modify the kill ring.
@@ -503,7 +503,7 @@ static bool executeInsertLineBreak(Frame& frame, Event* event, EditorCommandSour
 static bool executeInsertNewline(Frame& frame, Event* event, EditorCommandSource, const String&)
 {
     Frame* targetFrame = WebCore::targetFrame(frame, event);
-    return targetFrame->eventHandler().handleTextInputEvent("\n", event, targetFrame->editor().canEditRichly() ? TextEventInputKeyboard : TextEventInputLineBreak);
+    return targetFrame->eventHandler().handleTextInputEvent(ASCIILiteral("\n"), event, targetFrame->editor().canEditRichly() ? TextEventInputKeyboard : TextEventInputLineBreak);
 }
 
 static bool executeInsertNewlineInQuotedContent(Frame& frame, Event*, EditorCommandSource, const String&)
@@ -527,7 +527,7 @@ static bool executeInsertParagraph(Frame& frame, Event*, EditorCommandSource, co
 
 static bool executeInsertTab(Frame& frame, Event* event, EditorCommandSource, const String&)
 {
-    return targetFrame(frame, event)->eventHandler().handleTextInputEvent("\t", event);
+    return targetFrame(frame, event)->eventHandler().handleTextInputEvent(ASCIILiteral("\t"), event);
 }
 
 static bool executeInsertText(Frame& frame, Event*, EditorCommandSource, const String& value)
@@ -545,22 +545,22 @@ static bool executeInsertUnorderedList(Frame& frame, Event*, EditorCommandSource
 
 static bool executeJustifyCenter(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
-    return executeApplyParagraphStyle(frame, source, EditActionCenter, CSSPropertyTextAlign, "center");
+    return executeApplyParagraphStyle(frame, source, EditActionCenter, CSSPropertyTextAlign, ASCIILiteral("center"));
 }
 
 static bool executeJustifyFull(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
-    return executeApplyParagraphStyle(frame, source, EditActionJustify, CSSPropertyTextAlign, "justify");
+    return executeApplyParagraphStyle(frame, source, EditActionJustify, CSSPropertyTextAlign, ASCIILiteral("justify"));
 }
 
 static bool executeJustifyLeft(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
-    return executeApplyParagraphStyle(frame, source, EditActionAlignLeft, CSSPropertyTextAlign, "left");
+    return executeApplyParagraphStyle(frame, source, EditActionAlignLeft, CSSPropertyTextAlign, ASCIILiteral("left"));
 }
 
 static bool executeJustifyRight(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
-    return executeApplyParagraphStyle(frame, source, EditActionAlignRight, CSSPropertyTextAlign, "right");
+    return executeApplyParagraphStyle(frame, source, EditActionAlignRight, CSSPropertyTextAlign, ASCIILiteral("right"));
 }
 
 static bool executeMakeTextWritingDirectionLeftToRight(Frame& frame, Event*, EditorCommandSource, const String&)
@@ -1035,31 +1035,31 @@ static TextDecorationChange textDecorationChangeForToggling(Editor& editor, CSSP
 static bool executeStrikethrough(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
     Ref<EditingStyle> style = EditingStyle::create();
-    style->setStrikeThroughChange(textDecorationChangeForToggling(frame.editor(), CSSPropertyWebkitTextDecorationsInEffect, "line-through"));
+    style->setStrikeThroughChange(textDecorationChangeForToggling(frame.editor(), CSSPropertyWebkitTextDecorationsInEffect, ASCIILiteral("line-through")));
     // FIXME: Needs a new EditAction!
     return applyCommandToFrame(frame, source, EditActionUnderline, WTFMove(style));
 }
 
 static bool executeStyleWithCSS(Frame& frame, Event*, EditorCommandSource, const String& value)
 {
-    frame.editor().setShouldStyleWithCSS(!equalIgnoringCase(value, "false"));
+    frame.editor().setShouldStyleWithCSS(!equalLettersIgnoringASCIICase(value, "false"));
     return true;
 }
 
 static bool executeUseCSS(Frame& frame, Event*, EditorCommandSource, const String& value)
 {
-    frame.editor().setShouldStyleWithCSS(equalIgnoringCase(value, "false"));
+    frame.editor().setShouldStyleWithCSS(equalLettersIgnoringASCIICase(value, "false"));
     return true;
 }
 
 static bool executeSubscript(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
-    return executeToggleStyle(frame, source, EditActionSubscript, CSSPropertyVerticalAlign, "baseline", "sub");
+    return executeToggleStyle(frame, source, EditActionSubscript, CSSPropertyVerticalAlign, ASCIILiteral("baseline"), ASCIILiteral("sub"));
 }
 
 static bool executeSuperscript(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
-    return executeToggleStyle(frame, source, EditActionSuperscript, CSSPropertyVerticalAlign, "baseline", "super");
+    return executeToggleStyle(frame, source, EditActionSuperscript, CSSPropertyVerticalAlign, ASCIILiteral("baseline"), ASCIILiteral("super"));
 }
 
 static bool executeSwapWithMark(Frame& frame, Event*, EditorCommandSource, const String&)
@@ -1085,12 +1085,12 @@ static bool executeTakeFindStringFromSelection(Frame& frame, Event*, EditorComma
 
 static bool executeToggleBold(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
-    return executeToggleStyle(frame, source, EditActionBold, CSSPropertyFontWeight, "normal", "bold");
+    return executeToggleStyle(frame, source, EditActionBold, CSSPropertyFontWeight, ASCIILiteral("normal"), ASCIILiteral("bold"));
 }
 
 static bool executeToggleItalic(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
-    return executeToggleStyle(frame, source, EditActionItalics, CSSPropertyFontStyle, "normal", "italic");
+    return executeToggleStyle(frame, source, EditActionItalics, CSSPropertyFontStyle, ASCIILiteral("normal"), ASCIILiteral("italic"));
 }
 
 static bool executeTranspose(Frame& frame, Event*, EditorCommandSource, const String&)
@@ -1102,7 +1102,7 @@ static bool executeTranspose(Frame& frame, Event*, EditorCommandSource, const St
 static bool executeUnderline(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
     Ref<EditingStyle> style = EditingStyle::create();
-    TextDecorationChange change = textDecorationChangeForToggling(frame.editor(), CSSPropertyWebkitTextDecorationsInEffect, "underline");
+    TextDecorationChange change = textDecorationChangeForToggling(frame.editor(), CSSPropertyWebkitTextDecorationsInEffect, ASCIILiteral("underline"));
     style->setUnderlineChange(change);
     return applyCommandToFrame(frame, source, EditActionUnderline, WTFMove(style));
 }
@@ -1122,7 +1122,7 @@ static bool executeUnlink(Frame& frame, Event*, EditorCommandSource, const Strin
 
 static bool executeUnscript(Frame& frame, Event*, EditorCommandSource source, const String&)
 {
-    return executeApplyStyle(frame, source, EditActionUnscript, CSSPropertyVerticalAlign, "baseline");
+    return executeApplyStyle(frame, source, EditActionUnscript, CSSPropertyVerticalAlign, ASCIILiteral("baseline"));
 }
 
 static bool executeUnselect(Frame& frame, Event*, EditorCommandSource, const String&)
@@ -1308,12 +1308,12 @@ static TriState stateNone(Frame&, Event*)
 
 static TriState stateBold(Frame& frame, Event*)
 {
-    return stateStyle(frame, CSSPropertyFontWeight, "bold");
+    return stateStyle(frame, CSSPropertyFontWeight, ASCIILiteral("bold"));
 }
 
 static TriState stateItalic(Frame& frame, Event*)
 {
-    return stateStyle(frame, CSSPropertyFontStyle, "italic");
+    return stateStyle(frame, CSSPropertyFontStyle, ASCIILiteral("italic"));
 }
 
 static TriState stateOrderedList(Frame& frame, Event*)
@@ -1323,7 +1323,7 @@ static TriState stateOrderedList(Frame& frame, Event*)
 
 static TriState stateStrikethrough(Frame& frame, Event*)
 {
-    return stateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect, "line-through");
+    return stateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect, ASCIILiteral("line-through"));
 }
 
 static TriState stateStyleWithCSS(Frame& frame, Event*)
@@ -1333,12 +1333,12 @@ static TriState stateStyleWithCSS(Frame& frame, Event*)
 
 static TriState stateSubscript(Frame& frame, Event*)
 {
-    return stateStyle(frame, CSSPropertyVerticalAlign, "sub");
+    return stateStyle(frame, CSSPropertyVerticalAlign, ASCIILiteral("sub"));
 }
 
 static TriState stateSuperscript(Frame& frame, Event*)
 {
-    return stateStyle(frame, CSSPropertyVerticalAlign, "super");
+    return stateStyle(frame, CSSPropertyVerticalAlign, ASCIILiteral("super"));
 }
 
 static TriState stateTextWritingDirectionLeftToRight(Frame& frame, Event*)
@@ -1358,7 +1358,7 @@ static TriState stateTextWritingDirectionRightToLeft(Frame& frame, Event*)
 
 static TriState stateUnderline(Frame& frame, Event*)
 {
-    return stateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect, "underline");
+    return stateStyle(frame, CSSPropertyWebkitTextDecorationsInEffect, ASCIILiteral("underline"));
 }
 
 static TriState stateUnorderedList(Frame& frame, Event*)
@@ -1368,22 +1368,22 @@ static TriState stateUnorderedList(Frame& frame, Event*)
 
 static TriState stateJustifyCenter(Frame& frame, Event*)
 {
-    return stateStyle(frame, CSSPropertyTextAlign, "center");
+    return stateStyle(frame, CSSPropertyTextAlign, ASCIILiteral("center"));
 }
 
 static TriState stateJustifyFull(Frame& frame, Event*)
 {
-    return stateStyle(frame, CSSPropertyTextAlign, "justify");
+    return stateStyle(frame, CSSPropertyTextAlign, ASCIILiteral("justify"));
 }
 
 static TriState stateJustifyLeft(Frame& frame, Event*)
 {
-    return stateStyle(frame, CSSPropertyTextAlign, "left");
+    return stateStyle(frame, CSSPropertyTextAlign, ASCIILiteral("left"));
 }
 
 static TriState stateJustifyRight(Frame& frame, Event*)
 {
-    return stateStyle(frame, CSSPropertyTextAlign, "right");
+    return stateStyle(frame, CSSPropertyTextAlign, ASCIILiteral("right"));
 }
 
 // Value functions
@@ -1435,10 +1435,10 @@ static String valueFormatBlock(Frame& frame, Event*)
 {
     const VisibleSelection& selection = frame.selection().selection();
     if (!selection.isNonOrphanedCaretOrRange() || !selection.isContentEditable())
-        return "";
+        return emptyString();
     Element* formatBlockElement = FormatBlockCommand::elementForFormatBlockCommand(selection.firstRange().get());
     if (!formatBlockElement)
-        return "";
+        return emptyString();
     return formatBlockElement->localName();
 }
 
@@ -1742,7 +1742,7 @@ String Editor::Command::value(Event* triggeringEvent) const
     if (!isSupported() || !m_frame)
         return String();
     if (m_command->value == valueNull && m_command->state != stateNone)
-        return m_command->state(*m_frame, triggeringEvent) == TrueTriState ? "true" : "false";
+        return m_command->state(*m_frame, triggeringEvent) == TrueTriState ? ASCIILiteral("true") : ASCIILiteral("false");
     return m_command->value(*m_frame, triggeringEvent);
 }
 
index 05e8a08..483a4d4 100644 (file)
@@ -261,7 +261,7 @@ bool isRendererReplacedElement(RenderObject* renderer)
         Element& element = downcast<Element>(*renderer->node());
         if (is<HTMLFormControlElement>(element) || is<HTMLLegendElement>(element) || is<HTMLMeterElement>(element) || is<HTMLProgressElement>(element))
             return true;
-        if (equalIgnoringCase(element.fastGetAttribute(roleAttr), "img"))
+        if (equalLettersIgnoringASCIICase(element.fastGetAttribute(roleAttr), "img"))
             return true;
     }
 
index 0f4ce99..2fe5107 100644 (file)
@@ -168,7 +168,7 @@ bool Blob::isNormalizedContentType(const String& contentType)
         for (size_t i = 0; i < length; ++i) {
             if (characters[i] < 0x20 || characters[i] > 0x7e)
                 return false;
-            if (characters[i] >= 'A' && characters[i] <= 'Z')
+            if (isASCIIUpper(characters[i]))
                 return false;
         }
     } else {
@@ -176,7 +176,7 @@ bool Blob::isNormalizedContentType(const String& contentType)
         for (size_t i = 0; i < length; ++i) {
             if (characters[i] < 0x20 || characters[i] > 0x7e)
                 return false;
-            if (characters[i] >= 'A' && characters[i] <= 'Z')
+            if (isASCIIUpper(characters[i]))
                 return false;
         }
     }
@@ -190,7 +190,7 @@ bool Blob::isNormalizedContentType(const CString& contentType)
     for (size_t i = 0; i < length; ++i) {
         if (characters[i] < 0x20 || characters[i] > 0x7e)
             return false;
-        if (characters[i] >= 'A' && characters[i] <= 'Z')
+        if (isASCIIUpper(characters[i]))
             return false;
     }
     return true;
index b61de56..26bb790 100644 (file)
@@ -473,7 +473,7 @@ void HistoryItem::setFormInfoFromRequest(const ResourceRequest& request)
 {
     m_referrer = request.httpReferrer();
     
-    if (equalIgnoringCase(request.httpMethod(), "POST")) {
+    if (equalLettersIgnoringASCIICase(request.httpMethod(), "post")) {
         // FIXME: Eventually we have to make this smart enough to handle the case where
         // we have a stream for the body to handle the "data interspersed with files" feature.
         m_formData = request.httpBody();
index 5d2cf99..2186ef9 100644 (file)
 
 namespace WebCore {
 
-static const AtomicString& valueOn()
-{
-    static NeverDestroyed<const AtomicString> valueOn("on", AtomicString::ConstructFromLiteral);
-    return valueOn;
-}
-
-static const AtomicString& valueOff()
-{
-    static NeverDestroyed<const AtomicString> valueOff("off", AtomicString::ConstructFromLiteral);
-    return valueOff;
-}
-
-static const AtomicString& valueNone()
-{
-    static NeverDestroyed<const AtomicString> valueNone("none", AtomicString::ConstructFromLiteral);
-    return valueNone;
-}
-
-static const AtomicString& valueWords()
-{
-    static NeverDestroyed<const AtomicString> valueWords("words", AtomicString::ConstructFromLiteral);
-    return valueWords;
-}
-
-static const AtomicString& valueSentences()
-{
-    static NeverDestroyed<const AtomicString> valueSentences("sentences", AtomicString::ConstructFromLiteral);
-    return valueSentences;
-}
-
-static const AtomicString& valueAllCharacters()
-{
-    static NeverDestroyed<const AtomicString> valueAllCharacters("characters", AtomicString::ConstructFromLiteral);
-    return valueAllCharacters;
-}
-
 WebAutocapitalizeType autocapitalizeTypeForAttributeValue(const AtomicString& attributeValue)
 {
     // Omitted / missing values are the Default state.
-    if (attributeValue.isNull() || attributeValue.isEmpty())
+    if (attributeValue.isEmpty())
         return WebAutocapitalizeTypeDefault;
 
-    if (equalIgnoringCase(attributeValue, valueOn()) || equalIgnoringCase(attributeValue, valueSentences()))
+    if (equalLettersIgnoringASCIICase(attributeValue, "on") || equalLettersIgnoringASCIICase(attributeValue, "sentences"))
         return WebAutocapitalizeTypeSentences;
-    if (equalIgnoringCase(attributeValue, valueOff()) || equalIgnoringCase(attributeValue, valueNone()))
+    if (equalLettersIgnoringASCIICase(attributeValue, "off") || equalLettersIgnoringASCIICase(attributeValue, "none"))
         return WebAutocapitalizeTypeNone;
-    if (equalIgnoringCase(attributeValue, valueWords()))
+    if (equalLettersIgnoringASCIICase(attributeValue, "words"))
         return WebAutocapitalizeTypeWords;
-    if (equalIgnoringCase(attributeValue, valueAllCharacters()))
+    if (equalLettersIgnoringASCIICase(attributeValue, "characters"))
         return WebAutocapitalizeTypeAllCharacters;
 
     // Unrecognized values fall back to "on".
@@ -90,14 +54,22 @@ const AtomicString& stringForAutocapitalizeType(WebAutocapitalizeType type)
     switch (type) {
     case WebAutocapitalizeTypeDefault:
         return nullAtom;
-    case WebAutocapitalizeTypeNone:
-        return valueNone();
-    case WebAutocapitalizeTypeSentences:
-        return valueSentences();
-    case WebAutocapitalizeTypeWords:
-        return valueWords();
-    case WebAutocapitalizeTypeAllCharacters:
-        return valueAllCharacters();
+    case WebAutocapitalizeTypeNone: {
+        static NeverDestroyed<const AtomicString> valueNone("none", AtomicString::ConstructFromLiteral);
+        return valueNone;
+    }
+    case WebAutocapitalizeTypeSentences: {
+        static NeverDestroyed<const AtomicString> valueSentences("sentences", AtomicString::ConstructFromLiteral);
+        return valueSentences;
+    }
+    case WebAutocapitalizeTypeWords: {
+        static NeverDestroyed<const AtomicString> valueWords("words", AtomicString::ConstructFromLiteral);
+        return valueWords;
+    }
+    case WebAutocapitalizeTypeAllCharacters: {
+        static NeverDestroyed<const AtomicString> valueAllCharacters("characters", AtomicString::ConstructFromLiteral);
+        return valueAllCharacters;
+    }
     }
 
     ASSERT_NOT_REACHED();
index 88f30df..bc100a8 100644 (file)
@@ -285,11 +285,10 @@ bool HTMLAnchorElement::canStartSelection() const
 
 bool HTMLAnchorElement::draggable() const
 {
-    // Should be draggable if we have an href attribute.
     const AtomicString& value = fastGetAttribute(draggableAttr);
-    if (equalIgnoringCase(value, "true"))
+    if (equalLettersIgnoringASCIICase(value, "true"))
         return true;
-    if (equalIgnoringCase(value, "false"))
+    if (equalLettersIgnoringASCIICase(value, "false"))
         return false;
     return hasAttribute(hrefAttr);
 }
index fcfeed5..09da886 100644 (file)
@@ -52,13 +52,13 @@ Ref<HTMLAreaElement> HTMLAreaElement::create(const QualifiedName& tagName, Docum
 void HTMLAreaElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (name == shapeAttr) {
-        if (equalIgnoringCase(value, "default"))
+        if (equalLettersIgnoringASCIICase(value, "default"))
             m_shape = Default;
-        else if (equalIgnoringCase(value, "circle"))
+        else if (equalLettersIgnoringASCIICase(value, "circle"))
             m_shape = Circle;
-        else if (equalIgnoringCase(value, "poly"))
+        else if (equalLettersIgnoringASCIICase(value, "poly"))
             m_shape = Poly;
-        else if (equalIgnoringCase(value, "rect"))
+        else if (equalLettersIgnoringASCIICase(value, "rect"))
             m_shape = Rect;
         invalidateCachedRegion();
     } else if (name == coordsAttr) {
index 9a182be..36cad18 100644 (file)
@@ -61,7 +61,7 @@ void HTMLBRElement::collectStyleForPresentationAttribute(const QualifiedName& na
         // If the string is empty, then don't add the clear property.
         // <br clear> and <br clear=""> are just treated like <br> by Gecko, Mac IE, etc. -dwh
         if (!value.isEmpty()) {
-            if (equalIgnoringCase(value, "all"))
+            if (equalLettersIgnoringASCIICase(value, "all"))
                 addPropertyToPresentationAttributeStyle(style, CSSPropertyClear, CSSValueBoth);
             else
                 addPropertyToPresentationAttributeStyle(style, CSSPropertyClear, value);
index 7725860..fc6062c 100644 (file)
@@ -95,7 +95,7 @@ void HTMLBodyElement::collectStyleForPresentationAttribute(const QualifiedName&
     } else if (name == textAttr) {
         addHTMLColorToStyle(style, CSSPropertyColor, value);
     } else if (name == bgpropertiesAttr) {
-        if (equalIgnoringCase(value, "fixed"))
+        if (equalLettersIgnoringASCIICase(value, "fixed"))
            addPropertyToPresentationAttributeStyle(style, CSSPropertyBackgroundAttachment, CSSValueFixed);
     } else
         HTMLElement::collectStyleForPresentationAttribute(name, value, style);
index df8e834..b3aa7aa 100644 (file)
@@ -96,9 +96,9 @@ bool HTMLButtonElement::isPresentationAttribute(const QualifiedName& name) const
 void HTMLButtonElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (name == typeAttr) {
-        if (equalIgnoringCase(value, "reset"))
+        if (equalLettersIgnoringASCIICase(value, "reset"))
             m_type = RESET;
-        else if (equalIgnoringCase(value, "button"))
+        else if (equalLettersIgnoringASCIICase(value, "button"))
             m_type = BUTTON;
         else
             m_type = SUBMIT;
index fb9d2c1..254c077 100644 (file)
@@ -497,7 +497,7 @@ String HTMLCanvasElement::toDataURL(const String& mimeType, const double* qualit
     }
 
     if (m_size.isEmpty() || !buffer())
-        return String("data:,");
+        return ASCIILiteral("data:,");
 
     String encodingMimeType = toEncodingMimeType(mimeType);
 
index 06b1892..c3b16ac 100644 (file)
@@ -57,11 +57,11 @@ bool HTMLDivElement::isPresentationAttribute(const QualifiedName& name) const
 void HTMLDivElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
 {
     if (name == alignAttr) {
-        if (equalIgnoringCase(value, "middle") || equalIgnoringCase(value, "center"))
+        if (equalLettersIgnoringASCIICase(value, "middle") || equalLettersIgnoringASCIICase(value, "center"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitCenter);
-        else if (equalIgnoringCase(value, "left"))
+        else if (equalLettersIgnoringASCIICase(value, "left"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitLeft);
-        else if (equalIgnoringCase(value, "right"))
+        else if (equalLettersIgnoringASCIICase(value, "right"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitRight);
         else
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, value);
index 106299e..a203ee3 100644 (file)
@@ -124,15 +124,15 @@ void HTMLDocument::setDir(const AtomicString& value)
 
 String HTMLDocument::designMode() const
 {
-    return inDesignMode() ? "on" : "off";
+    return inDesignMode() ? ASCIILiteral("on") : ASCIILiteral("off");
 }
 
 void HTMLDocument::setDesignMode(const String& value)
 {
     InheritedBool mode;
-    if (equalIgnoringCase(value, "on"))
+    if (equalLettersIgnoringASCIICase(value, "on"))
         mode = on;
-    else if (equalIgnoringCase(value, "off"))
+    else if (equalLettersIgnoringASCIICase(value, "off"))
         mode = off;
     else
         mode = inherit;
index 792d2f6..d52238c 100644 (file)
@@ -73,8 +73,8 @@ Ref<HTMLElement> HTMLElement::create(const QualifiedName& tagName, Document& doc
 
 String HTMLElement::nodeName() const
 {
-    // FIXME: Would be nice to have an atomicstring lookup based off uppercase
-    // chars that does not have to copy the string on a hit in the hash.
+    // FIXME: Would be nice to have an AtomicString lookup based off uppercase
+    // ASCII characters that does not have to copy the string on a hit in the hash.
     if (document().isHTMLDocument()) {
         if (!tagQName().hasPrefix())
             return tagQName().localNameUpper();
@@ -165,7 +165,7 @@ bool HTMLElement::isPresentationAttribute(const QualifiedName& name) const
 
 static bool isLTROrRTLIgnoringCase(const AtomicString& dirAttributeValue)
 {
-    return equalIgnoringCase(dirAttributeValue, "rtl") || equalIgnoringCase(dirAttributeValue, "ltr");
+    return equalLettersIgnoringASCIICase(dirAttributeValue, "rtl") || equalLettersIgnoringASCIICase(dirAttributeValue, "ltr");
 }
 
 enum class ContentEditableType {
@@ -179,11 +179,11 @@ static inline ContentEditableType contentEditableType(const AtomicString& value)
 {
     if (value.isNull())
         return ContentEditableType::Inherit;
-    if (value.isEmpty() || equalIgnoringCase(value, "true"))
+    if (value.isEmpty() || equalLettersIgnoringASCIICase(value, "true"))
         return ContentEditableType::True;
-    if (equalIgnoringCase(value, "false"))
+    if (equalLettersIgnoringASCIICase(value, "false"))
         return ContentEditableType::False;
-    if (equalIgnoringCase(value, "plaintext-only"))
+    if (equalLettersIgnoringASCIICase(value, "plaintext-only"))
         return ContentEditableType::PlaintextOnly;
 
     return ContentEditableType::Inherit;
@@ -197,7 +197,7 @@ static ContentEditableType contentEditableType(const HTMLElement& element)
 void HTMLElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
 {
     if (name == alignAttr) {
-        if (equalIgnoringCase(value, "middle"))
+        if (equalLettersIgnoringASCIICase(value, "middle"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueCenter);
         else
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, value);
@@ -225,13 +225,13 @@ void HTMLElement::collectStyleForPresentationAttribute(const QualifiedName& name
     } else if (name == hiddenAttr) {
         addPropertyToPresentationAttributeStyle(style, CSSPropertyDisplay, CSSValueNone);
     } else if (name == draggableAttr) {
-        if (equalIgnoringCase(value, "true")) {
+        if (equalLettersIgnoringASCIICase(value, "true")) {
             addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUserDrag, CSSValueElement);
             addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUserSelect, CSSValueNone);
-        } else if (equalIgnoringCase(value, "false"))
+        } else if (equalLettersIgnoringASCIICase(value, "false"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitUserDrag, CSSValueNone);
     } else if (name == dirAttr) {
-        if (equalIgnoringCase(value, "auto"))
+        if (equalLettersIgnoringASCIICase(value, "auto"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(*this));
         else {
             if (isLTROrRTLIgnoringCase(value))
@@ -526,12 +526,11 @@ static inline const AtomicString& toValidDirValue(const AtomicString& value)
     static NeverDestroyed<AtomicString> ltrValue("ltr", AtomicString::ConstructFromLiteral);
     static NeverDestroyed<AtomicString> rtlValue("rtl", AtomicString::ConstructFromLiteral);
     static NeverDestroyed<AtomicString> autoValue("auto", AtomicString::ConstructFromLiteral);
-
-    if (equalIgnoringCase(value, ltrValue))
+    if (equalLettersIgnoringASCIICase(value, "ltr"))
         return ltrValue;
-    if (equalIgnoringCase(value, rtlValue))
+    if (equalLettersIgnoringASCIICase(value, "rtl"))
         return rtlValue;
-    if (equalIgnoringCase(value, autoValue))
+    if (equalLettersIgnoringASCIICase(value, "auto"))
         return autoValue;
     return nullAtom;
 }
@@ -641,18 +640,18 @@ Node* HTMLElement::insertAdjacent(const String& where, Ref<Node>&& newChild, Exc
     // This is impossible for us to implement as the DOM tree does not allow for such structures,
     // Opera also appears to disallow such usage.
 
-    if (equalIgnoringCase(where, "beforeBegin")) {
+    if (equalLettersIgnoringASCIICase(where, "beforebegin")) {
         ContainerNode* parent = this->parentNode();
         return (parent && parent->insertBefore(newChild.copyRef(), this, ec)) ? newChild.ptr() : nullptr;
     }
 
-    if (equalIgnoringCase(where, "afterBegin"))
+    if (equalLettersIgnoringASCIICase(where, "afterbegin"))
         return insertBefore(newChild.copyRef(), firstChild(), ec) ? newChild.ptr() : nullptr;
 
-    if (equalIgnoringCase(where, "beforeEnd"))
+    if (equalLettersIgnoringASCIICase(where, "beforeend"))
         return appendChild(newChild.copyRef(), ec) ? newChild.ptr() : nullptr;
 
-    if (equalIgnoringCase(where, "afterEnd")) {
+    if (equalLettersIgnoringASCIICase(where, "afterend")) {
         ContainerNode* parent = this->parentNode();
         return (parent && parent->insertBefore(newChild.copyRef(), nextSibling(), ec)) ? newChild.ptr() : nullptr;
     }
@@ -678,7 +677,7 @@ Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChi
 // Step 3 of http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in-html-documents.html#insertadjacenthtml()
 static Element* contextElementForInsertion(const String& where, Element* element, ExceptionCode& ec)
 {
-    if (equalIgnoringCase(where, "beforeBegin") || equalIgnoringCase(where, "afterEnd")) {
+    if (equalLettersIgnoringASCIICase(where, "beforebegin") || equalLettersIgnoringASCIICase(where, "afterend")) {
         ContainerNode* parent = element->parentNode();
         if (parent && !is<Element>(*parent)) {
             ec = NO_MODIFICATION_ALLOWED_ERR;
@@ -687,7 +686,7 @@ static Element* contextElementForInsertion(const String& where, Element* element
         ASSERT_WITH_SECURITY_IMPLICATION(!parent || is<Element>(*parent));
         return downcast<Element>(parent);
     }
-    if (equalIgnoringCase(where, "afterBegin") || equalIgnoringCase(where, "beforeEnd"))
+    if (equalLettersIgnoringASCIICase(where, "afterbegin") || equalLettersIgnoringASCIICase(where, "beforeend"))
         return element;
     ec =  SYNTAX_ERR;
     return nullptr;
@@ -716,25 +715,25 @@ void HTMLElement::applyAlignmentAttributeToStyle(const AtomicString& alignment,
     CSSValueID floatValue = CSSValueInvalid;
     CSSValueID verticalAlignValue = CSSValueInvalid;
 
-    if (equalIgnoringCase(alignment, "absmiddle"))
+    if (equalLettersIgnoringASCIICase(alignment, "absmiddle"))
         verticalAlignValue = CSSValueMiddle;
-    else if (equalIgnoringCase(alignment, "absbottom"))
+    else if (equalLettersIgnoringASCIICase(alignment, "absbottom"))
         verticalAlignValue = CSSValueBottom;
-    else if (equalIgnoringCase(alignment, "left")) {
+    else if (equalLettersIgnoringASCIICase(alignment, "left")) {
         floatValue = CSSValueLeft;
         verticalAlignValue = CSSValueTop;
-    } else if (equalIgnoringCase(alignment, "right")) {
+    } else if (equalLettersIgnoringASCIICase(alignment, "right")) {
         floatValue = CSSValueRight;
         verticalAlignValue = CSSValueTop;
-    } else if (equalIgnoringCase(alignment, "top"))
+    } else if (equalLettersIgnoringASCIICase(alignment, "top"))
         verticalAlignValue = CSSValueTop;
-    else if (equalIgnoringCase(alignment, "middle"))
+    else if (equalLettersIgnoringASCIICase(alignment, "middle"))
         verticalAlignValue = CSSValueWebkitBaselineMiddle;
-    else if (equalIgnoringCase(alignment, "center"))
+    else if (equalLettersIgnoringASCIICase(alignment, "center"))
         verticalAlignValue = CSSValueMiddle;
-    else if (equalIgnoringCase(alignment, "bottom"))
+    else if (equalLettersIgnoringASCIICase(alignment, "bottom"))
         verticalAlignValue = CSSValueBaseline;
-    else if (equalIgnoringCase(alignment, "texttop"))
+    else if (equalLettersIgnoringASCIICase(alignment, "texttop"))
         verticalAlignValue = CSSValueTextTop;
 
     if (floatValue != CSSValueInvalid)
@@ -771,13 +770,13 @@ String HTMLElement::contentEditable() const
 
 void HTMLElement::setContentEditable(const String& enabled, ExceptionCode& ec)
 {
-    if (equalIgnoringCase(enabled, "true"))
+    if (equalLettersIgnoringASCIICase(enabled, "true"))
         setAttribute(contenteditableAttr, AtomicString("true", AtomicString::ConstructFromLiteral));
-    else if (equalIgnoringCase(enabled, "false"))
+    else if (equalLettersIgnoringASCIICase(enabled, "false"))
         setAttribute(contenteditableAttr, AtomicString("false", AtomicString::ConstructFromLiteral));
-    else if (equalIgnoringCase(enabled, "plaintext-only"))
+    else if (equalLettersIgnoringASCIICase(enabled, "plaintext-only"))
         setAttribute(contenteditableAttr, AtomicString("plaintext-only", AtomicString::ConstructFromLiteral));
-    else if (equalIgnoringCase(enabled, "inherit"))
+    else if (equalLettersIgnoringASCIICase(enabled, "inherit"))
         removeAttribute(contenteditableAttr);
     else
         ec = SYNTAX_ERR;
@@ -785,7 +784,7 @@ void HTMLElement::setContentEditable(const String& enabled, ExceptionCode& ec)
 
 bool HTMLElement::draggable() const
 {
-    return equalIgnoringCase(fastGetAttribute(draggableAttr), "true");
+    return equalLettersIgnoringASCIICase(fastGetAttribute(draggableAttr), "true");
 }
 
 void HTMLElement::setDraggable(bool value)
@@ -835,9 +834,9 @@ TranslateAttributeMode HTMLElement::translateAttributeMode() const
 
     if (value.isNull())
         return TranslateAttributeInherit;
-    if (equalIgnoringCase(value, "yes") || value.isEmpty())
+    if (equalLettersIgnoringASCIICase(value, "yes") || value.isEmpty())
         return TranslateAttributeYes;
-    if (equalIgnoringCase(value, "no"))
+    if (equalLettersIgnoringASCIICase(value, "no"))
         return TranslateAttributeNo;
 
     return TranslateAttributeInherit;
@@ -926,7 +925,7 @@ void HTMLElement::childrenChanged(const ChildChange& change)
 bool HTMLElement::hasDirectionAuto() const
 {
     const AtomicString& direction = fastGetAttribute(dirAttr);
-    return (hasTagName(bdiTag) && direction.isNull()) || equalIgnoringCase(direction, "auto");
+    return (hasTagName(bdiTag) && direction.isNull()) || equalLettersIgnoringASCIICase(direction, "auto");
 }
 
 TextDirection HTMLElement::directionalityIfhasDirAutoAttribute(bool& isAuto) const
@@ -954,7 +953,7 @@ TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c
     Node* node = firstChild();
     while (node) {
         // Skip bdi, script, style and text form controls.
-        if (equalIgnoringCase(node->nodeName(), "bdi") || node->hasTagName(scriptTag) || node->hasTagName(styleTag) 
+        if (equalLettersIgnoringASCIICase(node->nodeName(), "bdi") || node->hasTagName(scriptTag) || node->hasTagName(styleTag)
             || (is<Element>(*node) && downcast<Element>(*node).isTextFormControl())) {
             node = NodeTraversal::nextSkippingChildren(*node, this);
             continue;
@@ -963,7 +962,7 @@ TextDirection HTMLElement::directionality(Node** strongDirectionalityTextNode) c
         // Skip elements with valid dir attribute
         if (is<Element>(*node)) {
             AtomicString dirAttributeValue = downcast<Element>(*node).fastGetAttribute(dirAttr);
-            if (isLTROrRTLIgnoringCase(dirAttributeValue) || equalIgnoringCase(dirAttributeValue, "auto")) {
+            if (isLTROrRTLIgnoringCase(dirAttributeValue) || equalLettersIgnoringASCIICase(dirAttributeValue, "auto")) {
                 node = NodeTraversal::nextSkippingChildren(*node, this);
                 continue;
             }
@@ -992,7 +991,7 @@ void HTMLElement::dirAttributeChanged(const AtomicString& value)
     if (is<HTMLElement>(parent) && parent->selfOrAncestorHasDirAutoAttribute())
         downcast<HTMLElement>(*parent).adjustDirectionalityIfNeededAfterChildAttributeChanged(this);
 
-    if (equalIgnoringCase(value, "auto"))
+    if (equalLettersIgnoringASCIICase(value, "auto"))
         calculateAndAdjustDirectionality();
 }
 
@@ -1143,7 +1142,7 @@ void HTMLElement::addHTMLColorToStyle(MutableStyleProperties& style, CSSProperty
     String colorString = attributeValue.stripWhiteSpace();
 
     // "transparent" doesn't apply a color either.
-    if (equalIgnoringCase(colorString, "transparent"))
+    if (equalLettersIgnoringASCIICase(colorString, "transparent"))
         return;
 
     // If the string is a named CSS color or a 3/6-digit hex color, use that.
index b85adfa..53ecf0a 100644 (file)
@@ -90,7 +90,7 @@ bool HTMLEmbedElement::isPresentationAttribute(const QualifiedName& name) const
 void HTMLEmbedElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
 {
     if (name == hiddenAttr) {
-        if (equalIgnoringCase(value, "yes") || equalIgnoringCase(value, "true")) {
+        if (equalLettersIgnoringASCIICase(value, "yes") || equalLettersIgnoringASCIICase(value, "true")) {
             addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, 0, CSSPrimitiveValue::CSS_PX);
             addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, 0, CSSPrimitiveValue::CSS_PX);
         }
index 1855819..4a1715e 100644 (file)
@@ -562,13 +562,14 @@ bool HTMLFormControlElement::isDefaultButtonForForm() const
 }
 
 #if ENABLE(IOS_AUTOCORRECT_AND_AUTOCAPITALIZE)
-// FIXME: We should look to share these methods with class HTMLFormElement instead of duplicating them.
+
+// FIXME: We should look to share this code with class HTMLFormElement instead of duplicating the logic.
 
 bool HTMLFormControlElement::autocorrect() const
 {
     const AtomicString& autocorrectValue = fastGetAttribute(autocorrectAttr);
     if (!autocorrectValue.isEmpty())
-        return !equalIgnoringCase(autocorrectValue, "off");
+        return !equalLettersIgnoringASCIICase(autocorrectValue, "off");
     if (HTMLFormElement* form = this->form())
         return form->autocorrect();
     return true;
@@ -598,6 +599,7 @@ void HTMLFormControlElement::setAutocapitalize(const AtomicString& value)
 {
     setAttribute(autocapitalizeAttr, value);
 }
+
 #endif
 
 HTMLFormControlElement* HTMLFormControlElement::enclosingFormControlElement(Node* node)
index ef95941..80a28b4 100644 (file)
@@ -388,13 +388,14 @@ void HTMLFormElement::reset()
 }
 
 #if ENABLE(IOS_AUTOCORRECT_AND_AUTOCAPITALIZE)
-// FIXME: We should look to share these methods with class HTMLFormControlElement instead of duplicating them.
+
+// FIXME: We should look to share this code with class HTMLFormControlElement instead of duplicating the logic.
 
 bool HTMLFormElement::autocorrect() const
 {
     const AtomicString& autocorrectValue = fastGetAttribute(autocorrectAttr);
     if (!autocorrectValue.isEmpty())
-        return !equalIgnoringCase(autocorrectValue, "off");
+        return !equalLettersIgnoringASCIICase(autocorrectValue, "off");
     if (HTMLFormElement* form = this->form())
         return form->autocorrect();
     return true;
@@ -833,7 +834,7 @@ void HTMLFormElement::didMoveToNewDocument(Document* oldDocument)
 
 bool HTMLFormElement::shouldAutocomplete() const
 {
-    return !equalIgnoringCase(fastGetAttribute(autocompleteAttr), "off");
+    return !equalLettersIgnoringASCIICase(fastGetAttribute(autocompleteAttr), "off");
 }
 
 void HTMLFormElement::finishParsingChildren()
index ea326bc..2ac5769 100644 (file)
@@ -114,9 +114,9 @@ void HTMLFrameElementBase::parseAttribute(const QualifiedName& name, const Atomi
         // FIXME: If we are already attached, this has no effect.
     } else if (name == scrollingAttr) {
         // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling."
-        if (equalIgnoringCase(value, "auto") || equalIgnoringCase(value, "yes"))
+        if (equalLettersIgnoringASCIICase(value, "auto") || equalLettersIgnoringASCIICase(value, "yes"))
             m_scrolling = document().frameElementsShouldIgnoreScrolling() ? ScrollbarAlwaysOff : ScrollbarAuto;
-        else if (equalIgnoringCase(value, "no"))
+        else if (equalLettersIgnoringASCIICase(value, "no"))
             m_scrolling = ScrollbarAlwaysOff;
         // FIXME: If we are already attached, this has no effect.
     } else
index db8697f..17a9031 100644 (file)
@@ -104,10 +104,10 @@ void HTMLFrameSetElement::parseAttribute(const QualifiedName& name, const Atomic
 
     if (name == frameborderAttr) {
         if (!value.isNull()) {
-            if (equalIgnoringCase(value, "no") || equalIgnoringCase(value, "0")) {
+            if (equalLettersIgnoringASCIICase(value, "no") || value == "0") {
                 m_frameborder = false;
                 m_frameborderSet = true;
-            } else if (equalIgnoringCase(value, "yes") || equalIgnoringCase(value, "1")) {
+            } else if (equalLettersIgnoringASCIICase(value, "yes") || value == "1") {
                 m_frameborderSet = true;
             }
         } else {
index a111b7f..4744cdb 100644 (file)
@@ -59,10 +59,10 @@ bool HTMLHRElement::isPresentationAttribute(const QualifiedName& name) const
 void HTMLHRElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
 {
     if (name == alignAttr) {
-        if (equalIgnoringCase(value, "left")) {
+        if (equalLettersIgnoringASCIICase(value, "left")) {
             addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, 0, CSSPrimitiveValue::CSS_PX);
             addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto);
-        } else if (equalIgnoringCase(value, "right")) {
+        } else if (equalLettersIgnoringASCIICase(value, "right")) {
             addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto);
             addPropertyToPresentationAttributeStyle(style, CSSPropertyMarginRight, 0, CSSPrimitiveValue::CSS_PX);
         } else {
index db62972..800891b 100644 (file)
@@ -489,7 +489,7 @@ const AtomicString& HTMLImageElement::alt() const
 bool HTMLImageElement::draggable() const
 {
     // Image elements are draggable by default.
-    return !equalIgnoringCase(fastGetAttribute(draggableAttr), "false");
+    return !equalLettersIgnoringASCIICase(fastGetAttribute(draggableAttr), "false");
 }
 
 void HTMLImageElement::setHeight(int value)
index 33bda71..da2a535 100644 (file)
@@ -641,7 +641,7 @@ void HTMLInputElement::parseAttribute(const QualifiedName& name, const AtomicStr
         addToRadioButtonGroup();
         HTMLTextFormControlElement::parseAttribute(name, value);
     } else if (name == autocompleteAttr) {
-        if (equalIgnoringCase(value, "off")) {
+        if (equalLettersIgnoringASCIICase(value, "off")) {
             m_autocomplete = Off;
             registerForSuspensionCallbackIfNeeded();
         } else {
index 8944aab..b617b03 100644 (file)
@@ -102,7 +102,7 @@ bool HTMLKeygenElement::appendFormData(FormDataList& encoded_values, bool)
 {
     // Only RSA is supported at this time.
     const AtomicString& keyType = fastGetAttribute(keytypeAttr);
-    if (!keyType.isNull() && !equalIgnoringCase(keyType, "rsa"))
+    if (!keyType.isNull() && !equalLettersIgnoringASCIICase(keyType, "rsa"))
         return false;
     String value = signedPublicKeyAndChallengeString(shadowSelect()->selectedIndex(), fastGetAttribute(challengeAttr), document().baseURL());
     if (value.isNull())
index 9958ba1..6bd6545 100644 (file)
@@ -94,7 +94,7 @@ void HTMLMarqueeElement::collectStyleForPresentationAttribute(const QualifiedNam
             addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeSpeed, value);
     } else if (name == loopAttr) {
         if (!value.isEmpty()) {
-            if (value == "-1" || equalIgnoringCase(value, "infinite"))
+            if (value == "-1" || equalLettersIgnoringASCIICase(value, "infinite"))
                 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitMarqueeRepetition, CSSValueInfinite);
             else
                 addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeRepetition, value);
index f053ace..37c435a 100644 (file)
@@ -659,9 +659,9 @@ void HTMLMediaElement::parseAttribute(const QualifiedName& name, const AtomicStr
     else if (name == loopAttr)
         updateSleepDisabling();
     else if (name == preloadAttr) {
-        if (equalIgnoringCase(value, "none"))
+        if (equalLettersIgnoringASCIICase(value, "none"))
             m_preload = MediaPlayer::None;
-        else if (equalIgnoringCase(value, "metadata"))
+        else if (equalLettersIgnoringASCIICase(value, "metadata"))
             m_preload = MediaPlayer::MetaData;
         else {
             // The spec does not define an "invalid value default" but "auto" is suggested as the
index 1770812..1e576d1 100644 (file)
@@ -71,15 +71,15 @@ void HTMLMetaElement::process()
     if (contentValue.isNull())
         return;
 
-    if (equalIgnoringCase(name(), "viewport"))
+    if (equalLettersIgnoringASCIICase(name(), "viewport"))
         document().processViewport(contentValue, ViewportArguments::ViewportMeta);
 #if PLATFORM(IOS)
-    else if (equalIgnoringCase(name(), "format-detection"))
+    else if (equalLettersIgnoringASCIICase(name(), "format-detection"))
         document().processFormatDetection(contentValue);
-    else if (equalIgnoringCase(name(), "apple-mobile-web-app-orientations"))
+    else if (equalLettersIgnoringASCIICase(name(), "apple-mobile-web-app-orientations"))
         document().processWebAppOrientations();
 #endif
-    else if (equalIgnoringCase(name(), "referrer"))
+    else if (equalLettersIgnoringASCIICase(name(), "referrer"))
         document().processReferrerPolicy(contentValue);
 
     // Get the document to process the tag, but only if we're actually part of DOM tree (changing a meta tag while
index c456e43..c6b620f 100644 (file)
@@ -138,21 +138,20 @@ void HTMLObjectElement::parseAttribute(const QualifiedName& name, const AtomicSt
     setNeedsStyleRecalc(ReconstructRenderTree);
 }
 
-static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramValues)
+static void mapDataParamToSrc(Vector<String>& paramNames, Vector<String>& paramValues)
 {
-    // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e. Real and WMP
-    // require "src" attribute).
-    int srcIndex = -1, dataIndex = -1;
-    for (unsigned int i = 0; i < paramNames->size(); ++i) {
-        if (equalIgnoringCase((*paramNames)[i], "src"))
-            srcIndex = i;
-        else if (equalIgnoringCase((*paramNames)[i], "data"))
-            dataIndex = i;
+    // Some plugins don't understand the "data" attribute of the OBJECT tag (i.e. Real and WMP require "src" attribute).
+    bool foundSrcParam = false;
+    String dataParamValue;
+    for (unsigned i = 0; i < paramNames.size(); ++i) {
+        if (equalLettersIgnoringASCIICase(paramNames[i], "src"))
+            foundSrcParam = true;
+        else if (equalLettersIgnoringASCIICase(paramNames[i], "data"))
+            dataParamValue = paramValues[i];
     }
-    
-    if (srcIndex == -1 && dataIndex != -1) {
-        paramNames->append("src");
-        paramValues->append((*paramValues)[dataIndex]);
+    if (!foundSrcParam && !dataParamValue.isNull()) {
+        paramNames.append(ASCIILiteral("src"));
+        paramValues.append(WTFMove(dataParamValue));
     }
 }
 
@@ -182,10 +181,10 @@ void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<S
         paramValues.append(param.value());
 
         // FIXME: url adjustment does not belong in this function.
-        if (url.isEmpty() && urlParameter.isEmpty() && (equalIgnoringCase(name, "src") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "code") || equalIgnoringCase(name, "url")))
+        if (url.isEmpty() && urlParameter.isEmpty() && (equalLettersIgnoringASCIICase(name, "src") || equalLettersIgnoringASCIICase(name, "movie") || equalLettersIgnoringASCIICase(name, "code") || equalLettersIgnoringASCIICase(name, "url")))
             urlParameter = stripLeadingAndTrailingHTMLSpaces(param.value());
         // FIXME: serviceType calculation does not belong in this function.
-        if (serviceType.isEmpty() && equalIgnoringCase(name, "type")) {
+        if (serviceType.isEmpty() && equalLettersIgnoringASCIICase(name, "type")) {
             serviceType = param.value();
             size_t pos = serviceType.find(';');
             if (pos != notFound)
@@ -215,7 +214,7 @@ void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<S
         }
     }
     
-    mapDataParamToSrc(&paramNames, &paramValues);
+    mapDataParamToSrc(paramNames, paramValues);
     
     // HTML5 says that an object resource's URL is specified by the object's data
     // attribute, not by a param element. However, for compatibility, allow the
@@ -259,11 +258,11 @@ bool HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk()
     if (!document().page()
         || !document().page()->settings().needsSiteSpecificQuirks()
         || hasFallbackContent()
-        || !equalIgnoringCase(fastGetAttribute(classidAttr), "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"))
+        || !equalLettersIgnoringASCIICase(fastGetAttribute(classidAttr), "clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b"))
         return false;
 
     for (auto& metaElement : descendantsOfType<HTMLMetaElement>(document())) {
-        if (equalIgnoringCase(metaElement.name(), "generator") && metaElement.content().startsWith("Mac OS X Server Web Services Server", false))
+        if (equalLettersIgnoringASCIICase(metaElement.name(), "generator") && metaElement.content().startsWith("Mac OS X Server Web Services Server", false))
             return true;
     }
 
@@ -475,7 +474,7 @@ bool HTMLObjectElement::containsJavaApplet() const
         return true;
 
     for (auto& child : childrenOfType<Element>(*this)) {
-        if (child.hasTagName(paramTag) && equalIgnoringCase(child.getNameAttribute(), "type")
+        if (child.hasTagName(paramTag) && equalLettersIgnoringASCIICase(child.getNameAttribute(), "type")
             && MIMETypeRegistry::isJavaAppletMIMEType(child.getAttribute(valueAttr).string()))
             return true;
         if (child.hasTagName(objectTag) && downcast<HTMLObjectElement>(child).containsJavaApplet())
index 5e95cdc..cb2edf5 100644 (file)
@@ -58,11 +58,11 @@ bool HTMLParagraphElement::isPresentationAttribute(const QualifiedName& name) co
 void HTMLParagraphElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style)
 {
     if (name == alignAttr) {
-        if (equalIgnoringCase(value, "middle") || equalIgnoringCase(value, "center"))
+        if (equalLettersIgnoringASCIICase(value, "middle") || equalLettersIgnoringASCIICase(value, "center"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitCenter);
-        else if (equalIgnoringCase(value, "left"))
+        else if (equalLettersIgnoringASCIICase(value, "left"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitLeft);
-        else if (equalIgnoringCase(value, "right"))
+        else if (equalLettersIgnoringASCIICase(value, "right"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitRight);
         else
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, value);
index bfed477..9cfea2d 100644 (file)
@@ -55,7 +55,7 @@ String HTMLParamElement::value() const
 
 bool HTMLParamElement::isURLParameter(const String& name)
 {
-    return equalIgnoringCase(name, "data") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "src");
+    return equalLettersIgnoringASCIICase(name, "data") || equalLettersIgnoringASCIICase(name, "movie") || equalLettersIgnoringASCIICase(name, "src");
 }
 
 bool HTMLParamElement::isURLAttribute(const Attribute& attribute) const
index ec68917..5410456 100644 (file)
@@ -301,21 +301,21 @@ static bool getBordersFromFrameAttributeValue(const AtomicString& value, bool& b
     borderBottom = false;
     borderLeft = false;
 
-    if (equalIgnoringCase(value, "above"))
+    if (equalLettersIgnoringASCIICase(value, "above"))
         borderTop = true;
-    else if (equalIgnoringCase(value, "below"))
+    else if (equalLettersIgnoringASCIICase(value, "below"))
         borderBottom = true;
-    else if (equalIgnoringCase(value, "hsides"))
+    else if (equalLettersIgnoringASCIICase(value, "hsides"))
         borderTop = borderBottom = true;
-    else if (equalIgnoringCase(value, "vsides"))
+    else if (equalLettersIgnoringASCIICase(value, "vsides"))
         borderLeft = borderRight = true;
-    else if (equalIgnoringCase(value, "lhs"))
+    else if (equalLettersIgnoringASCIICase(value, "lhs"))
         borderLeft = true;
-    else if (equalIgnoringCase(value, "rhs"))
+    else if (equalLettersIgnoringASCIICase(value, "rhs"))
         borderRight = true;
-    else if (equalIgnoringCase(value, "box") || equalIgnoringCase(value, "border"))
+    else if (equalLettersIgnoringASCIICase(value, "box") || equalLettersIgnoringASCIICase(value, "border"))
         borderTop = borderBottom = borderLeft = borderRight = true;
-    else if (!equalIgnoringCase(value, "void"))
+    else if (!equalLettersIgnoringASCIICase(value, "void"))
         return false;
     return true;
 }
@@ -351,7 +351,7 @@ void HTMLTableElement::collectStyleForPresentationAttribute(const QualifiedName&
         addHTMLLengthToStyle(style, CSSPropertyMarginRight, value);
     } else if (name == alignAttr) {
         if (!value.isEmpty()) {
-            if (equalIgnoringCase(value, "center")) {
+            if (equalLettersIgnoringASCIICase(value, "center")) {
                 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitMarginStart, CSSValueAuto);
                 addPropertyToPresentationAttributeStyle(style, CSSPropertyWebkitMarginEnd, CSSValueAuto);
             } else
@@ -403,15 +403,15 @@ void HTMLTableElement::parseAttribute(const QualifiedName& name, const AtomicStr
         m_frameAttr = getBordersFromFrameAttributeValue(value, borderTop, borderRight, borderBottom, borderLeft);
     } else if (name == rulesAttr) {
         m_rulesAttr = UnsetRules;
-        if (equalIgnoringCase(value, "none"))
+        if (equalLettersIgnoringASCIICase(value, "none"))
             m_rulesAttr = NoneRules;
-        else if (equalIgnoringCase(value, "groups"))
+        else if (equalLettersIgnoringASCIICase(value, "groups"))
             m_rulesAttr = GroupsRules;
-        else if (equalIgnoringCase(value, "rows"))
+        else if (equalLettersIgnoringASCIICase(value, "rows"))
             m_rulesAttr = RowsRules;
-        else if (equalIgnoringCase(value, "cols"))
+        else if (equalLettersIgnoringASCIICase(value, "cols"))
             m_rulesAttr = ColsRules;
-        else if (equalIgnoringCase(value, "all"))
+        else if (equalLettersIgnoringASCIICase(value, "all"))
             m_rulesAttr = AllRules;
     } else if (name == cellpaddingAttr) {
         if (!value.isEmpty())
index 835af46..9bc5bda 100644 (file)
@@ -54,24 +54,24 @@ void HTMLTablePartElement::collectStyleForPresentationAttribute(const QualifiedN
         if (!url.isEmpty())
             style.setProperty(CSSProperty(CSSPropertyBackgroundImage, CSSImageValue::create(document().completeURL(url).string())));
     } else if (name == valignAttr) {
-        if (equalIgnoringCase(value, "top"))
+        if (equalLettersIgnoringASCIICase(value, "top"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueTop);
-        else if (equalIgnoringCase(value, "middle"))
+        else if (equalLettersIgnoringASCIICase(value, "middle"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueMiddle);
-        else if (equalIgnoringCase(value, "bottom"))
+        else if (equalLettersIgnoringASCIICase(value, "bottom"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueBottom);
-        else if (equalIgnoringCase(value, "baseline"))
+        else if (equalLettersIgnoringASCIICase(value, "baseline"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueBaseline);
         else
             addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign, value);
     } else if (name == alignAttr) {
-        if (equalIgnoringCase(value, "middle") || equalIgnoringCase(value, "center"))
+        if (equalLettersIgnoringASCIICase(value, "middle") || equalLettersIgnoringASCIICase(value, "center"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitCenter);
-        else if (equalIgnoringCase(value, "absmiddle"))
+        else if (equalLettersIgnoringASCIICase(value, "absmiddle"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueCenter);
-        else if (equalIgnoringCase(value, "left"))
+        else if (equalLettersIgnoringASCIICase(value, "left"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitLeft);
-        else if (equalIgnoringCase(value, "right"))
+        else if (equalLettersIgnoringASCIICase(value, "right"))
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitRight);
         else
             addPropertyToPresentationAttributeStyle(style, CSSPropertyTextAlign, value);
index 2c8ce4f..d5f4c67 100644 (file)
@@ -190,9 +190,9 @@ void HTMLTextAreaElement::parseAttribute(const QualifiedName& name, const Atomic
         // The virtual/physical values were a Netscape extension of HTML 3.0, now deprecated.
         // The soft/hard /off values are a recommendation for HTML 4 extension by IE and NS 4.
         WrapMethod wrap;
-        if (equalIgnoringCase(value, "physical") || equalIgnoringCase(value, "hard") || equalIgnoringCase(value, "on"))
+        if (equalLettersIgnoringASCIICase(value, "physical") || equalLettersIgnoringASCIICase(value, "hard") || equalLettersIgnoringASCIICase(value, "on"))
             wrap = HardWrap;
-        else if (equalIgnoringCase(value, "off"))
+        else if (equalLettersIgnoringASCIICase(value, "off"))
             wrap = NoWrap;
         else
             wrap = SoftWrap;
index 0963720..149f9db 100644 (file)
@@ -244,12 +244,12 @@ void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigne
 
     subtreeHasChanged();
 
-    if (equalIgnoringCase(selectionMode, "select")) {
+    if (equalLettersIgnoringASCIICase(selectionMode, "select")) {
         newSelectionStart = start;
         newSelectionEnd = start + replacementLength;
-    } else if (equalIgnoringCase(selectionMode, "start"))
+    } else if (equalLettersIgnoringASCIICase(selectionMode, "start"))
         newSelectionStart = newSelectionEnd = start;
-    else if (equalIgnoringCase(selectionMode, "end"))
+    else if (equalLettersIgnoringASCIICase(selectionMode, "end"))
         newSelectionStart = newSelectionEnd = start + replacementLength;
     else {
         // Default is "preserve".
@@ -745,10 +745,10 @@ String HTMLTextFormControlElement::directionForFormData() const
         if (dirAttributeValue.isNull())
             continue;
 
-        if (equalIgnoringCase(dirAttributeValue, "rtl") || equalIgnoringCase(dirAttributeValue, "ltr"))
+        if (equalLettersIgnoringASCIICase(dirAttributeValue, "rtl") || equalLettersIgnoringASCIICase(dirAttributeValue, "ltr"))
             return dirAttributeValue;
 
-        if (equalIgnoringCase(dirAttributeValue, "auto")) {
+        if (equalLettersIgnoringASCIICase(dirAttributeValue, "auto")) {
             bool isAuto;
             TextDirection textDirection = static_cast<const HTMLElement*>(element)->directionalityIfhasDirAutoAttribute(isAuto);
             return textDirection == RTL ? "rtl" : "ltr";
index edec540..9185b5d 100644 (file)
@@ -135,7 +135,7 @@ void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr
 #if PLATFORM(IOS) && ENABLE(WIRELESS_PLAYBACK_TARGET)
         if (name == webkitairplayAttr) {
             bool disabled = false;
-            if (equalIgnoringCase(fastGetAttribute(HTMLNames::webkitairplayAttr), "deny"))
+            if (equalLettersIgnoringASCIICase(fastGetAttribute(HTMLNames::webkitairplayAttr), "deny"))
                 disabled = true;
             mediaSession().setWirelessVideoPlaybackDisabled(*this, disabled);
         }
index da34660..7da4f4a 100644 (file)
@@ -1006,8 +1006,7 @@ void InputType::applyStep(int count, AnyStepHandling anyStepHandling, TextFieldE
     if (newValue < stepRange.minimum())
         newValue = stepRange.minimum();
 
-    const AtomicString& stepString = element().fastGetAttribute(stepAttr);
-    if (!equalIgnoringCase(stepString, "any"))
+    if (!equalLettersIgnoringASCIICase(element().fastGetAttribute(stepAttr), "any"))
         newValue = stepRange.alignValueForStep(current, newValue);
 
     if (newValue - stepRange.maximum() > acceptableErrorValue) {
index ae70c62..d462156 100644 (file)
@@ -42,19 +42,19 @@ LinkRelAttribute::LinkRelAttribute()
 
 LinkRelAttribute::LinkRelAttribute(const String& rel)
 {
-    if (equalIgnoringCase(rel, "stylesheet"))
+    if (equalLettersIgnoringASCIICase(rel, "stylesheet"))
         isStyleSheet = true;
-    else if (equalIgnoringCase(rel, "icon") || equalIgnoringCase(rel, "shortcut icon"))
+    else if (equalLettersIgnoringASCIICase(rel, "icon") || equalLettersIgnoringASCIICase(rel, "shortcut icon"))
         iconType = Favicon;
 #if ENABLE(TOUCH_ICON_LOADING)
-    else if (equalIgnoringCase(rel, "apple-touch-icon"))
+    else if (equalLettersIgnoringASCIICase(rel, "apple-touch-icon"))
         iconType = TouchIcon;
-    else if (equalIgnoringCase(rel, "apple-touch-icon-precomposed"))
+    else if (equalLettersIgnoringASCIICase(rel, "apple-touch-icon-precomposed"))
         iconType = TouchPrecomposedIcon;
 #endif
-    else if (equalIgnoringCase(rel, "dns-prefetch"))
+    else if (equalLettersIgnoringASCIICase(rel, "dns-prefetch"))
         isDNSPrefetch = true;
-    else if (equalIgnoringCase(rel, "alternate stylesheet") || equalIgnoringCase(rel, "stylesheet alternate")) {
+    else if (equalLettersIgnoringASCIICase(rel, "alternate stylesheet") || equalLettersIgnoringASCIICase(rel, "stylesheet alternate")) {
         isStyleSheet = true;
         isAlternate = true;
     } else {
@@ -64,22 +64,22 @@ LinkRelAttribute::LinkRelAttribute(const String& rel)
         Vector<String> list;
         relCopy.split(' ', list);
         for (auto& word : list) {
-            if (equalIgnoringCase(word, "stylesheet"))
+            if (equalLettersIgnoringASCIICase(word, "stylesheet"))
                 isStyleSheet = true;
-            else if (equalIgnoringCase(word, "alternate"))
+            else if (equalLettersIgnoringASCIICase(word, "alternate"))
                 isAlternate = true;
-            else if (equalIgnoringCase(word, "icon"))
+            else if (equalLettersIgnoringASCIICase(word, "icon"))
                 iconType = Favicon;
 #if ENABLE(TOUCH_ICON_LOADING)
-            else if (equalIgnoringCase(word, "apple-touch-icon"))
+            else if (equalLettersIgnoringASCIICase(word, "apple-touch-icon"))
                 iconType = TouchIcon;
-            else if (equalIgnoringCase(word, "apple-touch-icon-precomposed"))
+            else if (equalLettersIgnoringASCIICase(word, "apple-touch-icon-precomposed"))
                 iconType = TouchPrecomposedIcon;
 #endif
 #if ENABLE(LINK_PREFETCH)
-            else if (equalIgnoringCase(word, "prefetch"))
+            else if (equalLettersIgnoringASCIICase(word, "prefetch"))
                 isLinkPrefetch = true;
-            else if (equalIgnoringCase(word, "subresource"))
+            else if (equalLettersIgnoringASCIICase(word, "subresource"))
                 isLinkSubresource = true;
 #endif
         }
index bb580c3..1a4de64 100644 (file)
@@ -237,11 +237,11 @@ bool MediaElementSession::wirelessVideoPlaybackDisabled(const HTMLMediaElement&
 
 #if PLATFORM(IOS)
     String legacyAirplayAttributeValue = element.fastGetAttribute(HTMLNames::webkitairplayAttr);
-    if (equalIgnoringCase(legacyAirplayAttributeValue, "deny")) {
+    if (equalLettersIgnoringASCIICase(legacyAirplayAttributeValue, "deny")) {
         LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning TRUE because of legacy attribute");
         return true;
     }
-    if (equalIgnoringCase(legacyAirplayAttributeValue, "allow")) {
+    if (equalLettersIgnoringASCIICase(legacyAirplayAttributeValue, "allow")) {
         LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning FALSE because of legacy attribute");
         return false;
     }
index f6604e8..51d24e7 100644 (file)
@@ -166,8 +166,8 @@ bool NumberInputType::sizeShouldIncludeDecoration(int defaultSize, int& preferre
 {
     preferredSize = defaultSize;
 
-    const String stepString = element().fastGetAttribute(stepAttr);
-    if (equalIgnoringCase(stepString, "any"))
+    auto& stepString = element().fastGetAttribute(stepAttr);
+    if (equalLettersIgnoringASCIICase(stepString, "any"))
         return false;
 
     const Decimal minimum = parseToDecimalForNumberType(element().fastGetAttribute(minAttr));
index 9998bc6..8da5c2c 100644 (file)
@@ -121,7 +121,7 @@ StepRange RangeInputType::createStepRange(AnyStepHandling anyStepHandling) const
 
     const AtomicString& precisionValue = element().fastGetAttribute(precisionAttr);
     if (!precisionValue.isNull()) {
-        const Decimal step = equalIgnoringCase(precisionValue, "float") ? Decimal::nan() : 1;
+        const Decimal step = equalLettersIgnoringASCIICase(precisionValue, "float") ? Decimal::nan() : 1;
         return StepRange(minimum, minimum, maximum, step, stepDescription);
     }
 
@@ -207,7 +207,7 @@ void RangeInputType::handleKeydownEvent(KeyboardEvent* event)
 
     // FIXME: We can't use stepUp() for the step value "any". So, we increase
     // or decrease the value by 1/100 of the value range. Is it reasonable?
-    const Decimal step = equalIgnoringCase(element().fastGetAttribute(stepAttr), "any") ? (stepRange.maximum() - stepRange.minimum()) / 100 : stepRange.step();
+    const Decimal step = equalLettersIgnoringASCIICase(element().fastGetAttribute(stepAttr), "any") ? (stepRange.maximum() - stepRange.minimum()) / 100 : stepRange.step();
     const Decimal bigStep = std::max((stepRange.maximum() - stepRange.minimum()) / 10, step);
 
     bool isVertical = false;
index ebf31d4..c0cb4fe 100644 (file)
@@ -97,7 +97,7 @@ Decimal StepRange::parseStep(AnyStepHandling anyStepHandling, const StepDescript
     if (stepString.isEmpty())
         return stepDescription.defaultValue();
 
-    if (equalIgnoringCase(stepString, "any")) {
+    if (equalLettersIgnoringASCIICase(stepString, "any")) {
         switch (anyStepHandling) {
         case RejectAny:
             return Decimal::nan();
index b683a2e..1c8b203 100644 (file)
@@ -45,9 +45,9 @@ namespace WebCore {
 
 enum ColorParseResult { ParsedRGBA, ParsedCurrentColor, ParsedSystemColor, ParseFailed };
 
-static ColorParseResult parseColor(RGBA32& parsedColor, const String& colorString, Document* document = 0)
+static ColorParseResult parseColor(RGBA32& parsedColor, const String& colorString, Document* document = nullptr)
 {
-    if (equalIgnoringCase(colorString, "currentcolor"))
+    if (equalLettersIgnoringASCIICase(colorString, "currentcolor"))
         return ParsedCurrentColor;
     if (CSSParser::parseColor(parsedColor, colorString))
         return ParsedRGBA;
index 12e4108..66cbaf3 100644 (file)
@@ -375,12 +375,12 @@ void HTMLConstructionSite::setCompatibilityModeFromDoctype(const String& name, c
         || publicId.startsWith("-//W3C//DTD HTML Experimental 970421//", false)
         || publicId.startsWith("-//W3C//DTD W3 HTML//", false)
         || publicId.startsWith("-//W3O//DTD W3 HTML 3.0//", false)
-        || equalIgnoringCase(publicId, "-//W3O//DTD W3 HTML Strict 3.0//EN//")
+        || equalLettersIgnoringASCIICase(publicId, "-//w3o//dtd w3 html strict 3.0//en//")
         || publicId.startsWith("-//WebTechs//DTD Mozilla HTML 2.0//", false)
         || publicId.startsWith("-//WebTechs//DTD Mozilla HTML//", false)
-        || equalIgnoringCase(publicId, "-/W3C/DTD HTML 4.0 Transitional/EN")
-        || equalIgnoringCase(publicId, "HTML")
-        || equalIgnoringCase(systemId, "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd")
+        || equalLettersIgnoringASCIICase(publicId, "-/w3c/dtd html 4.0 transitional/en")
+        || equalLettersIgnoringASCIICase(publicId, "html")
+        || equalLettersIgnoringASCIICase(systemId, "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd")
         || (systemId.isEmpty() && publicId.startsWith("-//W3C//DTD HTML 4.01 Frameset//", false))
         || (systemId.isEmpty() && publicId.startsWith("-//W3C//DTD HTML 4.01 Transitional//", false))) {
         setCompatibilityMode(DocumentCompatibilityMode::QuirksMode);
index 13897bf..c78d95e 100644 (file)
@@ -284,8 +284,8 @@ bool HTMLElementStack::isHTMLIntegrationPoint(HTMLStackItem& item)
         const Attribute* encodingAttr = item.findAttribute(MathMLNames::encodingAttr);
         if (encodingAttr) {
             const String& encoding = encodingAttr->value();
-            return equalIgnoringCase(encoding, "text/html")
-                || equalIgnoringCase(encoding, "application/xhtml+xml");
+            return equalLettersIgnoringASCIICase(encoding, "text/html")
+                || equalLettersIgnoringASCIICase(encoding, "application/xhtml+xml");
         }
         return false;
     }
index 752dbee..af9fd50 100644 (file)
@@ -106,7 +106,7 @@ TextEncoding HTMLMetaCharsetParser::encodingFromMetaAttributes(const AttributeLi
         const String& attributeValue = attribute.second;
 
         if (attributeName == http_equivAttr) {
-            if (equalIgnoringCase(attributeValue, "content-type"))
+            if (equalLettersIgnoringASCIICase(attributeValue, "content-type"))
                 gotPragma = true;
         } else if (charset.isEmpty()) {
             if (attributeName == charsetAttr) {
index 2a8168f..a62de33 100644 (file)
@@ -229,13 +229,13 @@ private:
             if (match(attributeName, srcAttr))
                 setUrlToLoad(attributeValue);
             else if (match(attributeName, typeAttr))
-                m_inputIsImage = equalIgnoringCase(attributeValue, InputTypeNames::image());
+                m_inputIsImage = equalLettersIgnoringASCIICase(attributeValue, "image");
             break;
         case TagId::Meta:
             if (match(attributeName, contentAttr))
                 m_metaContent = attributeValue;
             else if (match(attributeName, nameAttr))
-                m_metaIsViewport = equalIgnoringCase(attributeValue, "viewport");
+                m_metaIsViewport = equalLettersIgnoringASCIICase(attributeValue, "viewport");
             break;
         case TagId::Base:
         case TagId::Style:
@@ -315,7 +315,7 @@ private:
 
     bool crossOriginModeAllowsCookies()
     {
-        return m_crossOriginMode.isNull() || equalIgnoringCase(m_crossOriginMode, "use-credentials");
+        return m_crossOriginMode.isNull() || equalLettersIgnoringASCIICase(m_crossOriginMode, "use-credentials");
     }
 
     TagId m_tagId;
index db817a8..a21cc2d 100644 (file)
@@ -777,7 +777,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken& token)
         m_tree.reconstructTheActiveFormattingElements();
         m_tree.insertSelfClosingHTMLElement(&token);
         Attribute* typeAttribute = findAttribute(token.attributes(), typeAttr);
-        if (!typeAttribute || !equalIgnoringCase(typeAttribute->value(), "hidden"))
+        if (!typeAttribute || !equalLettersIgnoringASCIICase(typeAttribute->value(), "hidden"))
             m_framesetOk = false;
         return;
     }
@@ -1019,7 +1019,7 @@ void HTMLTreeBuilder::processStartTagForInTable(AtomicHTMLToken& token)
     }
     if (token.name() == inputTag) {
         Attribute* typeAttribute = findAttribute(token.attributes(), typeAttr);
-        if (typeAttribute && equalIgnoringCase(typeAttribute->value(), "hidden")) {
+        if (typeAttribute && equalLettersIgnoringASCIICase(typeAttribute->value(), "hidden")) {
             parseError(token);
             m_tree.insertSelfClosingHTMLElement(&token);
             return;
index c26ffc8..dd00f67 100644 (file)
@@ -147,7 +147,7 @@ static bool isNameOfInlineEventHandler(const Vector<UChar, 32>& name)
 static bool isDangerousHTTPEquiv(const String& value)
 {
     String equiv = value.stripWhiteSpace();
-    return equalIgnoringCase(equiv, "refresh") || equalIgnoringCase(equiv, "set-cookie");
+    return equalLettersIgnoringASCIICase(equiv, "refresh") || equalLettersIgnoringASCIICase(equiv, "set-cookie");
 }
 
 static inline String decode16BitUnicodeEscapeSequences(const String& string)
index 9eb159f..8e92630 100644 (file)
@@ -247,12 +247,8 @@ bool WebVTTParser::hasRequiredFileIdentifier(const String& line)
     // A WebVTT file identifier consists of an optional BOM character,
     // the string "WEBVTT" followed by an optional space or tab character,
     // and any number of characters that are not line terminators ...
-    if (line.isEmpty())
-        return false;
-
     if (!line.startsWith(fileIdentifier, fileIdentifierLength))
         return false;
-
     if (line.length() > fileIdentifierLength && !isHTMLSpace(line[fileIdentifierLength]))
         return false;
     return true;
index d660226..fda77e4 100644 (file)
@@ -126,7 +126,7 @@ static RefPtr<TextResourceDecoder> createXHRTextDecoder(const String& mimeType,
     else if (DOMImplementation::isXMLMIMEType(mimeType.lower())) {
         decoder = TextResourceDecoder::create("application/xml");
         decoder->useLenientXMLDecoding();
-    } else if (equalIgnoringCase(mimeType, "text/html"))
+    } else if (equalLettersIgnoringASCIICase(mimeType, "text/html"))
         decoder = TextResourceDecoder::create("text/html", "UTF-8");
     else
         decoder = TextResourceDecoder::create("text/plain", "UTF-8");
index 15d4839..dbd431a 100644 (file)
@@ -144,7 +144,7 @@ static RefPtr<TextResourceDecoder> createOtherResourceTextDecoder(const String&
     else if (DOMImplementation::isXMLMIMEType(mimeType.lower())) {
         decoder = TextResourceDecoder::create("application/xml");
         decoder->useLenientXMLDecoding();
-    } else if (equalIgnoringCase(mimeType, "text/html"))
+    } else if (equalLettersIgnoringASCIICase(mimeType, "text/html"))
         decoder = TextResourceDecoder::create("text/html", "UTF-8");
     else if (mimeType == "text/plain")
         decoder = TextResourceDecoder::create("text/plain", "ISO-8859-1");
index 9fef8a7..17a0b0b 100644 (file)
@@ -56,9 +56,9 @@ bool isOnAccessControlSimpleRequestHeaderWhitelist(HTTPHeaderName name, const St
     case HTTPHeaderName::ContentType: {
         // Preflight is required for MIME types that can not be sent via form submission.
         String mimeType = extractMIMETypeFromMediaType(value);
-        return equalIgnoringCase(mimeType, "application/x-www-form-urlencoded")
-            || equalIgnoringCase(mimeType, "multipart/form-data")
-            || equalIgnoringCase(mimeType, "text/plain");
+        return equalIgnoringASCIICase(mimeType, "application/x-www-form-urlencoded")
+            || equalIgnoringASCIICase(mimeType, "multipart/form-data")
+            || equalIgnoringASCIICase(mimeType, "text/plain");
     }
     default:
         return false;
index 9460b84..17a628c 100644 (file)
@@ -714,12 +714,12 @@ void DocumentLoader::continueAfterContentPolicy(PolicyAction policy)
     switch (policy) {
     case PolicyUse: {
         // Prevent remote web archives from loading because they can claim to be from any domain and thus avoid cross-domain security checks (4120255).
-        bool isRemoteWebArchive = (equalIgnoringCase("application/x-webarchive", mimeType)
-            || equalIgnoringCase("application/x-mimearchive", mimeType)
+        bool isRemoteWebArchive = (equalLettersIgnoringASCIICase(mimeType, "application/x-webarchive")
+            || equalLettersIgnoringASCIICase(mimeType, "application/x-mimearchive")
 #if PLATFORM(GTK)
-            || equalIgnoringCase("message/rfc822", mimeType)
+            || equalLettersIgnoringASCIICase(mimeType, "message/rfc822")
 #endif
-            || equalIgnoringCase("multipart/related", mimeType))
+            || equalLettersIgnoringASCIICase(mimeType, "multipart/related"))
             && !m_substituteData.isValid() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol());
         if (!frameLoader()->client().canShowMIMEType(mimeType) || isRemoteWebArchive) {
             frameLoader()->policyChecker().cannotShowMIMEType(m_response);
index a4a4b37..5c4d581 100644 (file)
@@ -65,7 +65,7 @@ static void appendMailtoPostFormDataToURL(URL& url, const FormData& data, const
 {
     String body = data.flattenToString();
 
-    if (equalIgnoringCase(encodingType, "text/plain")) {
+    if (equalLettersIgnoringASCIICase(encodingType, "text/plain")) {
         // Convention seems to be to decode, and s/&/\r\n/. Also, spaces are encoded as %20.
         body = decodeURLEscapeSequences(body.replaceWithLiteral('&', "\r\n").replace('+', ' ') + "\r\n");
     }
@@ -90,9 +90,9 @@ void FormSubmission::Attributes::parseAction(const String& action)
 
 String FormSubmission::Attributes::parseEncodingType(const String& type)
 {
-    if (equalIgnoringCase(type, "multipart/form-data"))
+    if (equalLettersIgnoringASCIICase(type, "multipart/form-data"))
         return "multipart/form-data";
-    if (equalIgnoringCase(type, "text/plain"))
+    if (equalLettersIgnoringASCIICase(type, "text/plain"))
         return "text/plain";
     return "application/x-www-form-urlencoded";
 }
@@ -105,7 +105,7 @@ void FormSubmission::Attributes::updateEncodingType(const String& type)
 
 FormSubmission::Method FormSubmission::Attributes::parseMethodType(const String& type)
 {
-    return equalIgnoringCase(type, "post") ? FormSubmission::PostMethod : FormSubmission::GetMethod;
+    return equalLettersIgnoringASCIICase(type, "post") ? FormSubmission::PostMethod : FormSubmission::GetMethod;
 }
 
 void FormSubmission::Attributes::updateMethodType(const String& type)
index 02977f6..4df0a66 100644 (file)
@@ -2806,7 +2806,7 @@ bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S
 
     // FIXME: What about load types other than Standard and Reload?
 
-    return (!isFormSubmission || equalIgnoringCase(httpMethod, "GET"))
+    return (!isFormSubmission || equalLettersIgnoringASCIICase(httpMethod, "get"))
         && loadType != FrameLoadType::Reload
         && loadType != FrameLoadType::ReloadFromOrigin
         && loadType != FrameLoadType::Same
@@ -3216,7 +3216,7 @@ bool FrameLoader::shouldTreatURLAsSameAsCurrent(const URL& url) const
 
 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const URL& url) const
 {
-    if (!equalIgnoringCase(url.string(), "about:srcdoc"))
+    if (!equalLettersIgnoringASCIICase(url.string(), "about:srcdoc"))
         return false;
     HTMLFrameOwnerElement* ownerElement = m_frame.ownerElement();
     if (!ownerElement)
index 28ef07f..34b4ba3 100644 (file)
@@ -180,7 +180,7 @@ void ImageLoader::updateFromElement()
 
         String crossOriginMode = element().fastGetAttribute(HTMLNames::crossoriginAttr);
         if (!crossOriginMode.isNull()) {
-            StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
+            StoredCredentials allowCredentials = equalLettersIgnoringASCIICase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
             updateRequestForAccessControl(request.mutableResourceRequest(), document.securityOrigin(), allowCredentials);
         }
 
index d7cc48d..da47dd9 100644 (file)
@@ -58,7 +58,7 @@ bool MediaResourceLoader::start(const ResourceRequest& request, LoadOptions opti
 
     DataBufferingPolicy bufferingPolicy = options & LoadOption::BufferData ? WebCore::BufferData : WebCore::DoNotBufferData;
     RequestOriginPolicy corsPolicy = !m_crossOriginMode.isNull() ? PotentiallyCrossOriginEnabled : UseDefaultOriginRestrictionsForType;
-    StoredCredentials allowCredentials = m_crossOriginMode.isNull() || equalIgnoringCase(m_crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
+    StoredCredentials allowCredentials = m_crossOriginMode.isNull() || equalLettersIgnoringASCIICase(m_crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
 
     // ContentSecurityPolicyImposition::DoPolicyCheck is a placeholder value. It does not affect the request since Content Security Policy does not apply to raw resources.
     CachedResourceRequest cacheRequest(request, ResourceLoaderOptions(SendCallbacks, DoNotSniffContent, bufferingPolicy, allowCredentials, DoNotAskClientForCrossOriginCredentials, ClientDidNotRequestCredentials, DoSecurityCheck, corsPolicy, DoNotIncludeCertificateInfo, ContentSecurityPolicyImposition::DoPolicyCheck, DefersLoadingPolicy::AllowDefersLoading));
index b5b6da7..0de434c 100644 (file)
@@ -239,9 +239,9 @@ PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, H
     String codeBaseURLString;
 
     for (size_t i = 0; i < paramNames.size(); ++i) {
-        if (equalIgnoringCase(paramNames[i], "baseurl"))
+        if (equalLettersIgnoringASCIICase(paramNames[i], "baseurl"))
             baseURLString = paramValues[i];
-        else if (equalIgnoringCase(paramNames[i], "codebase"))
+        else if (equalLettersIgnoringASCIICase(paramNames[i], "codebase"))
             codeBaseURLString = paramValues[i];
     }
 
index 2d7ed72..ba6bddb 100644 (file)
@@ -302,9 +302,9 @@ breakBreak:
 
 TextResourceDecoder::ContentType TextResourceDecoder::determineContentType(const String& mimeType)
 {
-    if (equalIgnoringCase(mimeType, "text/css"))
+    if (equalLettersIgnoringASCIICase(mimeType, "text/css"))
         return CSS;
-    if (equalIgnoringCase(mimeType, "text/html"))
+    if (equalLettersIgnoringASCIICase(mimeType, "text/html"))
         return HTML;
     if (DOMImplementation::isXMLMIMEType(mimeType))
         return XML;
index 6da1083..e30cae2 100644 (file)
@@ -159,7 +159,7 @@ bool TextTrackLoader::load(const URL& url, const String& crossOriginMode, bool i
 
     if (!crossOriginMode.isNull()) {
         m_crossOriginMode = crossOriginMode;
-        StoredCredentials allowCredentials = equalIgnoringCase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
+        StoredCredentials allowCredentials = equalLettersIgnoringASCIICase(crossOriginMode, "use-credentials") ? AllowStoredCredentials : DoNotAllowStoredCredentials;
         updateRequestForAccessControl(cueRequest.mutableResourceRequest(), document->securityOrigin(), allowCredentials);
     } else {
         // Cross-origin resources that are not suitably CORS-enabled may not load.
index 8d7f0e2..db518f0 100644 (file)
@@ -123,14 +123,8 @@ ApplicationCacheResource* ApplicationCache::resourceForURL(const String& url)
 
 bool ApplicationCache::requestIsHTTPOrHTTPSGet(const ResourceRequest& request)
 {
-    if (!request.url().protocolIsInHTTPFamily())
-        return false;
-    
-    if (!equalIgnoringCase(request.httpMethod(), "GET"))
-        return false;
-
-    return true;
-}    
+    return request.url().protocolIsInHTTPFamily() && equalLettersIgnoringASCIICase(request.httpMethod(), "get");
+}
 
 ApplicationCacheResource* ApplicationCache::resourceForRequest(const ResourceRequest& request)
 {
index 7091fce..d45f36e 100644 (file)
@@ -129,7 +129,7 @@ bool CachedCSSStyleSheet::canUseSheet(MIMETypeCheck mimeTypeCheck, bool* hasVali
     // This code defaults to allowing the stylesheet for non-HTTP protocols so
     // folks can use standards mode for local HTML documents.
     String mimeType = extractMIMETypeFromMediaType(response().httpHeaderField(HTTPHeaderName::ContentType));
-    bool typeOK = mimeType.isEmpty() || equalIgnoringCase(mimeType, "text/css") || equalIgnoringCase(mimeType, "application/x-unknown-content-type");
+    bool typeOK = mimeType.isEmpty() || equalLettersIgnoringASCIICase(mimeType, "text/css") || equalLettersIgnoringASCIICase(mimeType, "application/x-unknown-content-type");
     if (hasValidMIMEType)
         *hasValidMIMEType = typeOK;
     return typeOK;
index 6b6a90a..c3f18ab 100644 (file)
@@ -362,14 +362,14 @@ bool CachedResource::isExpired() const
 static inline bool shouldCacheSchemeIndefinitely(const String& scheme)
 {
 #if PLATFORM(COCOA)
-    if (equalIgnoringCase(scheme, "applewebdata"))
+    if (equalLettersIgnoringASCIICase(scheme, "applewebdata"))
         return true;
 #endif
 #if USE(SOUP)
-    if (equalIgnoringCase(scheme, "resource"))
+    if (equalLettersIgnoringASCIICase(scheme, "resource"))
         return true;
 #endif
-    return equalIgnoringCase(scheme, "data");
+    return equalLettersIgnoringASCIICase(scheme, "data");
 }
 
 std::chrono::microseconds CachedResource::freshnessLifetime(const ResourceResponse& response) const
index db91a1d..a37f99d 100644 (file)
@@ -283,43 +283,43 @@ void DOMSelection::modify(const String& alterString, const String& directionStri
         return;
 
     FrameSelection::EAlteration alter;
-    if (equalIgnoringCase(alterString, "extend"))
+    if (equalLettersIgnoringASCIICase(alterString, "extend"))
         alter = FrameSelection::AlterationExtend;
-    else if (equalIgnoringCase(alterString, "move"))
+    else if (equalLettersIgnoringASCIICase(alterString, "move"))
         alter = FrameSelection::AlterationMove;
     else
         return;
 
     SelectionDirection direction;
-    if (equalIgnoringCase(directionString, "forward"))
+    if (equalLettersIgnoringASCIICase(directionString, "forward"))
         direction = DirectionForward;
-    else if (equalIgnoringCase(directionString, "backward"))
+    else if (equalLettersIgnoringASCIICase(directionString, "backward"))
         direction = DirectionBackward;
-    else if (equalIgnoringCase(directionString, "left"))
+    else if (equalLettersIgnoringASCIICase(directionString, "left"))
         direction = DirectionLeft;
-    else if (equalIgnoringCase(directionString, "right"))
+    else if (equalLettersIgnoringASCIICase(directionString, "right"))
         direction = DirectionRight;
     else
         return;
 
     TextGranularity granularity;
-    if (equalIgnoringCase(granularityString, "character"))
+    if (equalLettersIgnoringASCIICase(granularityString, "character"))
         granularity = CharacterGranularity;
-    else if (equalIgnoringCase(granularityString, "word"))
+    else if (equalLettersIgnoringASCIICase(granularityString, "word"))
         granularity = WordGranularity;
-    else if (equalIgnoringCase(granularityString, "sentence"))
+    else if (equalLettersIgnoringASCIICase(granularityString, "sentence"))
         granularity = SentenceGranularity;
-    else if (equalIgnoringCase(granularityString, "line"))
+    else if (equalLettersIgnoringASCIICase(granularityString, "line"))
         granularity = LineGranularity;
-    else if (equalIgnoringCase(granularityString, "paragraph"))
+    else if (equalLettersIgnoringASCIICase(granularityString, "paragraph"))
         granularity = ParagraphGranularity;
-    else if (equalIgnoringCase(granularityString, "lineboundary"))
+    else if (equalLettersIgnoringASCIICase(granularityString, "lineboundary"))
         granularity = LineBoundary;
-    else if (equalIgnoringCase(granularityString, "sentenceboundary"))
+    else if (equalLettersIgnoringASCIICase(granularityString, "sentenceboundary"))
         granularity = SentenceBoundary;
-    else if (equalIgnoringCase(granularityString, "paragraphboundary"))
+    else if (equalLettersIgnoringASCIICase(granularityString, "paragraphboundary"))
         granularity = ParagraphBoundary;
-    else if (equalIgnoringCase(granularityString, "documentboundary"))
+    else if (equalLettersIgnoringASCIICase(granularityString, "documentboundary"))
         granularity = DocumentBoundary;
     else
         return;
index 553f1a8..5f6c8b5 100644 (file)
@@ -211,7 +211,7 @@ void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& resp
     if (responseIsValid) {
         const String& charset = response.textEncodingName();
         // If we have a charset, the only allowed value is UTF-8 (case-insensitive).
-        responseIsValid = charset.isEmpty() || equalIgnoringCase(charset, "UTF-8");
+        responseIsValid = charset.isEmpty() || equalLettersIgnoringASCIICase(charset, "utf-8");
         if (!responseIsValid) {
             String message = makeString("EventSource's response has a charset (\"", charset, "\") that is not UTF-8. Aborting the connection.");
             // FIXME: We are missing the source line.
index c9a7358..a25efe9 100644 (file)
@@ -2065,7 +2065,7 @@ bool FrameView::scrollToAnchor(const String& name)
     }
   
     // Implement the rule that "" and "top" both mean top of page as in other browsers.
-    if (!anchorElement && !(name.isEmpty() || equalIgnoringCase(name, "top")))
+    if (!anchorElement && !(name.isEmpty() || equalLettersIgnoringASCIICase(name, "top")))
         return false;
 
     ContainerNode* scrollPositionAnchor = anchorElement;
index bb2932c..a3e2cf6 100644 (file)
@@ -116,19 +116,20 @@ PassRefPtr<PerformanceEntryList> Performance::webkitGetEntriesByType(const Strin
     RefPtr<PerformanceEntryList> entries = PerformanceEntryList::create();
 
 #if ENABLE(RESOURCE_TIMING)
-    if (equalIgnoringCase(entryType, "resource"))
+    if (equalLettersIgnoringASCIICase(entryType, "resource")) {
         for (auto& resource : m_resourceTimingBuffer)
             entries->append(resource);
-#endif // ENABLE(RESOURCE_TIMING)
+    }
+#endif
 
 #if ENABLE(USER_TIMING)
     if (m_userTiming) {
-        if (equalIgnoringCase(entryType, "mark"))
+        if (equalLettersIgnoringASCIICase(entryType, "mark"))
             entries->appendAll(m_userTiming->getMarks());
-        else if (equalIgnoringCase(entryType, "measure"))
+        else if (equalLettersIgnoringASCIICase(entryType, "measure"))
             entries->appendAll(m_userTiming->getMeasures());
     }
-#endif // ENABLE(USER_TIMING)
+#endif
 
     entries->sort();
     return entries;
index a46ac24..31b8971 100644 (file)
@@ -59,7 +59,7 @@ static bool passesTimingAllowCheck(const ResourceResponse& response, Document* r
         return true;
 
     const String& timingAllowOriginString = response.httpHeaderField(HTTPHeaderName::TimingAllowOrigin);
-    if (timingAllowOriginString.isEmpty() || equalIgnoringCase(timingAllowOriginString, "null"))
+    if (timingAllowOriginString.isEmpty() || equalLettersIgnoringASCIICase(timingAllowOriginString, "null"))
         return false;
 
     if (timingAllowOriginString == "*")
index 580336c..8fe7e60 100644 (file)
@@ -109,8 +109,8 @@ static bool shouldTreatAsUniqueOrigin(const URL& url)
 }
 
 SecurityOrigin::SecurityOrigin(const URL& url)
-    : m_protocol(url.protocol().isNull() ? "" : url.protocol().lower())
-    , m_host(url.host().isNull() ? "" : url.host().lower())
+    : m_protocol(url.protocol().isNull() ? emptyString() : url.protocol().lower())
+    , m_host(url.host().isNull() ? emptyString() : url.host().lower())
     , m_port(url.port())
     , m_isUnique(false)
     , m_universalAccess(false)
@@ -133,9 +133,9 @@ SecurityOrigin::SecurityOrigin(const URL& url)
 }
 
 SecurityOrigin::SecurityOrigin()
-    : m_protocol("")
-    , m_host("")
-    , m_domain("")
+    : m_protocol(emptyString())
+    , m_host(emptyString())
+    , m_domain(emptyString())
     , m_port(InvalidPort)
     , m_isUnique(true)
     , m_universalAccess(false)
@@ -462,9 +462,9 @@ bool SecurityOrigin::isLocal() const
 String SecurityOrigin::toString() const
 {
     if (isUnique())
-        return "null";
+        return ASCIILiteral("null");
     if (m_protocol == "file" && m_enforceFilePathSeparation)
-        return "null";
+        return ASCIILiteral("null");
     return toRawString();
 }
 
@@ -552,7 +552,7 @@ String SecurityOrigin::databaseIdentifier() const
     // Now that we've fixed that bug, we still need to produce this string
     // to avoid breaking existing persistent state.
     if (m_needsDatabaseIdentifierQuirkForFiles)
-        return "file__0";
+        return ASCIILiteral("file__0");
 
     StringBuilder stringBuilder;
     stringBuilder.append(m_protocol);
index 6569cdc..9dba91c 100644 (file)
@@ -77,7 +77,7 @@ bool UserContentURLPattern::parse(const String& pattern)
 
     int pathStartPos = 0;
 
-    if (equalIgnoringCase(m_scheme, "file"))
+    if (equalLettersIgnoringASCIICase(m_scheme, "file"))
         pathStartPos = hostStartPos;
     else {
         size_t hostEndPos = pattern.find('/', hostStartPos);
@@ -117,7 +117,7 @@ bool UserContentURLPattern::matches(const URL& test) const
     if (!equalIgnoringCase(test.protocol(), m_scheme))
         return false;
 
-    if (!equalIgnoringCase(m_scheme, "file") && !matchesHost(test))
+    if (!equalLettersIgnoringASCIICase(m_scheme, "file") && !matchesHost(test))
         return false;
 
     return matchesPath(test);
index 889b746..788e8fd 100644 (file)
@@ -787,7 +787,7 @@ bool URL::protocolIs(const char* protocol) const
 
     // JavaScript URLs are "valid" and should be executed even if URL decides they are invalid.
     // The free function protocolIsJavaScript() should be used instead. 
-    ASSERT(!equalIgnoringCase(protocol, String("javascript")));
+    ASSERT(!equalLettersIgnoringASCIICase(StringView(protocol), "javascript"));
 
     if (!m_isValid)
         return false;
index 05b500e..13fd4f3 100644 (file)
@@ -73,22 +73,23 @@ bool CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType(const String& ke
     if (!supportsKeySystem(keySystem))
         return false;
 
-    if (!mimeType.isEmpty()) {
-        if (equalIgnoringCase(mimeType, "keyrelease"))
-            return true;
+    if (mimeType.isEmpty())
+        return true;
 
-        MediaEngineSupportParameters parameters;
-        parameters.isMediaSource = true;
-        parameters.type = mimeType;
+    // FIXME: Why is this ignoring case since the check in supportsMIMEType is checking case?
+    if (equalLettersIgnoringASCIICase(mimeType, "keyrelease"))
+        return true;
 
-        return MediaPlayerPrivateMediaSourceAVFObjC::supportsType(parameters) != MediaPlayer::IsNotSupported;
-    }
+    MediaEngineSupportParameters parameters;
+    parameters.isMediaSource = true;
+    parameters.type = mimeType;
 
-    return true;
+    return MediaPlayerPrivateMediaSourceAVFObjC::supportsType(parameters) != MediaPlayer::IsNotSupported;
 }
 
 bool CDMPrivateMediaSourceAVFObjC::supportsMIMEType(const String& mimeType)
 {
+    // FIXME: Why is this checking case since the check in supportsKeySystemAndMimeType is ignoring case?
     if (mimeType == "keyrelease")
         return true;
 
index 7e6cfee..27b7891 100644 (file)
@@ -157,7 +157,7 @@ RefPtr<Uint8Array> CDMSessionAVContentKeySession::generateKeyRequest(const Strin
 
     m_initData = initData;
 
-    if (equalIgnoringCase(mimeType, "keyrelease")) {
+    if (equalLettersIgnoringASCIICase(mimeType, "keyrelease")) {
         m_mode = KeyRelease;
         return generateKeyReleaseMessage(errorCode, systemCode);
     }
index 90aaaf0..e01be64 100644 (file)
@@ -125,7 +125,7 @@ RefPtr<Uint8Array> CDMSessionAVStreamSession::generateKeyRequest(const String& m
 
     m_initData = initData;
 
-    if (equalIgnoringCase(mimeType, "keyrelease")) {
+    if (equalLettersIgnoringASCIICase(mimeType, "keyrelease")) {
         m_mode = KeyRelease;
         return generateKeyReleaseMessage(errorCode, systemCode);
     }
index 3b7b4db..95e4b15 100644 (file)
@@ -417,11 +417,11 @@ static RetainPtr<CFStringRef> utiFromMIMEType(const String& mimeType)
     static const CFStringRef kUTTypePNG = CFSTR("public.png");
     static const CFStringRef kUTTypeGIF = CFSTR("com.compuserve.gif");
 
-    if (equalIgnoringCase(mimeType, "image/png"))
+    if (equalLettersIgnoringASCIICase(mimeType, "image/png"))
         return kUTTypePNG;
-    if (equalIgnoringCase(mimeType, "image/jpeg"))
+    if (equalLettersIgnoringASCIICase(mimeType, "image/jpeg"))
         return jpegUTI();
-    if (equalIgnoringCase(mimeType, "image/gif"))
+    if (equalLettersIgnoringASCIICase(mimeType, "image/gif"))
         return kUTTypeGIF;
 
     ASSERT_NOT_REACHED();
index 153771f..6d325c0 100644 (file)
@@ -504,17 +504,16 @@ RefPtr<Font> FontCache::similarFont(const FontDescription& description, const At
 
 #if PLATFORM(IOS)
     // Substitute the default monospace font for well-known monospace fonts.
-    static NeverDestroyed<AtomicString> monaco("monaco", AtomicString::ConstructFromLiteral);
-    static NeverDestroyed<AtomicString> menlo("menlo", AtomicString::ConstructFromLiteral);
-    static NeverDestroyed<AtomicString> courier("courier", AtomicString::ConstructFromLiteral);
-    if (equalIgnoringCase(family, monaco) || equalIgnoringCase(family, menlo))
+    if (equalLettersIgnoringASCIICase(family, "monaco") || equalLettersIgnoringASCIICase(family, "menlo")) {
+        static NeverDestroyed<AtomicString> courier("courier", AtomicString::ConstructFromLiteral);
         return fontForFamily(description, courier);
+    }
 
     // Substitute Verdana for Lucida Grande.
-    static NeverDestroyed<AtomicString> lucidaGrande("lucida grande", AtomicString::ConstructFromLiteral);
-    static NeverDestroyed<AtomicString> verdana("verdana", AtomicString::ConstructFromLiteral);
-    if (equalIgnoringCase(family, lucidaGrande))
+    if (equalLettersIgnoringASCIICase(family, "lucida grande")) {
+        static NeverDestroyed<AtomicString> verdana("verdana", AtomicString::ConstructFromLiteral);
         return fontForFamily(description, verdana);
+    }
 #endif
 
     static NeverDestroyed<String> arabic(ASCIILiteral("Arabic"));
index fd4e100..5a82a13 100644 (file)
@@ -146,13 +146,10 @@ RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& famil
         return adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr));
     }
 
-    static NeverDestroyed<AtomicString> systemUIFontWithWebKitPrefix("-webkit-system-font", AtomicString::ConstructFromLiteral);
-    static NeverDestroyed<AtomicString> systemUIFontWithApplePrefix("-apple-system", AtomicString::ConstructFromLiteral);
-    static NeverDestroyed<AtomicString> systemUIFontWithAppleAlternatePrefix("-apple-system-font", AtomicString::ConstructFromLiteral);
-    if (equalIgnoringCase(family, systemUIFontWithWebKitPrefix) || equalIgnoringCase(family, systemUIFontWithApplePrefix) || equalIgnoringCase(family, systemUIFontWithAppleAlternatePrefix)) {
+    if (equalLettersIgnoringASCIICase(family, "-webkit-system-font") || equalLettersIgnoringASCIICase(family, "-apple-system") || equalLettersIgnoringASCIICase(family, "-apple-system-font")) {
         CTFontUIFontType fontType = kCTFontUIFontSystem;
         if (weight > FontWeight300) {
-            // The comment below has been copied from CoreText/UIFoundation. However, in WebKit we synthesize the oblique,
+            // The code below has been copied from CoreText/UIFoundation. However, in WebKit we synthesize the oblique,
             // so we should investigate the result <rdar://problem/14449340>:
             if (traits & kCTFontTraitBold)
                 fontType = kCTFontUIFontEmphasizedSystem;
@@ -168,8 +165,7 @@ RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& famil
         return adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr));
     }
 
-    static NeverDestroyed<AtomicString> systemUIMonospacedNumbersFontWithApplePrefix("-apple-system-monospaced-numbers", AtomicString::ConstructFromLiteral);
-    if (equalIgnoringCase(family, systemUIMonospacedNumbersFontWithApplePrefix)) {
+    if (equalLettersIgnoringASCIICase(family, "-apple-system-monospaced-numbers")) {
         RetainPtr<CTFontDescriptorRef> systemFontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontUIFontSystem, size, nullptr));
         RetainPtr<CTFontDescriptorRef> monospaceFontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithFeature(systemFontDescriptor.get(), (CFNumberRef)@(kNumberSpacingType), (CFNumberRef)@(kMonospacedNumbersSelector)));
         return adoptCF(CTFontCreateWithFontDescriptor(monospaceFontDescriptor.get(), size, nullptr));
index b33f4a0..a4d19ba 100644 (file)
@@ -209,9 +209,7 @@ static CGFloat toNSFontWeight(FontWeight fontWeight)
 
 RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& family, FontWeight weight, CTFontSymbolicTraits desiredTraits, float size)
 {
-    if (equalIgnoringASCIICase(family, "-webkit-system-font")
-        || equalIgnoringASCIICase(family, "-apple-system")
-        || equalIgnoringASCIICase(family, "-apple-system-font")) {
+    if (equalLettersIgnoringASCIICase(family, "-webkit-system-font") || equalLettersIgnoringASCIICase(family, "-apple-system") || equalLettersIgnoringASCIICase(family, "-apple-system-font")) {
         RetainPtr<CTFontRef> result = toCTFont([NSFont systemFontOfSize:size weight:toNSFontWeight(weight)]);
         if (desiredTraits & kCTFontItalicTrait) {
             if (auto italicizedFont = adoptCF(CTFontCreateCopyWithSymbolicTraits(result.get(), size, nullptr, desiredTraits, desiredTraits)))
@@ -220,7 +218,7 @@ RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& famil
         return result;
     }
 
-    if (equalIgnoringASCIICase(family, "-apple-system-monospaced-numbers")) {
+    if (equalLettersIgnoringASCIICase(family, "-apple-system-monospaced-numbers")) {
         int numberSpacingType = kNumberSpacingType;
         int monospacedNumbersSelector = kMonospacedNumbersSelector;
         RetainPtr<CFNumberRef> numberSpacingNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &numberSpacingType));
@@ -238,10 +236,10 @@ RetainPtr<CTFontRef> platformFontWithFamilySpecialCase(const AtomicString& famil
         return adoptCF(CTFontCreateCopyWithAttributes(result.get(), size, nullptr, adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get())).get()));
     }
 
-    if (equalIgnoringASCIICase(family, "-apple-menu"))
+    if (equalLettersIgnoringASCIICase(family, "-apple-menu"))
         return toCTFont([NSFont menuFontOfSize:size]);
 
-    if (equalIgnoringASCIICase(family, "-apple-status-bar"))
+    if (equalLettersIgnoringASCIICase(family, "-apple-status-bar"))
         return toCTFont([NSFont labelFontOfSize:size]);
 
     return nullptr;
index 6f7a8a0..dc39af4 100644 (file)
@@ -57,11 +57,12 @@ std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffe
 
 bool FontCustomPlatformData::supportsFormat(const String& format)
 {
-    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype")
+    return equalLettersIgnoringASCIICase(format, "truetype")
+        || equalLettersIgnoringASCIICase(format, "opentype")
 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
-        || equalIgnoringCase(format, "woff2")
+        || equalLettersIgnoringASCIICase(format, "woff2")
 #endif
-        || equalIgnoringCase(format, "woff");
+        || equalLettersIgnoringASCIICase(format, "woff");
 }
 
 }
index 7bb30f3..2ed51c6 100644 (file)
@@ -505,7 +505,7 @@ String Pasteboard::readString(const String& type)
     // Grab the value off the pasteboard corresponding to the cocoaType
     if (cocoaType == String(NSURLPboardType)) {
         // "url" and "text/url-list" both map to NSURLPboardType in cocoaTypeFromHTMLClipboardType(), "url" only wants the first URL
-        bool onlyFirstURL = (equalIgnoringCase(type, "url"));
+        bool onlyFirstURL = equalLettersIgnoringASCIICase(type, "url");
         Vector<String> absoluteURLs = absoluteURLsFromPasteboard(m_pasteboardName, onlyFirstURL);
         for (size_t i = 0; i < absoluteURLs.size(); i++)
             cocoaValue = i ? "\n" + absoluteURLs[i]: absoluteURLs[i];
index f21fa5c..c06dff7 100644 (file)
@@ -137,15 +137,15 @@ void BlobResourceSynchronousLoader::didFail(ResourceHandle*, const ResourceError
 PassRefPtr<BlobResourceHandle> BlobResourceHandle::createAsync(BlobData* blobData, const ResourceRequest& request, ResourceHandleClient* client)
 {
     // FIXME: Should probably call didFail() instead of blocking the load without explanation.
-    if (!equalIgnoringCase(request.httpMethod(), "GET"))
-        return 0;
+    if (!equalLettersIgnoringASCIICase(request.httpMethod(), "get"))
+        return nullptr;
 
     return adoptRef(new BlobResourceHandle(blobData, request, client, true));
 }
 
 void BlobResourceHandle::loadResourceSynchronously(BlobData* blobData, const ResourceRequest& request, ResourceError& error, ResourceResponse& response, Vector<char>& data)
 {
-    if (!equalIgnoringCase(request.httpMethod(), "GET")) {
+    if (!equalLettersIgnoringASCIICase(request.httpMethod(), "get")) {
         error = ResourceError(webKitBlobResourceDomain, methodNotAllowed, response.url(), "Request method must be GET");
         return;
     }
index 9d1e75c..8126166 100644 (file)
@@ -280,13 +280,13 @@ CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap& headers)
             // A no-cache directive with a value is only meaningful for proxy caches.
             // It should be ignored by a browser level cache.
             // http://tools.ietf.org/html/rfc7234#section-5.2.2.2
-            if (equalIgnoringCase(directives[i].first, "no-cache") && directives[i].second.isEmpty())
+            if (equalLettersIgnoringASCIICase(directives[i].first, "no-cache") && directives[i].second.isEmpty())
                 result.noCache = true;
-            else if (equalIgnoringCase(directives[i].first, "no-store"))
+            else if (equalLettersIgnoringASCIICase(directives[i].first, "no-store"))
                 result.noStore = true;
-            else if (equalIgnoringCase(directives[i].first, "must-revalidate"))
+            else if (equalLettersIgnoringASCIICase(directives[i].first, "must-revalidate"))
                 result.mustRevalidate = true;
-            else if (equalIgnoringCase(directives[i].first, "max-age")) {
+            else if (equalLettersIgnoringASCIICase(directives[i].first, "max-age")) {
                 if (result.maxAge) {
                     // First max-age directive wins if there are multiple ones.
                     continue;
@@ -295,7 +295,7 @@ CacheControlDirectives parseCacheControlDirectives(const HTTPHeaderMap& headers)
                 double maxAge = directives[i].second.toDouble(&ok);
                 if (ok)
                     result.maxAge = duration_cast<microseconds>(duration<double>(maxAge));
-            } else if (equalIgnoringCase(directives[i].first, "max-stale")) {
+            } else if (equalLettersIgnoringASCIICase(directives[i].first, "max-stale")) {
                 // https://tools.ietf.org/html/rfc7234#section-5.2.1.2
                 if (result.maxStale) {
                     // First max-stale directive wins if there are multiple ones.
index eba21a6..b734bb1 100644 (file)
@@ -245,9 +245,9 @@ public:
 
     static EncodingType parseEncodingType(const String& type)
     {
-        if (equalIgnoringCase(type, "text/plain"))
+        if (equalLettersIgnoringASCIICase(type, "text/plain"))
             return TextPlain;
-        if (equalIgnoringCase(type, "multipart/form-data"))
+        if (equalLettersIgnoringASCIICase(type, "multipart/form-data"))
             return MultipartFormData;
         return FormURLEncoded;
     }
index 5d300d0..3232964 100644 (file)
@@ -157,7 +157,7 @@ ContentDispositionType contentDispositionType(const String& contentDisposition)
     String dispositionType = parameters[0];
     dispositionType.stripWhiteSpace();
 
-    if (equalIgnoringCase(dispositionType, "inline"))
+    if (equalLettersIgnoringASCIICase(dispositionType, "inline"))
         return ContentDispositionInline;
 
     // Some broken sites just send bogus headers like
@@ -483,11 +483,11 @@ XFrameOptionsDisposition parseXFrameOptionsHeader(const String& header)
     for (size_t i = 0; i < headers.size(); i++) {
         String currentHeader = headers[i].stripWhiteSpace();
         XFrameOptionsDisposition currentValue = XFrameOptionsNone;
-        if (equalIgnoringCase(currentHeader, "deny"))
+        if (equalLettersIgnoringASCIICase(currentHeader, "deny"))
             currentValue = XFrameOptionsDeny;
-        else if (equalIgnoringCase(currentHeader, "sameorigin"))
+        else if (equalLettersIgnoringASCIICase(currentHeader, "sameorigin"))
             currentValue = XFrameOptionsSameOrigin;
-        else if (equalIgnoringCase(currentHeader, "allowall"))
+        else if (equalLettersIgnoringASCIICase(currentHeader, "allowall"))
             currentValue = XFrameOptionsAllowAll;
         else
             currentValue = XFrameOptionsInvalid;
index 7e874f0..92ab24b 100644 (file)
@@ -96,13 +96,12 @@ std::unique_ptr<CrossThreadResourceResponseData> ResourceResponseBase::copyData(
     return asResourceResponse().doPlatformCopyData(WTFMove(data));
 }
 
+// FIXME: Name does not make it clear this is true for HTTPS!
 bool ResourceResponseBase::isHTTP() const
 {
     lazyInit(CommonFieldsOnly);
 
-    String protocol = m_url.protocol();
-
-    return equalIgnoringCase(protocol, "http")  || equalIgnoringCase(protocol, "https");
+    return m_url.protocolIsInHTTPFamily();
 }
 
 const URL& ResourceResponseBase::url() const
@@ -466,15 +465,10 @@ bool ResourceResponseBase::isAttachment() const
 {
     lazyInit(AllFields);
 
-    String value = m_httpHeaderFields.get(HTTPHeaderName::ContentDisposition);
-    size_t loc = value.find(';');
-    if (loc != notFound)
-        value = value.left(loc);
-    value = value.stripWhiteSpace();
-
-    return equalIgnoringCase(value, "attachment");
+    auto value = m_httpHeaderFields.get(HTTPHeaderName::ContentDisposition);
+    return equalLettersIgnoringASCIICase(value.left(value.find(';')).stripWhiteSpace(), "attachment");
 }
-  
+
 ResourceResponseBase::Source ResourceResponseBase::source() const
 {
     lazyInit(AllFields);
index 281a7b6..cff91cd 100644 (file)
@@ -164,7 +164,7 @@ ResourceRequest ResourceHandleCFURLConnectionDelegate::createResourceRequest(CFU
             CFURLRequestSetHTTPRequestMethod(mutableRequest.get(), lastHTTPMethod.get());
 
             FormData* body = m_handle->firstRequest().httpBody();
-            if (!equalIgnoringCase(m_handle->firstRequest().httpMethod(), "GET") && body && !body->isEmpty())
+            if (!equalLettersIgnoringASCIICase(m_handle->firstRequest().httpMethod(), "get") && body && !body->isEmpty())
                 WebCore::setHTTPBody(mutableRequest.get(), body);
 
             String originalContentType = m_handle->firstRequest().httpContentType();
index e25fc74..79524a5 100644 (file)
@@ -440,7 +440,7 @@ void ResourceHandle::willSendRequest(ResourceRequest& request, const ResourceRes
             request.setHTTPMethod(lastHTTPMethod);
     
             FormData* body = d->m_firstRequest.httpBody();
-            if (!equalIgnoringCase(lastHTTPMethod, "GET") && body && !body->isEmpty())
+            if (!equalLettersIgnoringASCIICase(lastHTTPMethod, "get") && body && !body->isEmpty())
                 request.setHTTPBody(body);
 
             String originalContentType = d->m_firstRequest.httpContentType();
index d120378..d355b81 100644 (file)
@@ -118,12 +118,12 @@ bool SQLiteDatabase::open(const String& filename, bool forWebSQLDatabase)
     SQLiteStatement walStatement(*this, ASCIILiteral("PRAGMA journal_mode=WAL;"));
     int result = walStatement.step();
     if (result != SQLITE_OK && result != SQLITE_ROW)
-        LOG_ERROR("SQLite database failed to set journal_mode to WAL, error: %s",  lastErrorMsg());
+        LOG_ERROR("SQLite database failed to set journal_mode to WAL, error: %s", lastErrorMsg());
 
 #ifndef NDEBUG
     if (result == SQLITE_ROW) {
         String mode = walStatement.getColumnText(0);
-        if (!equalIgnoringCase(mode, "wal"))
+        if (!equalLettersIgnoringASCIICase(mode, "wal"))
             LOG_ERROR("journal_mode of database should be 'wal', but is '%s'", mode.utf8().data());
     }
 #endif
index 135c00b..e86afa3 100644 (file)
@@ -288,8 +288,7 @@ bool SQLiteStatement::isColumnDeclaredAsBlob(int col)
         if (prepare() != SQLITE_OK)
             return false;
     }
-
-    return equalIgnoringCase(String("BLOB"), String(reinterpret_cast<const UChar*>(sqlite3_column_decltype16(m_statement, col))));
+    return equalLettersIgnoringASCIICase(StringView(reinterpret_cast<const UChar*>(sqlite3_column_decltype16(m_statement, col))), "blob");
 }
 
 String SQLiteStatement::getColumnName(int col)
index b4ea43d..171abf4 100644 (file)
@@ -357,11 +357,11 @@ String defaultTextEncodingNameForSystemLanguage()
     // ICU uses this name for a different encoding, so we need to change the name to a value that actually gives us windows-949.
     // In addition, this value must match what is used in Safari, see <rdar://problem/5579292>.
     // On some OS versions, the result is CP949 (uppercase).
-    if (equalIgnoringCase(systemEncodingName, "cp949"))
-        systemEncodingName = "ks_c_5601-1987";
+    if (equalLettersIgnoringASCIICase(systemEncodingName, "cp949"))
+        systemEncodingName = ASCIILiteral("ks_c_5601-1987");
     return systemEncodingName;
 #else
-    return String("ISO-8859-1");
+    return ASCIILiteral("ISO-8859-1");
 #endif
 }
 
index dd18693..40d1300 100644 (file)
@@ -70,11 +70,11 @@ void RenderMathMLFraction::updateFromElement()
 
     String thickness = element().getAttribute(MathMLNames::linethicknessAttr);
     m_lineThickness = gLineMedium;
-    if (equalIgnoringCase(thickness, "thin"))
+    if (equalLettersIgnoringASCIICase(thickness, "thin"))
         m_lineThickness = gLineThin;
-    else if (equalIgnoringCase(thickness, "medium"))
+    else if (equalLettersIgnoringASCIICase(thickness, "medium"))
         m_lineThickness = gLineMedium;
-    else if (equalIgnoringCase(thickness, "thick"))
+    else if (equalLettersIgnoringASCIICase(thickness, "thick"))
         m_lineThickness = gLineThick;
     else {
         // This function parses the thickness attribute using gLineMedium as
index d75f81a..2a27755 100644 (file)
@@ -1361,8 +1361,8 @@ bool SVGToOTFFontConverter::compareCodepointsLexicographically(const GlyphData&
     }
 
     if (iterator1 == codePoints1.end() && iterator2 == codePoints2.end()) {
-        bool firstIsIsolated = data1.glyphElement && equalIgnoringCase(data1.glyphElement->fastGetAttribute(SVGNames::arabic_formAttr), "isolated");
-        bool secondIsIsolated = data2.glyphElement && equalIgnoringCase(data2.glyphElement->fastGetAttribute(SVGNames::arabic_formAttr), "isolated");
+        bool firstIsIsolated = data1.glyphElement && equalLettersIgnoringASCIICase(data1.glyphElement->fastGetAttribute(SVGNames::arabic_formAttr), "isolated");
+        bool secondIsIsolated = data2.glyphElement && equalLettersIgnoringASCIICase(data2.glyphElement->fastGetAttribute(SVGNames::arabic_formAttr), "isolated");
         return firstIsIsolated && !secondIsIsolated;
     }
     return iterator1 == codePoints1.end();
@@ -1457,7 +1457,7 @@ SVGToOTFFontConverter::SVGToOTFFontConverter(const SVGFontElement& fontElement)
         if (m_codepointsToIndicesMap.isValidKey(glyph.codepoints)) {
             auto& glyphVector = m_codepointsToIndicesMap.add(glyph.codepoints, Vector<Glyph>()).iterator->value;
             // Prefer isolated arabic forms
-            if (glyph.glyphElement && equalIgnoringCase(glyph.glyphElement->fastGetAttribute(SVGNames::arabic_formAttr), "isolated"))
+            if (glyph.glyphElement && equalLettersIgnoringASCIICase(glyph.glyphElement->fastGetAttribute(SVGNames::arabic_formAttr), "isolated"))
                 glyphVector.insert(0, i);
             else
                 glyphVector.append(i);
@@ -1469,7 +1469,7 @@ SVGToOTFFontConverter::SVGToOTFFontConverter(const SVGFontElement& fontElement)
         Vector<String> segments;
         m_fontFaceElement->fastGetAttribute(SVGNames::font_weightAttr).string().split(' ', segments);
         for (auto& segment : segments) {
-            if (equalIgnoringCase(segment, "bold")) {
+            if (equalLettersIgnoringASCIICase(segment, "bold")) {
                 m_weight = 7;
                 break;
             }
@@ -1482,7 +1482,7 @@ SVGToOTFFontConverter::SVGToOTFFontConverter(const SVGFontElement& fontElement)
         }
         m_fontFaceElement->fastGetAttribute(SVGNames::font_styleAttr).string().split(' ', segments);
         for (auto& segment : segments) {
-            if (equalIgnoringCase(segment, "italic") || equalIgnoringCase(segment, "oblique")) {
+            if (equalLettersIgnoringASCIICase(segment, "italic") || equalLettersIgnoringASCIICase(segment, "oblique")) {
                 m_italic = true;
                 break;
             }
index ee3d15d..1c5b3bc 100644 (file)
@@ -379,13 +379,13 @@ void InternalSettings::setWirelessPlaybackDisabled(bool available)
 void InternalSettings::setEditingBehavior(const String& editingBehavior, ExceptionCode& ec)
 {
     InternalSettingsGuardForSettings();
-    if (equalIgnoringCase(editingBehavior, "win"))
+    if (equalLettersIgnoringASCIICase(editingBehavior, "win"))
         settings()->setEditingBehaviorType(EditingWindowsBehavior);
-    else if (equalIgnoringCase(editingBehavior, "mac"))
+    else if (equalLettersIgnoringASCIICase(editingBehavior, "mac"))
         settings()->setEditingBehaviorType(EditingMacBehavior);
-    else if (equalIgnoringCase(editingBehavior, "unix"))
+    else if (equalLettersIgnoringASCIICase(editingBehavior, "unix"))
         settings()->setEditingBehaviorType(EditingUnixBehavior);
-    else if (equalIgnoringCase(editingBehavior, "ios"))
+    else if (equalLettersIgnoringASCIICase(editingBehavior, "ios"))
         settings()->setEditingBehaviorType(EditingIOSBehavior);
     else
         ec = SYNTAX_ERR;
@@ -400,11 +400,11 @@ void InternalSettings::setShouldDisplayTrackKind(const String& kind, bool enable
         return;
     CaptionUserPreferences* captionPreferences = page()->group().captionPreferences();
 
-    if (equalIgnoringCase(kind, "Subtitles"))
+    if (equalLettersIgnoringASCIICase(kind, "subtitles"))
         captionPreferences->setUserPrefersSubtitles(enabled);
-    else if (equalIgnoringCase(kind, "Captions"))
+    else if (equalLettersIgnoringASCIICase(kind, "captions"))
         captionPreferences->setUserPrefersCaptions(enabled);
-    else if (equalIgnoringCase(kind, "TextDescriptions"))
+    else if (equalLettersIgnoringASCIICase(kind, "textdescriptions"))
         captionPreferences->setUserPrefersTextDescriptions(enabled);
     else
         ec = SYNTAX_ERR;
@@ -423,11 +423,11 @@ bool InternalSettings::shouldDisplayTrackKind(const String& kind, ExceptionCode&
         return false;
     CaptionUserPreferences* captionPreferences = page()->group().captionPreferences();
 
-    if (equalIgnoringCase(kind, "Subtitles"))
+    if (equalLettersIgnoringASCIICase(kind, "subtitles"))
         return captionPreferences->userPrefersSubtitles();
-    if (equalIgnoringCase(kind, "Captions"))
+    if (equalLettersIgnoringASCIICase(kind, "captions"))
         return captionPreferences->userPrefersCaptions();
-    if (equalIgnoringCase(kind, "TextDescriptions"))
+    if (equalLettersIgnoringASCIICase(kind, "textdescriptions"))
         return captionPreferences->userPrefersTextDescriptions();
 
     ec = SYNTAX_ERR;
index 13ffd45..5a5082c 100644 (file)
@@ -294,28 +294,28 @@ bool InspectorStubFrontend::sendMessageToFrontend(const String& message)
 
 static bool markerTypeFrom(const String& markerType, DocumentMarker::MarkerType& result)
 {
-    if (equalIgnoringCase(markerType, "Spelling"))
+    if (equalLettersIgnoringASCIICase(markerType, "spelling"))
         result = DocumentMarker::Spelling;
-    else if (equalIgnoringCase(markerType, "Grammar"))
+    else if (equalLettersIgnoringASCIICase(markerType, "grammar"))
         result = DocumentMarker::Grammar;
-    else if (equalIgnoringCase(markerType, "TextMatch"))
+    else if (equalLettersIgnoringASCIICase(markerType, "textmatch"))
         result = DocumentMarker::TextMatch;
-    else if (equalIgnoringCase(markerType, "Replacement"))
+    else if (equalLettersIgnoringASCIICase(markerType, "replacement"))
         result = DocumentMarker::Replacement;
-    else if (equalIgnoringCase(markerType, "CorrectionIndicator"))
+    else if (equalLettersIgnoringASCIICase(markerType, "correctionindicator"))
         result = DocumentMarker::CorrectionIndicator;
-    else if (equalIgnoringCase(markerType, "RejectedCorrection"))
+    else if (equalLettersIgnoringASCIICase(markerType, "rejectedcorrection"))
         result = DocumentMarker::RejectedCorrection;
-    else if (equalIgnoringCase(markerType, "Autocorrected"))
+    else if (equalLettersIgnoringASCIICase(markerType, "autocorrected"))