source: webkit/trunk/Source/WebCore/xml/XPathFunctions.cpp

Last change on this file was 295270, checked in by Chris Dumez, 3 years ago

Drop operator==() overload for comparing a String to a const char*
https://bugs.webkit.org/show_bug.cgi?id=241285

Reviewed by Darin Adler.

Drop operator==() overload for comparing a String to a const char*. This
encourages people to use ""_s for string literals.

  • Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:

(JSC::BytecodeGenerator::emitEqualityOpImpl):

  • Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:

(JSC::ApplyFunctionCallDotNode::emitBytecode):

  • Source/JavaScriptCore/inspector/ScriptCallFrame.cpp:

(Inspector::ScriptCallFrame::isNative const):

  • Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorXPCConnection.mm:

(Inspector::RemoteInspectorXPCConnection::handleEvent):

  • Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:

(CppProtocolTypesImplementationGenerator):

  • Source/JavaScriptCore/jit/ExecutableAllocator.cpp:

(JSC::isJITEnabled):
(JSC::ExecutableAllocator::setJITEnabled):

  • Source/JavaScriptCore/jsc.cpp:

(dumpException):

  • Source/JavaScriptCore/runtime/IntlCollator.cpp:

(JSC::IntlCollator::initializeCollator):

  • Source/JavaScriptCore/runtime/IntlObject.cpp:

(JSC::removeUnicodeLocaleExtension):

  • Source/JavaScriptCore/runtime/JSObject.cpp:

(JSC::JSObject::calculatedClassName):

  • Source/JavaScriptCore/runtime/Options.cpp:

(JSC::canUseJITCage):

  • Source/JavaScriptCore/runtime/StringPrototype.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):

  • Source/JavaScriptCore/runtime/TypeSet.cpp:

(JSC::StructureShape::leastCommonAncestor):

  • Source/JavaScriptCore/tools/JSDollarVM.cpp:
  • Source/JavaScriptCore/yarr/YarrUnicodeProperties.cpp:

(JSC::Yarr::unicodeMatchPropertyValue):

  • Source/WTF/wtf/URL.cpp:

(WTF::URL::setProtocol):

  • Source/WTF/wtf/cocoa/Entitlements.h:
  • Source/WTF/wtf/cocoa/Entitlements.mm:

(WTF::hasEntitlement):
(WTF::processHasEntitlement):
(WTF::hasEntitlementValue):

  • Source/WTF/wtf/text/WTFString.h:
  • Source/WebCore/Modules/applepay/PaymentRequestValidator.mm:

(WebCore::validateCountryCode):
(WebCore::validateCurrencyCode):

  • Source/WebCore/Modules/async-clipboard/ios/ClipboardImageReaderIOS.mm:

(WebCore::ClipboardImageReader::readBuffer):

  • Source/WebCore/Modules/async-clipboard/mac/ClipboardImageReaderMac.mm:

(WebCore::ClipboardImageReader::readBuffer):

  • Source/WebCore/Modules/cache/DOMCache.cpp:

(WebCore::DOMCache::requestFromInfo):

  • Source/WebCore/Modules/cache/DOMCacheEngine.cpp:

(WebCore::DOMCacheEngine::matchURLs):

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

(WebCore::FetchLoader::start):

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

(WebCore::methodCanHaveBody):
(WebCore::FetchRequest::initializeOptions):
(WebCore::FetchRequest::referrer const):

  • Source/WebCore/Modules/mediasource/MediaSource.cpp:

(WebCore::MediaSource::contentTypeShouldGenerateTimestamps):

  • Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp:

(WebCore::MediaStreamTrack::setContentHint):

  • Source/WebCore/Modules/mediastream/RTCRtpSFrameTransform.cpp:

(WebCore::RTCRtpSFrameTransform::setEncryptionKey):

  • Source/WebCore/Modules/mediastream/RTCRtpSender.cpp:

(WebCore::RTCRtpSender::dtmf):

  • Source/WebCore/Modules/mediastream/gstreamer/GStreamerMediaEndpoint.cpp:

(WebCore::GStreamerMediaEndpoint::createTransceiverBackends):

  • Source/WebCore/Modules/mediastream/gstreamer/GStreamerStatsCollector.cpp:

(WebCore::iceCandidateType):

  • Source/WebCore/Modules/mediastream/gstreamer/GStreamerWebRTCUtils.cpp:

(WebCore::toRTCIceProtocol):
(WebCore::toRTCIceTcpCandidateType):
(WebCore::toRTCIceCandidateType):
(WebCore::parseIceCandidateSDP):

  • Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:

(WebCore::LibWebRTCMediaEndpoint::addTransceiver):

  • Source/WebCore/Modules/webauthn/cbor/CBORValue.cpp:

(cbor::CBORValue::CBORValue):

  • Source/WebCore/Modules/webauthn/cbor/CBORValue.h:
  • Source/WebCore/Modules/webauthn/fido/AuthenticatorGetInfoResponse.cpp:

(fido::encodeAsCBOR):

  • Source/WebCore/Modules/webauthn/fido/FidoConstants.h:
  • Source/WebCore/Modules/websockets/WebSocket.cpp:

(WebCore::WebSocket::setBinaryType):

  • Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUAdapterImpl.cpp:

(PAL::WebGPU::AdapterImpl::requestDevice):

  • Source/WebCore/accessibility/AccessibilityNodeObject.cpp:

(WebCore::AccessibilityNodeObject::canSetValueAttribute const):

  • Source/WebCore/accessibility/AccessibilityObject.cpp:

(WebCore::AccessibilityObject::currentState const):
(WebCore::AccessibilityObject::attributeValue const):

  • Source/WebCore/accessibility/AccessibilityTableCell.cpp:

(WebCore::AccessibilityTableCell::isColumnHeaderCell const):
(WebCore::AccessibilityTableCell::isRowHeaderCell const):
(WebCore::AccessibilityTableCell::columnHeaders):
(WebCore::AccessibilityTableCell::rowHeaders):
(WebCore::AccessibilityTableCell::axRowSpan const):

  • Source/WebCore/accessibility/atspi/AXObjectCacheAtspi.cpp:

(WebCore::AXObjectCache::postPlatformNotification):

  • Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp:

(WebCore::AccessibilityObjectAtspi::state const):

  • Source/WebCore/accessibility/atspi/AccessibilityObjectTextAtspi.cpp:

(WebCore::AccessibilityObjectAtspi::textAttributes const):

  • Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:

(WebCore::AXIsolatedObject::attributeValue const):

  • Source/WebCore/accessibility/win/AccessibilityObjectWrapperWin.cpp:

(WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue):

  • Source/WebCore/animation/KeyframeEffect.cpp:

(WebCore::IDLAttributeNameToAnimationPropertyName):

  • Source/WebCore/bindings/js/IDBBindingUtilities.cpp:

(WebCore::get):

  • Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:

(WebCore::JSC_DEFINE_HOST_FUNCTION):

  • Source/WebCore/bindings/js/JSDOMWindowCustom.cpp:

(WebCore::jsDOMWindowInstanceFunction_openDatabaseBody):

  • Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:

(GenerateIsLegacyUnforgeablePropertyName):

  • Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp:

(WebCore::JSTestNamedSetterWithLegacyUnforgeableProperties::defineOwnProperty):

  • Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp:

(WebCore::JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns::defineOwnProperty):

  • Source/WebCore/contentextensions/ContentExtensionActions.cpp:

(WebCore::ContentExtensions::ModifyHeadersAction::ModifyHeaderInfo::parse):
(WebCore::ContentExtensions::RedirectAction::URLTransformAction::parse):

  • Source/WebCore/contentextensions/ContentExtensionParser.cpp:

(WebCore::ContentExtensions::loadAction):

  • Source/WebCore/crypto/algorithms/CryptoAlgorithmECDH.cpp:

(WebCore::CryptoAlgorithmECDH::importKey):

  • Source/WebCore/crypto/algorithms/CryptoAlgorithmECDSA.cpp:

(WebCore::CryptoAlgorithmECDSA::importKey):

  • Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:

(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):

  • Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:

(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):

  • Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:

(WebCore::CryptoAlgorithmRSA_OAEP::importKey):

  • Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:

(WebCore::CryptoAlgorithmRSA_PSS::importKey):

  • Source/WebCore/crypto/keys/CryptoKeyAES.cpp:

(WebCore::CryptoKeyAES::importJwk):

  • Source/WebCore/crypto/keys/CryptoKeyEC.cpp:

(WebCore::CryptoKeyEC::importJwk):

  • Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp:

(WebCore::CryptoKeyHMAC::importJwk):

  • Source/WebCore/crypto/keys/CryptoKeyRSA.cpp:

(WebCore::CryptoKeyRSA::importJwk):

  • Source/WebCore/css/CSSBasicShapes.cpp:

(WebCore::buildInsetRadii):

  • Source/WebCore/css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):

  • Source/WebCore/css/CSSPropertySourceData.cpp:

(WebCore::CSSPropertySourceData::toString const):

  • Source/WebCore/css/CSSSelector.cpp:

(WebCore::CSSSelector::selectorText const):

  • Source/WebCore/css/MediaQuery.cpp:

(WebCore::MediaQuery::serialize const):

  • Source/WebCore/css/SelectorCheckerTestFunctions.h:

(WebCore::matchesLangPseudoClass):

  • Source/WebCore/css/StyleProperties.cpp:

(WebCore::StyleProperties::borderPropertyValue const):
(WebCore::StyleProperties::asTextInternal const):

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

(WebCore::parseGridTemplateAreasRow):
(WebCore::CSSPropertyParser::canParseTypedCustomPropertyValue):
(WebCore::CSSPropertyParser::collectParsedCustomPropertyValueDependencies):
(WebCore::CSSPropertyParser::parseTypedCustomPropertyValue):

  • Source/WebCore/dom/DataTransfer.cpp:

(WebCore::DataTransfer::getDataForItem const):
(WebCore::DataTransfer::readStringFromPasteboard const):
(WebCore::DataTransfer::setDataFromItemList):
(WebCore::dragOpFromIEOp):
(WebCore::DataTransfer::dropEffect const):
(WebCore::DataTransfer::setDropEffect):

  • Source/WebCore/dom/DataTransfer.h:

(WebCore::DataTransfer::dropEffectIsUninitialized const):

  • Source/WebCore/dom/Document.cpp:

(WebCore::Document::originIdentifierForPasteboard const):

  • Source/WebCore/dom/ProcessingInstruction.cpp:

(WebCore::ProcessingInstruction::checkStyleSheet):

  • Source/WebCore/dom/Range.cpp:

(WebCore::Range::expand):

  • Source/WebCore/dom/UIEventWithKeyState.cpp:

(WebCore::UIEventWithKeyState::getModifierState const):

  • Source/WebCore/editing/Editing.cpp:

(WebCore::isMailBlockquote):

  • Source/WebCore/editing/Editor.cpp:

(WebCore::Editor::handleTextEvent):
(WebCore::Editor::insertTextWithoutSendingTextEvent):

  • Source/WebCore/editing/HTMLInterchange.h:
  • Source/WebCore/editing/InsertTextCommand.cpp:

(WebCore::InsertTextCommand::doApply):

  • Source/WebCore/editing/ReplaceSelectionCommand.cpp:

(WebCore::isInterchangeNewlineNode):
(WebCore::isInterchangeConvertedSpaceSpan):
(WebCore::isInlineNodeWithStyle):

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

(HTMLConverter::computedAttributesForElement):
(HTMLConverter::_addAttachmentForElement):
(HTMLConverter::_enterElement):
(HTMLConverter::_addTableForElement):
(HTMLConverter::_addTableCellForElement):
(HTMLConverter::_processElement):
(HTMLConverter::_exitElement):
(HTMLConverter::_processText):

  • Source/WebCore/editing/markup.cpp:

(WebCore::StyledMarkupAccumulator::appendNodeToPreserveMSOList):
(WebCore::createFragmentFromText):
(WebCore::createFragmentForTransformToFragment):

  • Source/WebCore/html/BaseCheckableInputType.cpp:

(WebCore::BaseCheckableInputType::handleKeydownEvent):

  • Source/WebCore/html/BaseClickableWithKeyInputType.cpp:

(WebCore::BaseClickableWithKeyInputType::handleKeydownEvent):
(WebCore::BaseClickableWithKeyInputType::handleKeyupEvent):

  • Source/WebCore/html/CheckboxInputType.cpp:

(WebCore::CheckboxInputType::handleKeyupEvent):

  • Source/WebCore/html/FTPDirectoryDocument.cpp:

(WebCore::FTPDirectoryDocumentParser::parseAndAppendOneLine):

  • Source/WebCore/html/FormController.cpp:

(WebCore::FormController::SavedFormState::appendReferencedFilePaths const):

  • Source/WebCore/html/HTMLAnchorElement.cpp:

(WebCore::isEnterKeyKeydownEvent):

  • Source/WebCore/html/HTMLAttachmentElement.cpp:

(WebCore::HTMLAttachmentElement::parseAttribute):

  • Source/WebCore/html/HTMLButtonElement.cpp:

(WebCore::HTMLButtonElement::defaultEventHandler):

  • Source/WebCore/html/HTMLCanvasElement.cpp:

(WebCore::HTMLCanvasElement::is2dType):
(WebCore::HTMLCanvasElement::isWebGLType):
(WebCore::HTMLCanvasElement::toWebGLVersion):
(WebCore::HTMLCanvasElement::isBitmapRendererType):

  • Source/WebCore/html/HTMLFrameSetElement.cpp:

(WebCore::HTMLFrameSetElement::parseAttribute):

  • Source/WebCore/html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::setValueFromRenderer):

  • Source/WebCore/html/HTMLLIElement.cpp:

(WebCore::HTMLLIElement::collectPresentationalHintsForAttribute):

  • Source/WebCore/html/HTMLMarqueeElement.cpp:

(WebCore::HTMLMarqueeElement::collectPresentationalHintsForAttribute):

  • Source/WebCore/html/HTMLOListElement.cpp:

(WebCore::HTMLOListElement::collectPresentationalHintsForAttribute):

  • Source/WebCore/html/HTMLSelectElement.cpp:

(WebCore::HTMLSelectElement::platformHandleKeydownEvent):
(WebCore::HTMLSelectElement::menuListDefaultEventHandler):
(WebCore::HTMLSelectElement::listBoxDefaultEventHandler):

  • Source/WebCore/html/HTMLSelectElementWin.cpp:

(WebCore::HTMLSelectElement::platformHandleKeydownEvent):

  • Source/WebCore/html/HTMLSummaryElement.cpp:

(WebCore::HTMLSummaryElement::defaultEventHandler):

  • Source/WebCore/html/HTMLTextFormControlElement.cpp:

(WebCore::HTMLTextFormControlElement::setSelectionRange):

  • Source/WebCore/html/MediaDocument.cpp:

(WebCore::MediaDocument::defaultEventHandler):

  • Source/WebCore/html/MediaFragmentURIParser.cpp:

(WebCore::MediaFragmentURIParser::parseTimeFragment):

  • Source/WebCore/html/RadioInputType.cpp:

(WebCore::RadioInputType::handleKeydownEvent):
(WebCore::RadioInputType::handleKeyupEvent):

  • Source/WebCore/html/RangeInputType.cpp:

(WebCore::RangeInputType::handleKeydownEvent):

  • Source/WebCore/html/SearchInputType.cpp:

(WebCore::SearchInputType::handleKeydownEvent):

  • Source/WebCore/html/TextFieldInputType.cpp:

(WebCore::TextFieldInputType::handleKeydownEvent):
(WebCore::TextFieldInputType::handleKeydownEventForSpinButton):
(WebCore::TextFieldInputType::shouldSubmitImplicitly):

  • Source/WebCore/html/canvas/CanvasPattern.cpp:

(WebCore::CanvasPattern::parseRepetitionType):

  • Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:

(WebCore::CanvasRenderingContext2DBase::setLineCap):
(WebCore::CanvasRenderingContext2DBase::setLineJoin):

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

(WebCore::HTMLConstructionSite::setCompatibilityModeFromDoctype):

  • Source/WebCore/html/shadow/DateTimeFieldElement.cpp:

(WebCore::DateTimeFieldElement::defaultKeyboardEventHandler):

  • Source/WebCore/inspector/InspectorAuditAccessibilityObject.cpp:

(WebCore::InspectorAuditAccessibilityObject::getComputedProperties):

  • Source/WebCore/inspector/InspectorCanvas.cpp:

(WebCore::shouldSnapshotBitmapRendererAction):
(WebCore::shouldSnapshotWebGLAction):
(WebCore::shouldSnapshotWebGL2Action):

  • Source/WebCore/inspector/InspectorFrontendHost.cpp:

(WebCore::dockSideFromString):
(WebCore::populateContextMenu):

  • Source/WebCore/inspector/InspectorStyleSheet.cpp:

(WebCore::buildArrayForGroupings):
(WebCore::InspectorStyle::shorthandValue const):

  • Source/WebCore/inspector/agents/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):

  • Source/WebCore/loader/CrossOriginAccessControl.cpp:

(WebCore::isOnAccessControlSimpleRequestMethodAllowlist):
(WebCore::passesAccessControlCheck):

  • Source/WebCore/loader/DocumentLoader.cpp:

(WebCore::isRedirectToGetAfterPost):
(WebCore::DocumentLoader::isPostOrRedirectAfterPost):
(WebCore::DocumentLoader::responseReceived):

  • Source/WebCore/loader/FormSubmission.cpp:

(WebCore::FormSubmission::Attributes::updateEncodingType):

  • Source/WebCore/loader/FrameLoader.cpp:

(WebCore::FrameLoader::changeLocation):
(WebCore::FrameLoader::loadFrameRequest):
(WebCore::FrameLoader::loadURL):
(WebCore::FrameLoader::reload):
(WebCore::FrameLoader::addHTTPOriginIfNeeded):
(WebCore::createWindow):

  • Source/WebCore/loader/MixedContentChecker.cpp:

(WebCore::MixedContentChecker::isMixedContent):

  • Source/WebCore/loader/PrivateClickMeasurement.cpp:

(WebCore::PrivateClickMeasurement::parseAttributionRequestQuery):

  • Source/WebCore/loader/ResourceLoader.cpp:

(WebCore::ResourceLoader::loadDataURL):

  • Source/WebCore/loader/SubframeLoader.cpp:

(WebCore::FrameLoader::SubframeLoader::requestFrame):

  • Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp:

(WebCore::MHTMLParser::parseArchiveWithHeader):

  • Source/WebCore/loader/cache/MemoryCache.cpp:

(WebCore::MemoryCache::add):

  • Source/WebCore/loader/mac/LoaderNSURLExtras.mm:

(suggestedFilenameWithMIMEType):

  • Source/WebCore/mathml/MathMLElement.cpp:

(WebCore::convertMathSizeIfNeeded):

  • Source/WebCore/mathml/MathMLOperatorElement.cpp:

(WebCore::MathMLOperatorElement::computeDictionaryProperty):

  • Source/WebCore/mathml/MathMLPresentationElement.cpp:

(WebCore::MathMLPresentationElement::parseMathVariantAttribute):

  • Source/WebCore/mathml/MathMLSelectElement.cpp:

(WebCore::MathMLSelectElement::isMathMLEncoding):
(WebCore::MathMLSelectElement::isSVGEncoding):
(WebCore::MathMLSelectElement::isHTMLEncoding):
(WebCore::MathMLSelectElement::getSelectedActionChild):
(WebCore::MathMLSelectElement::defaultEventHandler):
(WebCore::MathMLSelectElement::willRespondToMouseClickEventsWithEditability const):

  • Source/WebCore/page/DOMWindow.cpp:

(WebCore::DOMWindow::postMessage):

  • Source/WebCore/page/EventHandler.cpp:

(WebCore::convertDropZoneOperationToDragOperation):
(WebCore::EventHandler::accessibilityPreventsEventPropagation):
(WebCore::EventHandler::defaultKeyboardEventHandler):
(WebCore::EventHandler::isKeyboardOptionTab):

  • Source/WebCore/page/Performance.cpp:

(WebCore::Performance::getEntriesByType const):
(WebCore::Performance::getEntriesByName const):
(WebCore::Performance::appendBufferedEntriesByType const):

  • Source/WebCore/page/PerformanceEntry.cpp:

(WebCore::PerformanceEntry::parseEntryTypeString):

  • Source/WebCore/page/Quirks.cpp:

(WebCore::isTwitterDocument):
(WebCore::isYouTubeDocument):
(WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
(WebCore::Quirks::shouldDispatchedSimulatedMouseEventsAssumeDefaultPrevented const):
(WebCore::Quirks::shouldMakeTouchEventNonCancelableForTarget const):
(WebCore::Quirks::shouldEnableLegacyGetUserMediaQuirk const):
(WebCore::Quirks::shouldDisableElementFullscreenQuirk const):
(WebCore::Quirks::needsCanPlayAfterSeekedQuirk const):
(WebCore::Quirks::shouldAllowNavigationToCustomProtocolWithoutUserGesture):

  • Source/WebCore/page/SecurityOrigin.cpp:

(WebCore::SecurityOrigin::canDisplay const):
(WebCore::SecurityOrigin::toString const):
(WebCore::areOriginsMatching):

  • Source/WebCore/page/SecurityOrigin.h:

(WebCore::SecurityOrigin::isHTTPFamily const):

  • Source/WebCore/page/SecurityOriginData.cpp:

(WebCore::SecurityOriginData::toString const):

  • Source/WebCore/page/SecurityPolicy.cpp:

(WebCore::SecurityPolicy::referrerToOriginString):

  • Source/WebCore/page/UserContentURLPattern.cpp:

(WebCore::UserContentURLPattern::matches const):

  • Source/WebCore/page/WindowFeatures.cpp:

(WebCore::boolFeature):

  • Source/WebCore/page/cocoa/ResourceUsageThreadCocoa.mm:

(WebCore::ResourceUsageThread::platformCollectCPUData):

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

(WebCore::ContentSecurityPolicy::reportViolation const):

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

(WebCore::ContentSecurityPolicySource::schemeMatches const):

  • Source/WebCore/page/linux/ResourceUsageThreadLinux.cpp:

(WebCore::ResourceUsageThread::platformCollectCPUData):

  • Source/WebCore/platform/KeyboardScrollingAnimator.cpp:

(WebCore::keyboardScrollingKeyFromEvent):

  • Source/WebCore/platform/KeypressCommand.h:

(WebCore::KeypressCommand::KeypressCommand):

  • Source/WebCore/platform/LocalizedStrings.cpp:

(WebCore::localizedMediaControlElementString):
(WebCore::localizedMediaControlElementHelpText):

  • Source/WebCore/platform/Pasteboard.cpp:

(WebCore::Pasteboard::isSafeTypeForDOMToReadAndWrite):

  • Source/WebCore/platform/RegistrableDomain.h:

(WebCore::RegistrableDomain::operator== const):

  • Source/WebCore/platform/Theme.cpp:

(WebCore::Theme::drawNamedImage const):

  • Source/WebCore/platform/UserAgentQuirks.cpp:

(WebCore::urlRequiresChromeBrowser):
(WebCore::urlRequiresFirefoxBrowser):
(WebCore::urlRequiresMacintoshPlatform):
(WebCore::urlRequiresUnbrandedUserAgent):

  • Source/WebCore/platform/cocoa/ThemeCocoa.mm:

(WebCore::ThemeCocoa::drawNamedImage const):

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

(WebCore::GLContext::version):

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

(WebCore::Image::create):

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

(WebCore::MIMETypeCache::shouldOverrideExtendedType):

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

(WebCore::parseVPCodecParameters):

  • Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:

(WebCore::CDMPrivateMediaSourceAVFObjC::supportsMIMEType):

  • Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:

(WebCore::AVFWrapper::shouldWaitForLoadingOfResource):

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

(WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):

  • Source/WebCore/platform/graphics/cairo/ImageBufferUtilitiesCairo.cpp:

(WebCore::encodeImage):

  • Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp:

(WebCore::ImageDecoderCG::frameHasAlphaAtIndex const):
(WebCore::ImageDecoderCG::createFrameImageAtIndex):

  • Source/WebCore/platform/graphics/cg/ImageSourceCGWin.cpp:

(WebCore::MIMETypeForImageType):

  • Source/WebCore/platform/graphics/cocoa/VP9UtilitiesCocoa.mm:

(WebCore::isVPCodecConfigurationRecordSupported):
(WebCore::createVideoInfoFromVPCodecConfigurationRecord):

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

(WebCore::getFamilyNameStringFromFamily):

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

(WebCore::isMediaDiskCacheDisabled):

  • Source/WebCore/platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:

(WebCore::SourceBufferPrivateGStreamer::platformMaximumBufferSize const):

  • Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGL.cpp:

(WebCore::ExtensionsGLOpenGL::platformSupportsExtension):

  • Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLCommon.cpp:

(WebCore::ExtensionsGLOpenGLCommon::supports):
(WebCore::ExtensionsGLOpenGLCommon::ensureEnabled):
(WebCore::ExtensionsGLOpenGLCommon::isEnabled):

  • Source/WebCore/platform/graphics/opengl/ExtensionsGLOpenGLES.cpp:

(WebCore::ExtensionsGLOpenGLES::isEnabled):
(WebCore::ExtensionsGLOpenGLES::platformSupportsExtension):

  • Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp:

(WebCore::GraphicsContextGLOpenGL::checkVaryingsPacking const):

  • Source/WebCore/platform/gtk/PasteboardGtk.cpp:

(WebCore::selectionDataTypeFromHTMLClipboardType):

  • Source/WebCore/platform/ios/PlatformEventFactoryIOS.mm:

(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):

  • Source/WebCore/platform/ios/PlatformPasteboardIOS.mm:

(WebCore::PlatformPasteboard::platformPasteboardTypeForSafeTypeForDOMToReadAndWrite):

  • Source/WebCore/platform/ios/PreviewConverterIOS.mm:

(WebCore::PreviewConverter::isPlatformPasswordError const):

  • Source/WebCore/platform/mac/PasteboardMac.mm:

(WebCore::cocoaTypeFromHTMLClipboardType):
(WebCore::Pasteboard::addHTMLClipboardTypesForCocoaType):

  • Source/WebCore/platform/mac/PlatformPasteboardMac.mm:

(WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
(WebCore::PlatformPasteboard::platformPasteboardTypeForSafeTypeForDOMToReadAndWrite):

  • Source/WebCore/platform/mac/PublicSuffixMac.mm:

(WebCore::topPrivatelyControlledDomain):

  • Source/WebCore/platform/mediastream/RealtimeMediaSourceSettings.cpp:

(WebCore::RealtimeMediaSourceSettings::videoFacingModeEnum):

  • Source/WebCore/platform/mediastream/libwebrtc/gstreamer/GStreamerVideoEncoderFactory.cpp:

(WebCore::GStreamerH264Encoder::GStreamerH264Encoder):

  • Source/WebCore/platform/mock/MediaEngineConfigurationFactoryMock.cpp:

(WebCore::canDecodeMedia):
(WebCore::canSmoothlyDecodeMedia):
(WebCore::canPowerEfficientlyDecodeMedia):
(WebCore::canEncodeMedia):
(WebCore::canSmoothlyEncodeMedia):
(WebCore::canPowerEfficientlyEncodeMedia):

  • Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:

(WebCore::MockMediaPlayerMediaSource::supportsType):

  • Source/WebCore/platform/network/CacheValidation.cpp:

(WebCore::verifyVaryingRequestHeadersInternal):

  • Source/WebCore/platform/network/ResourceResponseBase.h:

(WebCore::ResourceResponseBase::isMultipart const):

  • Source/WebCore/platform/network/cf/ResourceErrorCF.cpp:

(WebCore::ResourceError::cfStreamError const):

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

(WebCore::CookieJarDB::checkDatabaseValidity):

  • Source/WebCore/platform/network/curl/CookieJarDB.h:

(WebCore::CookieJarDB::isOnMemory const):

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

(WebCore::CurlDownload::shouldRedirectAsGET):

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

(WebCore::CurlRequest::setupTransfer):

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

(WebCore::topPrivatelyControlledDomain):

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

(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::shouldRedirectAsGET):

  • Source/WebCore/platform/network/ios/WebCoreURLResponseIOS.h:

(WebCore::shouldUseQuickLookForMIMEType):

  • Source/WebCore/platform/soup/PublicSuffixSoup.cpp:

(WebCore::topPrivatelyControlledDomain):

  • Source/WebCore/platform/win/SearchPopupMenuDB.cpp:

(WebCore::SearchPopupMenuDB::checkDatabaseValidity):

  • Source/WebCore/rendering/RenderBlockFlow.cpp:

(WebCore::needsAppleMailPaginationQuirk):

  • Source/WebCore/rendering/RenderCounter.cpp:

(WebCore::planCounter):

  • Source/WebCore/rendering/RenderTextControlMultiLine.cpp:

(WebCore::RenderTextControlMultiLine::getAverageCharWidth):

  • Source/WebCore/rendering/RenderTextControlSingleLine.cpp:

(WebCore::RenderTextControlSingleLine::getAverageCharWidth):
(WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth const):

  • Source/WebCore/rendering/RenderTreeAsText.cpp:

(WebCore::isEmptyOrUnstyledAppleStyleSpan):

  • Source/WebCore/svg/SVGAElement.cpp:

(WebCore::SVGAElement::defaultEventHandler):

  • Source/WebCore/svg/SVGComponentTransferFunctionElement.h:

(WebCore::SVGPropertyTraits<ComponentTransferType>::fromString):

  • Source/WebCore/svg/SVGFEColorMatrixElement.h:

(WebCore::SVGPropertyTraits<ColorMatrixType>::fromString):

  • Source/WebCore/svg/SVGFECompositeElement.h:

(WebCore::SVGPropertyTraits<CompositeOperationType>::fromString):

  • Source/WebCore/svg/SVGFEConvolveMatrixElement.h:

(WebCore::SVGPropertyTraits<EdgeModeType>::fromString):

  • Source/WebCore/svg/SVGFEDisplacementMapElement.h:

(WebCore::SVGPropertyTraits<ChannelSelectorType>::fromString):

  • Source/WebCore/svg/SVGFEMorphologyElement.h:

(WebCore::SVGPropertyTraits<MorphologyOperatorType>::fromString):

  • Source/WebCore/svg/SVGFETurbulenceElement.h:

(WebCore::SVGPropertyTraits<SVGStitchOptions>::fromString):
(WebCore::SVGPropertyTraits<TurbulenceType>::fromString):

  • Source/WebCore/svg/SVGGradientElement.h:

(WebCore::SVGPropertyTraits<SVGSpreadMethodType>::fromString):

  • Source/WebCore/svg/SVGMarkerTypes.h:

(WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):

  • Source/WebCore/svg/SVGTests.cpp:

(WebCore::SVGTests::hasFeatureForLegacyBindings):

  • Source/WebCore/svg/SVGTextContentElement.cpp:

(WebCore::SVGTextContentElement::collectPresentationalHintsForAttribute):

  • Source/WebCore/svg/SVGTextContentElement.h:

(WebCore::SVGPropertyTraits<SVGLengthAdjustType>::fromString):

  • Source/WebCore/svg/SVGTextPathElement.h:

(WebCore::SVGPropertyTraits<SVGTextPathMethodType>::fromString):
(WebCore::SVGPropertyTraits<SVGTextPathSpacingType>::fromString):

  • Source/WebCore/svg/SVGUnitTypes.h:

(WebCore::SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString):

  • Source/WebCore/svg/SVGZoomAndPanType.h:

(WebCore::SVGPropertyTraits<SVGZoomAndPanType>::fromString):

  • Source/WebCore/svg/animation/SVGSMILElement.cpp:

(WebCore::SVGSMILElement::createInstanceTimesFromSyncbase):

  • Source/WebCore/svg/properties/SVGPropertyTraits.h:

(WebCore::SVGPropertyTraits<bool>::fromString):

  • Source/WebCore/testing/Internals.cpp:

(WebCore::Internals::pseudoElement):
(WebCore::Internals::setViewBaseBackgroundColor):
(WebCore::Internals::setPagination):
(WebCore::parseFindOptions):
(WebCore::Internals::countMatchesForText):
(WebCore::Internals::setOverridePreferredDynamicRangeMode):
(WebCore::taskSourceFromString):
(WebCore::Internals::hasSandboxMachLookupAccessToGlobalName):
(WebCore::Internals::hasSandboxMachLookupAccessToXPCServiceName):

  • Source/WebCore/testing/MockLibWebRTCPeerConnection.cpp:

(WebCore::createConnection):

  • Source/WebCore/workers/WorkerFontLoadRequest.cpp:

(WebCore::WorkerFontLoadRequest::load):

  • Source/WebCore/workers/WorkerScriptLoader.cpp:

(WebCore::WorkerScriptLoader::loadAsynchronously):

  • Source/WebCore/workers/service/server/RegistrationDatabase.cpp:

(WebCore::stringToUpdateViaCache):
(WebCore::stringToWorkerType):

  • Source/WebCore/xml/DOMParser.cpp:

(WebCore::DOMParser::parseFromString):

  • Source/WebCore/xml/XMLHttpRequest.cpp:

(WebCore::XMLHttpRequest::send):
(WebCore::XMLHttpRequest::sendBytesData):
(WebCore::XMLHttpRequest::createRequest):

  • Source/WebCore/xml/XPathFunctions.cpp:

(WebCore::XPath::Function::setArguments):

  • Source/WebCore/xml/XPathParser.cpp:

(WebCore::XPath::Parser::nextTokenInternal):

  • Source/WebCore/xml/XSLTProcessor.cpp:

(WebCore::XSLTProcessor::createDocumentFromSource):

  • Source/WebCore/xml/XSLTProcessorLibxslt.cpp:

(WebCore::XSLTProcessor::transformToString):

  • Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp:

(WebCore::shouldAllowExternalLoad):
(WebCore::XMLDocumentParser::supportsXMLVersion):
(WebCore::externalSubsetHandler):

  • Source/WebDriver/CommandResult.cpp:

(WebDriver::CommandResult::CommandResult):

  • Source/WebDriver/Session.cpp:

(WebDriver::Session::newWindow):
(WebDriver::Session::isElementSelected):
(WebDriver::Session::elementClick):

  • Source/WebDriver/WebDriverService.cpp:

(WebDriver::deserializeTimeouts):
(WebDriver::deserializeProxy):
(WebDriver::deserializePageLoadStrategy):
(WebDriver::deserializeUnhandledPromptBehavior):
(WebDriver::WebDriverService::validatedCapabilities const):
(WebDriver::WebDriverService::matchCapabilities const):
(WebDriver::WebDriverService::newWindow):
(WebDriver::isValidStrategy):
(WebDriver::findStrategyAndSelectorOrCompleteWithError):
(WebDriver::processNullAction):
(WebDriver::processKeyAction):
(WebDriver::processPointerMoveAction):
(WebDriver::processPointerAction):
(WebDriver::processWheelAction):
(WebDriver::processPointerParameters):
(WebDriver::processInputActionSequence):

  • Source/WebDriver/glib/WebDriverServiceGLib.cpp:

(WebDriver::WebDriverService::platformSupportProxyType const):

  • Source/WebDriver/gtk/WebDriverServiceGtk.cpp:

(WebDriver::WebDriverService::platformValidateCapability const):

  • Source/WebDriver/socket/HTTPParser.cpp:

(WebDriver::HTTPParser::expectedBodyLength const):

  • Source/WebDriver/socket/SessionHostSocket.cpp:

(WebDriver::SessionHost::parseTargetList):

  • Source/WebDriver/soup/HTTPServerSoup.cpp:

(WebDriver::soupServerListen):

  • Source/WebDriver/wpe/WebDriverServiceWPE.cpp:

(WebDriver::WebDriverService::platformValidateCapability const):

  • Source/WebGPU/WGSLUnitTests/WGSLParserTests.mm:

(-[WGSLParserTests testParsingStruct]):
(-[WGSLParserTests testParsingGlobalVariable]):
(-[WGSLParserTests testParsingFunctionDecl]):
(-[WGSLParserTests testTrivialGraphicsShader]):

  • Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsStore.cpp:

(WebKit::ResourceLoadStatisticsStore::shouldSkip const):

  • Source/WebKit/NetworkProcess/DatabaseUtilities.cpp:

(WebKit::insertDistinctValuesInTableStatement):

  • Source/WebKit/NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::allowsPrivateClickMeasurementTestFunctionality const):

  • Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:

(WebKit::NetworkResourceLoader::isCrossOriginPrefetch const):

  • Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:

(WebKit::ServiceWorkerFetchTask::ServiceWorkerFetchTask):

  • Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp:

(WebKit::CacheStorage::getDirectorySize):

  • Source/WebKit/NetworkProcess/cache/CacheStorageEngineCache.cpp:

(WebKit::CacheStorage::queryCache):
(WebKit::CacheStorage::Cache::retrieveRecords):

  • Source/WebKit/NetworkProcess/cache/NetworkCache.cpp:

(WebKit::NetworkCache::makeRetrieveDecision):
(WebKit::NetworkCache::makeStoreDecision):

  • Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp:

(WebKit::NetworkCache::Entry::Entry):

  • Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp:

(WebKit::NetworkCache::SpeculativeLoadManager::shouldRegisterLoad):
(WebKit::NetworkCache::SpeculativeLoadManager::retrieveSubresourcesEntry):

  • Source/WebKit/NetworkProcess/cache/NetworkCacheSubresourcesEntry.cpp:

(WebKit::NetworkCache::SubresourcesEntry::SubresourcesEntry):

  • Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(WebKit::isActingOnBehalfOfAFullWebBrowser):

  • Source/WebKit/NetworkProcess/curl/NetworkDataTaskCurl.cpp:

(WebKit::NetworkDataTaskCurl::shouldRedirectAsGET):

  • Source/WebKit/NetworkProcess/ios/NetworkProcessIOS.mm:

(WebKit::NetworkProcess::parentProcessHasServiceWorkerEntitlement const):

  • Source/WebKit/NetworkProcess/storage/FileSystemStorageHandle.cpp:

(WebKit::isValidFileName):

  • Source/WebKit/NetworkProcess/storage/OriginStorageManager.cpp:

(WebKit::OriginStorageManager::StorageBucket::isEmpty):

  • Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
  • Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb:
  • Source/WebKit/Shared/AuxiliaryProcess.h:
  • Source/WebKit/Shared/Cocoa/AuxiliaryProcessCocoa.mm:

(WebKit::AuxiliaryProcess::parentProcessHasEntitlement):
(WebKit::AuxiliaryProcess::setPreferenceValue):

  • Source/WebKit/Shared/Cocoa/DefaultWebBrowserChecks.mm:

(WebKit::appBoundDomainsForTesting):
(WebKit::isParentProcessAFullWebBrowser):
(WebKit::isFullWebBrowser):

  • Source/WebKit/Shared/Cocoa/XPCEndpoint.mm:

(WebKit::XPCEndpoint::XPCEndpoint):

  • Source/WebKit/Shared/Cocoa/XPCEndpointClient.mm:

(WebKit::XPCEndpointClient::setEndpoint):

  • Source/WebKit/Shared/Daemon/DaemonUtilities.h:
  • Source/WebKit/Shared/Daemon/DaemonUtilities.mm:

(WebKit::startListeningForMachServiceConnections):

  • Source/WebKit/Shared/Databases/IndexedDB/IDBUtilities.cpp:

(WebKit::uniqueDatabaseIdentifier):

  • Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm:

(WebKit::PCMDaemonMain):

  • Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.h:
  • Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:

(WebKit::XPCServiceInitializerDelegate::checkEntitlements):
(WebKit::XPCServiceInitializerDelegate::hasEntitlement):

  • Source/WebKit/Shared/IPCTester.cpp:

(WebKit::messageTestDriver):

  • Source/WebKit/Shared/WebPreferencesDefaultValues.cpp:

(WebKit::defaultMediaSessionCoordinatorEnabled):

  • Source/WebKit/Shared/glib/InputMethodState.cpp:

(WebKit::inputElementHasDigitsPattern):

  • Source/WebKit/Shared/ios/WebIOSEventFactory.mm:

(WebIOSEventFactory::createWebKeyboardEvent):

  • Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm:

(WebKit::tryApplyCachedSandbox):
(WebKit::AuxiliaryProcess::initializeSandbox):

  • Source/WebKit/UIProcess/API/C/WKMockMediaDevice.cpp:

(WKAddMockMediaDevice):

  • Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _setupPageConfiguration:]):

  • Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm:

(-[WKWebpagePreferences _setCaptivePortalModeEnabled:]):

  • Source/WebKit/UIProcess/API/Cocoa/_WKSystemPreferences.mm:

(+[_WKSystemPreferences isCaptivePortalModeEnabled]):
(+[_WKSystemPreferences setCaptivePortalModeEnabled:]):

  • Source/WebKit/UIProcess/API/Cocoa/_WKSystemPreferencesInternal.h:
  • Source/WebKit/UIProcess/API/glib/WebKitAutomationSession.cpp:

(parseProxyCapabilities):

  • Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp:

(addOriginToMap):

  • Source/WebKit/UIProcess/API/gtk/DropTargetGtk4.cpp:

(WebKit::DropTarget::accept):

  • Source/WebKit/UIProcess/ApplicationStateTracker.mm:

(WebKit::applicationType):

  • Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm:

(WebKit::applicationVisibleNameFromOrigin):

  • Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm:

(WebKit::WebViewImpl::collectKeyboardLayoutCommandsForEvent):

  • Source/WebKit/UIProcess/Downloads/DownloadProxyMap.cpp:

(WebKit::DownloadProxyMap::DownloadProxyMap):

  • Source/WebKit/UIProcess/Inspector/glib/RemoteInspectorClient.cpp:

(WebKit::debuggableType):

  • Source/WebKit/UIProcess/Launcher/glib/ProcessLauncherGLib.cpp:

(WebKit::ProcessLauncher::launchProcess):

  • Source/WebKit/UIProcess/WebFrameProxy.cpp:

(WebKit::WebFrameProxy::isDisplayingMarkupDocument const):

  • Source/WebKit/UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::requestAttachmentIcon):

  • Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:

(WebKit::WebsiteDataStore::networkProcessHasEntitlementForTesting):

  • Source/WebKit/UIProcess/WebsiteData/WebsiteDataRecord.cpp:

(WebKit::WebsiteDataRecord::displayNameForCookieHostName):
(WebKit::WebsiteDataRecord::displayNameForOrigin):

  • Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:

(WebKit::isEGLImageAvailable):

  • Source/WebKit/UIProcess/gtk/Clipboard.cpp:

(WebKit::Clipboard::get):

  • Source/WebKit/UIProcess/gtk/WebDataListSuggestionsDropdownGtk.cpp:

(WebKit::WebDataListSuggestionsDropdownGtk::handleKeydownWithIdentifier):

  • Source/WebKit/UIProcess/gtk/WebDateTimePickerGtk.cpp:

(WebKit::WebDateTimePickerGtk::update):

  • Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:

(applicationHasAppLinkEntitlements):

  • Source/WebKit/UIProcess/ios/WKPDFView.mm:

(+[WKPDFView web_requiresCustomSnapshotting]):

  • Source/WebKit/UIProcess/mac/WebContextMenuProxyMac.mm:

(WebKit::WebContextMenuProxyMac::setupServicesMenu):

  • Source/WebKit/UIProcess/mac/WebDataListSuggestionsDropdownMac.mm:

(WebKit::WebDataListSuggestionsDropdownMac::handleKeydownWithIdentifier):
(-[WKDataListSuggestionsController moveSelectionByDirection:]):

  • Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:

(WebKit::evaluateJavaScriptCallback):

  • Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebPage.cpp:

(webkitWebPageDidReceiveMessage):

  • Source/WebKit/WebProcess/Plugins/PDF/PDFPluginPasswordField.mm:

(WebKit::PDFPluginPasswordField::handleEvent):

  • Source/WebKit/WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm:

(WebKit::PDFPluginTextAnnotation::handleEvent):

  • Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp:

(WebKit::getActionTypeForKeyEvent):

  • Source/WebKit/WebProcess/WebPage/Cocoa/TextCheckingControllerProxy.mm:

(WebKit::TextCheckingControllerProxy::removeAnnotationRelativeToSelection):

  • Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp:

(WebKit::IPCTestingAPI::encodeArgument):

  • Source/WebKit/WebProcess/WebPage/WebFrame.cpp:

(WebKit::WebFrame::setTextDirection):

  • Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::parentProcessHasServiceWorkerEntitlement const):
(WebKit::WebPage::focusedElementInformation):
(WebKit::WebPage::platformUserAgent const):

  • Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:

(WebKit::WebPage::executeKeypressCommandsInternal):
(WebKit::WebPage::handleEditingKeyboardEvent):
(WebKit::WebPage::performNonEditingBehaviorForSelector):

  • Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:

(WebKit::WebProcess::platformInitializeProcess):
(WebKit::WebProcess::handlePreferenceChange):

  • Source/WebKit/webpushd/PushClientConnection.h:
  • Source/WebKit/webpushd/PushClientConnection.mm:

(WebPushD::ClientConnection::hostHasEntitlement):

  • Source/WebKitLegacy/cf/WebCoreSupport/WebInspectorClientCF.cpp:

(WebInspectorClient::inspectorAttachDisabled):
(WebInspectorClient::inspectorStartsAttached):

  • Source/WebKitLegacy/mac/Plugins/WebBasePluginPackage.mm:

(-[WebBasePluginPackage isQuickTimePlugIn]):

  • Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm:

(selectorForKeyEvent):

  • Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm:

(WebFrameLoaderClient::transitionToCommittedForNewPage):

  • Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:

(-[WebHTMLView _executeSavedKeypressCommands]):

  • Source/WebKitLegacy/win/WebFrame.cpp:

(WebFrame::setTextDirection):
(WebFrame::canProvideDocumentSource):

  • Tools/DumpRenderTree/win/DumpRenderTree.cpp:

(runTest):

  • Tools/TestWebKitAPI/Tests/WTF/AtomString.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WTF/JSONValue.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WTF/Vector.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WTF/cocoa/TextStreamCocoa.cpp:

(TEST):

  • Tools/TestWebKitAPI/Tests/WTF/cocoa/TextStreamCocoa.mm:

(TEST):

  • Tools/TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WebCore/CBORValueTest.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WebCore/ColorTests.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WebCore/FontShadowTests.cpp:

(TestWebKitAPI::TEST_F):

  • Tools/TestWebKitAPI/Tests/WebCore/LineBreaking.mm:

(breakingLocationsFromICU):

  • Tools/TestWebKitAPI/Tests/WebCore/NowPlayingInfoTests.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WebCore/PrivateClickMeasurement.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WebCore/SecurityOrigin.cpp:

(TestWebKitAPI::TEST_F):

  • Tools/TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp:

(TestWebKitAPI::TEST_F):

  • Tools/TestWebKitAPI/Tests/WebCore/StringWithDirection.cpp:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WebKit/MediaSessionCoordinatorTest.mm:

(TestWebKitAPI::TEST_F):

  • Tools/TestWebKitAPI/Tests/WebKit/OverrideAppleLanguagesPreference.mm:

(TEST_F):

  • Tools/TestWebKitAPI/Tests/WebKitCocoa/CookiePrivateBrowsing.mm:

(TEST):

  • Tools/TestWebKitAPI/Tests/WebKitCocoa/MediaLoading.mm:

(TestWebKitAPI::TEST):

  • Tools/TestWebKitAPI/Tests/WebKitCocoa/ResourceLoadStatistics.mm:

(TEST):

  • Tools/TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm:

(-[SyncScheme webView:startURLSchemeTask:]):

  • Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::dumpErrorDescriptionSuitableForTestResult):

  • Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp:

(WTR::attributesOfElement):
(WTR::AccessibilityUIElement::stringAttributeValue):
(WTR::AccessibilityUIElement::numberAttributeValue):
(WTR::AccessibilityUIElement::boolAttributeValue):
(WTR::AccessibilityUIElement::isAttributeSettable):
(WTR::AccessibilityUIElement::isAttributeSupported):
(WTR::AccessibilityUIElement::isPressActionSupported):

  • Tools/WebKitTestRunner/TestController.cpp:

(WTR::TestController::setPluginSupportedMode):

  • Tools/WebKitTestRunner/cocoa/CrashReporterInfo.mm:

(WTR::testPathFromURL):

  • Tools/WebKitTestRunner/cocoa/UIScriptControllerCocoa.mm:

(WTR::UIScriptControllerCocoa::overridePreference):

  • Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp:

(WTR::UIScriptControllerGtk::overridePreference):

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

  • Property svn:eol-style set to native
File size: 21.2 KB
Line 
1/*
2 * Copyright (C) 2005 Frerich Raabe <[email protected]>
3 * Copyright (C) 2006, 2009, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <[email protected]>
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include "config.h"
29#include "XPathFunctions.h"
30
31#include "Attribute.h"
32#include "ElementInlines.h"
33#include "ProcessingInstruction.h"
34#include "TreeScope.h"
35#include "XMLNames.h"
36#include "XPathUtil.h"
37#include <wtf/MathExtras.h>
38#include <wtf/NeverDestroyed.h>
39#include <wtf/RobinHoodHashMap.h>
40#include <wtf/text/StringBuilder.h>
41
42namespace WebCore {
43namespace XPath {
44
45static inline bool isWhitespace(UChar c)
46{
47 return c == ' ' || c == '\n' || c == '\r' || c == '\t';
48}
49
50#define DEFINE_FUNCTION_CREATOR(Suffix) static std::unique_ptr<Function> createFunction##Suffix() { return makeUnique<Fun##Suffix>(); }
51
52class Interval {
53public:
54 static const int Inf = -1;
55
56 Interval();
57 Interval(int value);
58 Interval(int min, int max);
59
60 bool contains(int value) const;
61
62private:
63 int m_min;
64 int m_max;
65};
66
67class FunLast final : public Function {
68 Value evaluate() const override;
69 Value::Type resultType() const override { return Value::NumberValue; }
70public:
71 FunLast() { setIsContextSizeSensitive(true); }
72};
73
74class FunPosition final : public Function {
75 Value evaluate() const override;
76 Value::Type resultType() const override { return Value::NumberValue; }
77public:
78 FunPosition() { setIsContextPositionSensitive(true); }
79};
80
81class FunCount final : public Function {
82 Value evaluate() const override;
83 Value::Type resultType() const override { return Value::NumberValue; }
84};
85
86class FunId final : public Function {
87 Value evaluate() const override;
88 Value::Type resultType() const override { return Value::NodeSetValue; }
89};
90
91class FunLocalName final : public Function {
92 Value evaluate() const override;
93 Value::Type resultType() const override { return Value::StringValue; }
94public:
95 FunLocalName() { setIsContextNodeSensitive(true); } // local-name() with no arguments uses context node.
96};
97
98class FunNamespaceURI final : public Function {
99 Value evaluate() const override;
100 Value::Type resultType() const override { return Value::StringValue; }
101public:
102 FunNamespaceURI() { setIsContextNodeSensitive(true); } // namespace-uri() with no arguments uses context node.
103};
104
105class FunName final : public Function {
106 Value evaluate() const override;
107 Value::Type resultType() const override { return Value::StringValue; }
108public:
109 FunName() { setIsContextNodeSensitive(true); } // name() with no arguments uses context node.
110};
111
112class FunString final : public Function {
113 Value evaluate() const override;
114 Value::Type resultType() const override { return Value::StringValue; }
115public:
116 FunString() { setIsContextNodeSensitive(true); } // string() with no arguments uses context node.
117};
118
119class FunConcat final : public Function {
120 Value evaluate() const override;
121 Value::Type resultType() const override { return Value::StringValue; }
122};
123
124class FunStartsWith final : public Function {
125 Value evaluate() const override;
126 Value::Type resultType() const override { return Value::BooleanValue; }
127};
128
129class FunContains final : public Function {
130 Value evaluate() const override;
131 Value::Type resultType() const override { return Value::BooleanValue; }
132};
133
134class FunSubstringBefore final : public Function {
135 Value evaluate() const override;
136 Value::Type resultType() const override { return Value::StringValue; }
137};
138
139class FunSubstringAfter final : public Function {
140 Value evaluate() const override;
141 Value::Type resultType() const override { return Value::StringValue; }
142};
143
144class FunSubstring final : public Function {
145 Value evaluate() const override;
146 Value::Type resultType() const override { return Value::StringValue; }
147};
148
149class FunStringLength final : public Function {
150 Value evaluate() const override;
151 Value::Type resultType() const override { return Value::NumberValue; }
152public:
153 FunStringLength() { setIsContextNodeSensitive(true); } // string-length() with no arguments uses context node.
154};
155
156class FunNormalizeSpace final : public Function {
157 Value evaluate() const override;
158 Value::Type resultType() const override { return Value::StringValue; }
159public:
160 FunNormalizeSpace() { setIsContextNodeSensitive(true); } // normalize-space() with no arguments uses context node.
161};
162
163class FunTranslate final : public Function {
164 Value evaluate() const override;
165 Value::Type resultType() const override { return Value::StringValue; }
166};
167
168class FunBoolean final : public Function {
169 Value evaluate() const override;
170 Value::Type resultType() const override { return Value::BooleanValue; }
171};
172
173class FunNot : public Function {
174 Value evaluate() const override;
175 Value::Type resultType() const override { return Value::BooleanValue; }
176};
177
178class FunTrue final : public Function {
179 Value evaluate() const override;
180 Value::Type resultType() const override { return Value::BooleanValue; }
181};
182
183class FunFalse final : public Function {
184 Value evaluate() const override;
185 Value::Type resultType() const override { return Value::BooleanValue; }
186};
187
188class FunLang final : public Function {
189 Value evaluate() const override;
190 Value::Type resultType() const override { return Value::BooleanValue; }
191public:
192 FunLang() { setIsContextNodeSensitive(true); } // lang() always works on context node.
193};
194
195class FunNumber final : public Function {
196 Value evaluate() const override;
197 Value::Type resultType() const override { return Value::NumberValue; }
198public:
199 FunNumber() { setIsContextNodeSensitive(true); } // number() with no arguments uses context node.
200};
201
202class FunSum final : public Function {
203 Value evaluate() const override;
204 Value::Type resultType() const override { return Value::NumberValue; }
205};
206
207class FunFloor final : public Function {
208 Value evaluate() const override;
209 Value::Type resultType() const override { return Value::NumberValue; }
210};
211
212class FunCeiling final : public Function {
213 Value evaluate() const override;
214 Value::Type resultType() const override { return Value::NumberValue; }
215};
216
217class FunRound final : public Function {
218 Value evaluate() const override;
219 Value::Type resultType() const override { return Value::NumberValue; }
220public:
221 static double round(double);
222};
223
224DEFINE_FUNCTION_CREATOR(Last)
225DEFINE_FUNCTION_CREATOR(Position)
226DEFINE_FUNCTION_CREATOR(Count)
227DEFINE_FUNCTION_CREATOR(Id)
228DEFINE_FUNCTION_CREATOR(LocalName)
229DEFINE_FUNCTION_CREATOR(NamespaceURI)
230DEFINE_FUNCTION_CREATOR(Name)
231
232DEFINE_FUNCTION_CREATOR(String)
233DEFINE_FUNCTION_CREATOR(Concat)
234DEFINE_FUNCTION_CREATOR(StartsWith)
235DEFINE_FUNCTION_CREATOR(Contains)
236DEFINE_FUNCTION_CREATOR(SubstringBefore)
237DEFINE_FUNCTION_CREATOR(SubstringAfter)
238DEFINE_FUNCTION_CREATOR(Substring)
239DEFINE_FUNCTION_CREATOR(StringLength)
240DEFINE_FUNCTION_CREATOR(NormalizeSpace)
241DEFINE_FUNCTION_CREATOR(Translate)
242
243DEFINE_FUNCTION_CREATOR(Boolean)
244DEFINE_FUNCTION_CREATOR(Not)
245DEFINE_FUNCTION_CREATOR(True)
246DEFINE_FUNCTION_CREATOR(False)
247DEFINE_FUNCTION_CREATOR(Lang)
248
249DEFINE_FUNCTION_CREATOR(Number)
250DEFINE_FUNCTION_CREATOR(Sum)
251DEFINE_FUNCTION_CREATOR(Floor)
252DEFINE_FUNCTION_CREATOR(Ceiling)
253DEFINE_FUNCTION_CREATOR(Round)
254
255#undef DEFINE_FUNCTION_CREATOR
256
257inline Interval::Interval()
258 : m_min(Inf), m_max(Inf)
259{
260}
261
262inline Interval::Interval(int value)
263 : m_min(value), m_max(value)
264{
265}
266
267inline Interval::Interval(int min, int max)
268 : m_min(min), m_max(max)
269{
270}
271
272inline bool Interval::contains(int value) const
273{
274 if (m_min == Inf && m_max == Inf)
275 return true;
276
277 if (m_min == Inf)
278 return value <= m_max;
279
280 if (m_max == Inf)
281 return value >= m_min;
282
283 return value >= m_min && value <= m_max;
284}
285
286void Function::setArguments(const String& name, Vector<std::unique_ptr<Expression>> arguments)
287{
288 ASSERT(!subexpressionCount());
289
290 // Functions that use the context node as an implicit argument are context node sensitive when they
291 // have no arguments, but when explicit arguments are added, they are no longer context node sensitive.
292 // As of this writing, the only exception to this is the "lang" function.
293 if (name != "lang"_s && !arguments.isEmpty())
294 setIsContextNodeSensitive(false);
295
296 setSubexpressions(WTFMove(arguments));
297}
298
299Value FunLast::evaluate() const
300{
301 return Expression::evaluationContext().size;
302}
303
304Value FunPosition::evaluate() const
305{
306 return Expression::evaluationContext().position;
307}
308
309// FIXME: Should StringBuilder offer this as a member function?
310static StringView toStringView(StringBuilder& builder)
311{
312 if (builder.is8Bit())
313 return { builder.characters8(), builder.length() };
314 return { builder.characters16(), builder.length() };
315}
316
317Value FunId::evaluate() const
318{
319 Value a = argument(0).evaluate();
320 StringBuilder idList; // A whitespace-separated list of IDs
321
322 if (!a.isNodeSet())
323 idList.append(a.toString());
324 else {
325 for (auto& node : a.toNodeSet()) {
326 idList.append(stringValue(node.get()));
327 idList.append(' ');
328 }
329 }
330
331 TreeScope& contextScope = evaluationContext().node->treeScope();
332 NodeSet result;
333 HashSet<Ref<Node>> resultSet;
334
335 unsigned startPos = 0;
336 unsigned length = idList.length();
337 while (true) {
338 while (startPos < length && isWhitespace(idList[startPos]))
339 ++startPos;
340
341 if (startPos == length)
342 break;
343
344 size_t endPos = startPos;
345 while (endPos < length && !isWhitespace(idList[endPos]))
346 ++endPos;
347
348 // If there are several nodes with the same id, id() should return the first one.
349 // In WebKit, getElementById behaves so, too, although its behavior in this case is formally undefined.
350 Node* node = contextScope.getElementById(toStringView(idList).substring(startPos, endPos - startPos));
351 if (node && resultSet.add(*node).isNewEntry)
352 result.append(node);
353
354 startPos = endPos;
355 }
356
357 result.markSorted(false);
358
359 return Value(WTFMove(result));
360}
361
362static inline String expandedNameLocalPart(Node* node)
363{
364 if (is<ProcessingInstruction>(*node))
365 return downcast<ProcessingInstruction>(*node).target();
366 return node->localName().string();
367}
368
369static inline String expandedName(Node* node)
370{
371 const AtomString& prefix = node->prefix();
372 return prefix.isEmpty() ? expandedNameLocalPart(node) : prefix + ":" + expandedNameLocalPart(node);
373}
374
375Value FunLocalName::evaluate() const
376{
377 if (argumentCount() > 0) {
378 Value a = argument(0).evaluate();
379 if (!a.isNodeSet())
380 return emptyString();
381
382 Node* node = a.toNodeSet().firstNode();
383 return node ? expandedNameLocalPart(node) : emptyString();
384 }
385
386 return expandedNameLocalPart(evaluationContext().node.get());
387}
388
389Value FunNamespaceURI::evaluate() const
390{
391 if (argumentCount() > 0) {
392 Value a = argument(0).evaluate();
393 if (!a.isNodeSet())
394 return emptyString();
395
396 Node* node = a.toNodeSet().firstNode();
397 return node ? node->namespaceURI().string() : emptyString();
398 }
399
400 return evaluationContext().node->namespaceURI().string();
401}
402
403Value FunName::evaluate() const
404{
405 if (argumentCount() > 0) {
406 Value a = argument(0).evaluate();
407 if (!a.isNodeSet())
408 return emptyString();
409
410 Node* node = a.toNodeSet().firstNode();
411 return node ? expandedName(node) : emptyString();
412 }
413
414 return expandedName(evaluationContext().node.get());
415}
416
417Value FunCount::evaluate() const
418{
419 Value a = argument(0).evaluate();
420
421 return double(a.toNodeSet().size());
422}
423
424Value FunString::evaluate() const
425{
426 if (!argumentCount())
427 return Value(Expression::evaluationContext().node.get()).toString();
428 return argument(0).evaluate().toString();
429}
430
431Value FunConcat::evaluate() const
432{
433 StringBuilder result;
434 result.reserveCapacity(1024);
435
436 for (unsigned i = 0, count = argumentCount(); i < count; ++i) {
437 String str(argument(i).evaluate().toString());
438 result.append(str);
439 }
440
441 return result.toString();
442}
443
444Value FunStartsWith::evaluate() const
445{
446 String s1 = argument(0).evaluate().toString();
447 String s2 = argument(1).evaluate().toString();
448
449 if (s2.isEmpty())
450 return true;
451
452 return s1.startsWith(s2);
453}
454
455Value FunContains::evaluate() const
456{
457 String s1 = argument(0).evaluate().toString();
458 String s2 = argument(1).evaluate().toString();
459
460 if (s2.isEmpty())
461 return true;
462
463 return s1.contains(s2) != 0;
464}
465
466Value FunSubstringBefore::evaluate() const
467{
468 String s1 = argument(0).evaluate().toString();
469 String s2 = argument(1).evaluate().toString();
470
471 if (s2.isEmpty())
472 return emptyString();
473
474 size_t i = s1.find(s2);
475
476 if (i == notFound)
477 return emptyString();
478
479 return s1.left(i);
480}
481
482Value FunSubstringAfter::evaluate() const
483{
484 String s1 = argument(0).evaluate().toString();
485 String s2 = argument(1).evaluate().toString();
486
487 size_t i = s1.find(s2);
488 if (i == notFound)
489 return emptyString();
490
491 return s1.substring(i + s2.length());
492}
493
494Value FunSubstring::evaluate() const
495{
496 String s = argument(0).evaluate().toString();
497 double doublePos = argument(1).evaluate().toNumber();
498 if (std::isnan(doublePos))
499 return emptyString();
500 long pos = static_cast<long>(FunRound::round(doublePos));
501 bool haveLength = argumentCount() == 3;
502 long len = -1;
503 if (haveLength) {
504 double doubleLen = argument(2).evaluate().toNumber();
505 if (std::isnan(doubleLen))
506 return emptyString();
507 len = static_cast<long>(FunRound::round(doubleLen));
508 }
509
510 if (pos > long(s.length()))
511 return emptyString();
512
513 if (pos < 1) {
514 if (haveLength) {
515 len -= 1 - pos;
516 if (len < 1)
517 return emptyString();
518 }
519 pos = 1;
520 }
521
522 return s.substring(pos - 1, len);
523}
524
525Value FunStringLength::evaluate() const
526{
527 if (!argumentCount())
528 return Value(Expression::evaluationContext().node.get()).toString().length();
529 return argument(0).evaluate().toString().length();
530}
531
532Value FunNormalizeSpace::evaluate() const
533{
534 if (!argumentCount()) {
535 String s = Value(Expression::evaluationContext().node.get()).toString();
536 return s.simplifyWhiteSpace();
537 }
538
539 String s = argument(0).evaluate().toString();
540 return s.simplifyWhiteSpace();
541}
542
543Value FunTranslate::evaluate() const
544{
545 String s1 = argument(0).evaluate().toString();
546 String s2 = argument(1).evaluate().toString();
547 String s3 = argument(2).evaluate().toString();
548 StringBuilder result;
549
550 for (unsigned i1 = 0; i1 < s1.length(); ++i1) {
551 UChar ch = s1[i1];
552 size_t i2 = s2.find(ch);
553
554 if (i2 == notFound)
555 result.append(ch);
556 else if (i2 < s3.length())
557 result.append(s3[i2]);
558 }
559
560 return result.toString();
561}
562
563Value FunBoolean::evaluate() const
564{
565 return argument(0).evaluate().toBoolean();
566}
567
568Value FunNot::evaluate() const
569{
570 return !argument(0).evaluate().toBoolean();
571}
572
573Value FunTrue::evaluate() const
574{
575 return true;
576}
577
578Value FunLang::evaluate() const
579{
580 String lang = argument(0).evaluate().toString();
581
582 const Attribute* languageAttribute = nullptr;
583 Node* node = evaluationContext().node.get();
584 while (node) {
585 if (is<Element>(*node)) {
586 Element& element = downcast<Element>(*node);
587 if (element.hasAttributes())
588 languageAttribute = element.findAttributeByName(XMLNames::langAttr);
589 }
590 if (languageAttribute)
591 break;
592 node = node->parentNode();
593 }
594
595 if (!languageAttribute)
596 return false;
597
598 String langValue = languageAttribute->value();
599 while (true) {
600 if (equalIgnoringASCIICase(langValue, lang))
601 return true;
602
603 // Remove suffixes one by one.
604 size_t index = langValue.reverseFind('-');
605 if (index == notFound)
606 break;
607 langValue = langValue.left(index);
608 }
609
610 return false;
611}
612
613Value FunFalse::evaluate() const
614{
615 return false;
616}
617
618Value FunNumber::evaluate() const
619{
620 if (!argumentCount())
621 return Value(Expression::evaluationContext().node.get()).toNumber();
622 return argument(0).evaluate().toNumber();
623}
624
625Value FunSum::evaluate() const
626{
627 Value a = argument(0).evaluate();
628 if (!a.isNodeSet())
629 return 0.0;
630
631 double sum = 0.0;
632 const NodeSet& nodes = a.toNodeSet();
633 // To be really compliant, we should sort the node-set, as floating point addition is not associative.
634 // However, this is unlikely to ever become a practical issue, and sorting is slow.
635
636 for (auto& node : nodes)
637 sum += Value(stringValue(node.get())).toNumber();
638
639 return sum;
640}
641
642Value FunFloor::evaluate() const
643{
644 return floor(argument(0).evaluate().toNumber());
645}
646
647Value FunCeiling::evaluate() const
648{
649 return ceil(argument(0).evaluate().toNumber());
650}
651
652double FunRound::round(double val)
653{
654 if (!std::isnan(val) && !std::isinf(val)) {
655 if (std::signbit(val) && val >= -0.5)
656 val *= 0; // negative zero
657 else
658 val = floor(val + 0.5);
659 }
660 return val;
661}
662
663Value FunRound::evaluate() const
664{
665 return round(argument(0).evaluate().toNumber());
666}
667
668struct FunctionMapValue {
669 std::unique_ptr<Function> (*creationFunction)();
670 Interval argumentCountInterval;
671};
672
673static MemoryCompactLookupOnlyRobinHoodHashMap<String, FunctionMapValue> createFunctionMap()
674{
675 struct FunctionMapping {
676 ASCIILiteral name;
677 FunctionMapValue function;
678 };
679
680 static const FunctionMapping functions[] = {
681 { "boolean"_s, { createFunctionBoolean, 1 } },
682 { "ceiling"_s, { createFunctionCeiling, 1 } },
683 { "concat"_s, { createFunctionConcat, Interval(2, Interval::Inf) } },
684 { "contains"_s, { createFunctionContains, 2 } },
685 { "count"_s, { createFunctionCount, 1 } },
686 { "false"_s, { createFunctionFalse, 0 } },
687 { "floor"_s, { createFunctionFloor, 1 } },
688 { "id"_s, { createFunctionId, 1 } },
689 { "lang"_s, { createFunctionLang, 1 } },
690 { "last"_s, { createFunctionLast, 0 } },
691 { "local-name"_s, { createFunctionLocalName, Interval(0, 1) } },
692 { "name"_s, { createFunctionName, Interval(0, 1) } },
693 { "namespace-uri"_s, { createFunctionNamespaceURI, Interval(0, 1) } },
694 { "normalize-space"_s, { createFunctionNormalizeSpace, Interval(0, 1) } },
695 { "not"_s, { createFunctionNot, 1 } },
696 { "number"_s, { createFunctionNumber, Interval(0, 1) } },
697 { "position"_s, { createFunctionPosition, 0 } },
698 { "round"_s, { createFunctionRound, 1 } },
699 { "starts-with"_s, { createFunctionStartsWith, 2 } },
700 { "string"_s, { createFunctionString, Interval(0, 1) } },
701 { "string-length"_s, { createFunctionStringLength, Interval(0, 1) } },
702 { "substring"_s, { createFunctionSubstring, Interval(2, 3) } },
703 { "substring-after"_s, { createFunctionSubstringAfter, 2 } },
704 { "substring-before"_s, { createFunctionSubstringBefore, 2 } },
705 { "sum"_s, { createFunctionSum, 1 } },
706 { "translate"_s, { createFunctionTranslate, 3 } },
707 { "true"_s, { createFunctionTrue, 0 } },
708 };
709
710 MemoryCompactLookupOnlyRobinHoodHashMap<String, FunctionMapValue> map;
711 for (auto& function : functions)
712 map.add(function.name, function.function);
713 return map;
714}
715
716std::unique_ptr<Function> Function::create(const String& name, unsigned numArguments)
717{
718 static NeverDestroyed functionMap = createFunctionMap();
719
720 auto it = functionMap.get().find(name);
721 if (it == functionMap.get().end())
722 return nullptr;
723
724 if (!it->value.argumentCountInterval.contains(numArguments))
725 return nullptr;
726
727 return it->value.creationFunction();
728}
729
730std::unique_ptr<Function> Function::create(const String& name)
731{
732 return create(name, 0);
733}
734
735std::unique_ptr<Function> Function::create(const String& name, Vector<std::unique_ptr<Expression>> arguments)
736{
737 auto function = create(name, arguments.size());
738 if (function)
739 function->setArguments(name, WTFMove(arguments));
740 return function;
741}
742
743}
744}
Note: See TracBrowser for help on using the repository browser.