bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName) { static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes; if (supportedAttributes.get().isEmpty()) { SVGTests::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); SVGURIReference::addSupportedAttributes(supportedAttributes); supportedAttributes.get().add(SVGNames::xAttr); supportedAttributes.get().add(SVGNames::yAttr); } return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); }
bool SVGTextPositioningElement::isSupportedAttribute(const QualifiedName& attrName) { static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes; if (supportedAttributes.get().isEmpty()) { supportedAttributes.get().add(SVGNames::xAttr); supportedAttributes.get().add(SVGNames::yAttr); supportedAttributes.get().add(SVGNames::dxAttr); supportedAttributes.get().add(SVGNames::dyAttr); supportedAttributes.get().add(SVGNames::rotateAttr); } return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); }
std::unique_ptr<InputType> InputType::create(HTMLInputElement& element, const AtomicString& typeName) { static NeverDestroyed<InputTypeFactoryMap> factoryMap; if (factoryMap.get().isEmpty()) populateInputTypeFactoryMap(factoryMap); if (!typeName.isEmpty()) { if (auto factory = factoryMap.get().get(typeName)) return factory(element); } return std::make_unique<TextInputType>(element); }
static URLSchemesMap& CORSEnabledSchemes() { // FIXME: http://bugs.webkit.org/show_bug.cgi?id=77160 static NeverDestroyed<URLSchemesMap> CORSEnabledSchemes; if (CORSEnabledSchemes.get().isEmpty()) { CORSEnabledSchemes.get().add("http"); CORSEnabledSchemes.get().add("https"); } return CORSEnabledSchemes; }
bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) { static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes; if (supportedAttributes.get().isEmpty()) { SVGURIReference::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); supportedAttributes.get().add(SVGNames::gradientUnitsAttr); supportedAttributes.get().add(SVGNames::gradientTransformAttr); supportedAttributes.get().add(SVGNames::spreadMethodAttr); } return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); }
bool SVGFilterPrimitiveStandardAttributes::isSupportedAttribute(const QualifiedName& attrName) { static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes; if (supportedAttributes.get().isEmpty()) { supportedAttributes.get().add(SVGNames::xAttr); supportedAttributes.get().add(SVGNames::yAttr); supportedAttributes.get().add(SVGNames::widthAttr); supportedAttributes.get().add(SVGNames::heightAttr); supportedAttributes.get().add(SVGNames::resultAttr); } return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); }
static bool parseAxisName(const String& name, Step::Axis& type) { static NeverDestroyed<HashMap<String, Step::Axis>> axisNames; if (axisNames.get().isEmpty()) populateAxisNamesMap(axisNames); auto it = axisNames.get().find(name); if (it == axisNames.get().end()) return false; type = it->value; return true; }
// nonce-source = "'nonce-" nonce-value "'" // nonce-value = base64-value bool ContentSecurityPolicySourceList::parseNonceSource(const UChar* begin, const UChar* end) { static NeverDestroyed<String> noncePrefix("'nonce-", String::ConstructFromLiteral); if (!StringView(begin, end - begin).startsWithIgnoringASCIICase(noncePrefix.get())) return false; const UChar* position = begin + noncePrefix.get().length(); const UChar* beginNonceValue = position; skipWhile<UChar, isNonceCharacter>(position, end); if (position >= end || position == beginNonceValue || *position != '\'') return false; m_nonces.add(String(beginNonceValue, position - beginNonceValue)); return true; }
static URLSchemesMap& localURLSchemes() { static NeverDestroyed<URLSchemesMap> localSchemes; if (localSchemes.get().isEmpty()) { localSchemes.get().add("file"); #if PLATFORM(COCOA) localSchemes.get().add("applewebdata"); #endif } return localSchemes; }
bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName) { static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes; if (supportedAttributes.get().isEmpty()) { SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); supportedAttributes.get().add(SVGNames::xAttr); supportedAttributes.get().add(SVGNames::yAttr); supportedAttributes.get().add(SVGNames::widthAttr); supportedAttributes.get().add(SVGNames::heightAttr); } return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); }
static const String subtitleText(Page* page, String mimeType) { static NeverDestroyed<MimeTypeToLocalizedStringMap> mimeTypeToLabelSubtitleMap; String subtitleText = mimeTypeToLabelSubtitleMap.get().get(mimeType); if (!subtitleText.isEmpty()) return subtitleText; subtitleText = page->chrome().client().plugInStartLabelSubtitle(mimeType); if (subtitleText.isEmpty()) subtitleText = snapshottedPlugInLabelSubtitle(); mimeTypeToLabelSubtitleMap.get().set(mimeType, subtitleText); return subtitleText; };
void fillWithEmptyClients(PageConfiguration& pageConfiguration) { static NeverDestroyed<EmptyChromeClient> dummyChromeClient; pageConfiguration.chromeClient = &dummyChromeClient.get(); #if ENABLE(CONTEXT_MENUS) static NeverDestroyed<EmptyContextMenuClient> dummyContextMenuClient; pageConfiguration.contextMenuClient = &dummyContextMenuClient.get(); #endif #if ENABLE(DRAG_SUPPORT) static NeverDestroyed<EmptyDragClient> dummyDragClient; pageConfiguration.dragClient = &dummyDragClient.get(); #endif static NeverDestroyed<EmptyEditorClient> dummyEditorClient; pageConfiguration.editorClient = &dummyEditorClient.get(); static NeverDestroyed<EmptyInspectorClient> dummyInspectorClient; pageConfiguration.inspectorClient = &dummyInspectorClient.get(); static NeverDestroyed<EmptyFrameLoaderClient> dummyFrameLoaderClient; pageConfiguration.loaderClientForMainFrame = &dummyFrameLoaderClient.get(); static NeverDestroyed<EmptyProgressTrackerClient> dummyProgressTrackerClient; pageConfiguration.progressTrackerClient = &dummyProgressTrackerClient.get(); static NeverDestroyed<EmptyDiagnosticLoggingClient> dummyDiagnosticLoggingClient; pageConfiguration.diagnosticLoggingClient = &dummyDiagnosticLoggingClient.get(); pageConfiguration.databaseProvider = adoptRef(new EmptyDatabaseProvider); pageConfiguration.storageNamespaceProvider = adoptRef(new EmptyStorageNamespaceProvider); pageConfiguration.visitedLinkStore = adoptRef(new EmptyVisitedLinkStore); }
static URLSchemesMap& schemesWithUniqueOrigins() { static NeverDestroyed<URLSchemesMap> schemesWithUniqueOrigins; if (schemesWithUniqueOrigins.get().isEmpty()) { schemesWithUniqueOrigins.get().add("about"); schemesWithUniqueOrigins.get().add("javascript"); // This is a willful violation of HTML5. // See https://bugs.webkit.org/show_bug.cgi?id=11885 schemesWithUniqueOrigins.get().add("data"); } return schemesWithUniqueOrigins; }
std::unique_ptr<Function> Function::create(const String& name, unsigned numArguments) { static NeverDestroyed<HashMap<String, FunctionMapValue>> functionMap; if (functionMap.get().isEmpty()) populateFunctionMap(functionMap); auto it = functionMap.get().find(name); if (it == functionMap.get().end()) return nullptr; if (!it->value.argumentCountInterval.contains(numArguments)) return nullptr; return it->value.creationFunction(); }
static DatabaseGuid guidForOriginAndName(const String& origin, const String& name) { String stringID = origin + "/" + name; typedef HashMap<String, int> IDGuidMap; static NeverDestroyed<HashMap<String, int>> map; DatabaseGuid guid = map.get().get(stringID); if (!guid) { static int currentNewGUID = 1; guid = currentNewGUID++; map.get().set(stringID, guid); } return guid; }
void WebEditorClient::didBeginEditing() { // FIXME: What good is a notification name, if it's always the same? static NeverDestroyed<String> WebViewDidBeginEditingNotification(ASCIILiteral("WebViewDidBeginEditingNotification")); m_page->injectedBundleEditorClient().didBeginEditing(m_page, WebViewDidBeginEditingNotification.get().impl()); notImplemented(); }
EncodedJSValue jsTestNondeterministicNondeterministicWriteableAttr(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName) { UNUSED_PARAM(exec); UNUSED_PARAM(slotBase); UNUSED_PARAM(thisValue); JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue)); if (UNLIKELY(!castedThis)) { if (jsDynamicCast<JSTestNondeterministicPrototype*>(slotBase)) return reportDeprecatedGetterError(*exec, "TestNondeterministic", "nondeterministicWriteableAttr"); return throwGetterTypeError(*exec, "TestNondeterministic", "nondeterministicWriteableAttr"); } #if ENABLE(WEB_REPLAY) JSGlobalObject* globalObject = exec->lexicalGlobalObject(); InputCursor& cursor = globalObject->inputCursor(); static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicWriteableAttr", AtomicString::ConstructFromLiteral); if (cursor.isCapturing()) { String memoizedResult = castedThis->impl().nondeterministicWriteableAttr(); cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0); JSValue result = jsStringWithCache(exec, memoizedResult); return JSValue::encode(result); } if (cursor.isReplaying()) { String memoizedResult; MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); if (input && input->convertTo<String>(memoizedResult)) { JSValue result = jsStringWithCache(exec, memoizedResult); return JSValue::encode(result); } } #endif TestNondeterministic& impl = castedThis->impl(); JSValue result = jsStringWithCache(exec, impl.nondeterministicWriteableAttr()); return JSValue::encode(result); }
const EventListenerVector& EventTarget::getEventListeners(const AtomicString& eventType) { auto* data = eventTargetData(); auto* listenerVector = data ? data->eventListenerMap.find(eventType) : nullptr; static NeverDestroyed<EventListenerVector> emptyVector; return listenerVector ? *listenerVector : emptyVector.get(); }
static HashMap<void *, void *> * WebThreadGetObservedContentModifiers() { ASSERT(WebThreadIsLockedOrDisabled()); typedef HashMap<void *, void *> VoidVoidMap; static NeverDestroyed<VoidVoidMap> observedContentModifiers; return &observedContentModifiers.get(); }
static HashMap<SessionID, std::unique_ptr<NetworkStorageSession>>& staticSessionMap() { ASSERT(RunLoop::isMain()); static NeverDestroyed<HashMap<SessionID, std::unique_ptr<NetworkStorageSession>>> map; return map.get(); }
static inline HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType>& attributeNameToAnimatedPropertyTypeMap() { static NeverDestroyed<HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType>> map; if (map.get().isEmpty()) populateAttributeNameToAnimatedPropertyTypeMap(map); return map; }
EncodedJSValue JSC_HOST_CALL jsTestNondeterministicPrototypeFunctionNondeterministicZeroArgFunction(ExecState* state) { JSValue thisValue = state->thisValue(); auto castedThis = jsDynamicCast<JSTestNondeterministic*>(thisValue); if (UNLIKELY(!castedThis)) return throwThisTypeError(*state, "TestNondeterministic", "nondeterministicZeroArgFunction"); ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestNondeterministic::info()); auto& impl = castedThis->wrapped(); JSValue result; #if ENABLE(WEB_REPLAY) InputCursor& cursor = state->lexicalGlobalObject()->inputCursor(); static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicZeroArgFunction", AtomicString::ConstructFromLiteral); if (cursor.isCapturing()) { bool memoizedResult = impl.nondeterministicZeroArgFunction(); cursor.appendInput<MemoizedDOMResult<bool>>(bindingName.get().string(), memoizedResult, 0); result = jsBoolean(memoizedResult); } else if (cursor.isReplaying()) { MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); bool memoizedResult; if (input && input->convertTo<bool>(memoizedResult)) { result = jsBoolean(memoizedResult); } else result = jsBoolean(impl.nondeterministicZeroArgFunction()); } else result = jsBoolean(impl.nondeterministicZeroArgFunction()); #else result = jsBoolean(impl.nondeterministicZeroArgFunction()); #endif return JSValue::encode(result); }
static HashMap<const NetworkStorageSession*, SessionID>& storageSessionToID() { ASSERT(RunLoop::isMain()); static NeverDestroyed<HashMap<const NetworkStorageSession*, SessionID>> map; return map.get(); }
static inline HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType>& cssPropertyWithSVGDOMNameToAnimatedPropertyTypeMap() { static NeverDestroyed<HashMap<QualifiedName::QualifiedNameImpl*, AnimatedPropertyType>> map; if (map.get().isEmpty()) populateCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap(map); return map; }
EncodedJSValue jsTestNondeterministicNondeterministicSetterExceptionAttr(ExecState* state, EncodedJSValue thisValue, PropertyName) { UNUSED_PARAM(state); UNUSED_PARAM(thisValue); JSValue decodedThisValue = JSValue::decode(thisValue); auto* castedThis = jsDynamicCast<JSTestNondeterministic*>(decodedThisValue); if (UNLIKELY(!castedThis)) { return throwGetterTypeError(*state, "TestNondeterministic", "nondeterministicSetterExceptionAttr"); } #if ENABLE(WEB_REPLAY) JSGlobalObject* globalObject = state->lexicalGlobalObject(); InputCursor& cursor = globalObject->inputCursor(); static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicSetterExceptionAttr", AtomicString::ConstructFromLiteral); if (cursor.isCapturing()) { String memoizedResult = castedThis->wrapped().nondeterministicSetterExceptionAttr(); cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0); JSValue result = jsStringWithCache(state, memoizedResult); return JSValue::encode(result); } if (cursor.isReplaying()) { String memoizedResult; MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>(); if (input && input->convertTo<String>(memoizedResult)) { JSValue result = jsStringWithCache(state, memoizedResult); return JSValue::encode(result); } } #endif auto& impl = castedThis->wrapped(); JSValue result = jsStringWithCache(state, impl.nondeterministicSetterExceptionAttr()); return JSValue::encode(result); }
bool SVGFELightElement::isSupportedAttribute(const QualifiedName& attrName) { static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes; if (supportedAttributes.get().isEmpty()) { supportedAttributes.get().add(SVGNames::azimuthAttr); supportedAttributes.get().add(SVGNames::elevationAttr); supportedAttributes.get().add(SVGNames::xAttr); supportedAttributes.get().add(SVGNames::yAttr); supportedAttributes.get().add(SVGNames::zAttr); supportedAttributes.get().add(SVGNames::pointsAtXAttr); supportedAttributes.get().add(SVGNames::pointsAtYAttr); supportedAttributes.get().add(SVGNames::pointsAtZAttr); supportedAttributes.get().add(SVGNames::specularExponentAttr); supportedAttributes.get().add(SVGNames::limitingConeAngleAttr); } return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName); }
void WebEditorClient::didEndEditing() { static NeverDestroyed<String> WebViewDidEndEditingNotification(ASCIILiteral("WebViewDidEndEditingNotification")); #if ENABLE(INJECT_BUNDLE) m_page->injectedBundleEditorClient().didEndEditing(m_page, WebViewDidEndEditingNotification.get().impl()); notImplemented(); #endif }
static Vector<CDMFactory*>& installedCDMFactories() { static NeverDestroyed<Vector<CDMFactory*>> cdms; static bool queriedCDMs = false; if (!queriedCDMs) { queriedCDMs = true; // FIXME: initialize specific UA CDMs. http://webkit.org/b/109318, http://webkit.org/b/109320 cdms.get().append(new CDMFactory(CDMPrivateMediaPlayer::create, CDMPrivateMediaPlayer::supportsKeySystem, CDMPrivateMediaPlayer::supportsKeySystemAndMimeType)); #if PLATFORM(MAC) && ENABLE(MEDIA_SOURCE) cdms.get().append(new CDMFactory(CDMPrivateMediaSourceAVFObjC::create, CDMPrivateMediaSourceAVFObjC::supportsKeySystem, CDMPrivateMediaSourceAVFObjC::supportsKeySystemAndMimeType)); #endif } return cdms; }
void TextPainter::paintText() { FloatPoint boxOrigin = m_boxRect.location(); if (!m_paintSelectedTextOnly) { // For stroked painting, we have to change the text drawing mode. It's probably dangerous to leave that mutated as a side // effect, so only when we know we're stroking, do a save/restore. GraphicsContextStateSaver stateSaver(m_context, m_textPaintStyle.strokeWidth > 0); updateGraphicsContext(m_context, m_textPaintStyle); if (!m_paintSelectedTextSeparately || m_endPositionInTextRun <= m_startPositionInTextRun) { // FIXME: Truncate right-to-left text correctly. paintTextWithShadows(m_context, m_font, m_textRun, nullAtom, 0, 0, m_length, m_length, m_textOrigin, m_boxRect, m_textShadow, m_textPaintStyle.strokeWidth > 0, m_textBoxIsHorizontal); } else paintTextWithShadows(m_context, m_font, m_textRun, nullAtom, 0, m_endPositionInTextRun, m_startPositionInTextRun, m_length, m_textOrigin, m_boxRect, m_textShadow, m_textPaintStyle.strokeWidth > 0, m_textBoxIsHorizontal); if (!m_emphasisMark.isEmpty()) { updateGraphicsContext(m_context, m_textPaintStyle, UseEmphasisMarkColor); static NeverDestroyed<TextRun> objectReplacementCharacterTextRun(&objectReplacementCharacter, 1); TextRun& emphasisMarkTextRun = m_combinedText ? objectReplacementCharacterTextRun.get() : m_textRun; FloatPoint emphasisMarkTextOrigin = m_combinedText ? FloatPoint(boxOrigin.x() + m_boxRect.width() / 2, boxOrigin.y() + m_font.fontMetrics().ascent()) : m_textOrigin; if (m_combinedText) m_context.concatCTM(rotation(m_boxRect, Clockwise)); if (!m_paintSelectedTextSeparately || m_endPositionInTextRun <= m_startPositionInTextRun) { // FIXME: Truncate right-to-left text correctly. paintTextWithShadows(m_context, m_combinedText ? m_combinedText->originalFont() : m_font, emphasisMarkTextRun, m_emphasisMark, m_emphasisMarkOffset, 0, m_length, m_length, emphasisMarkTextOrigin, m_boxRect, m_textShadow, m_textPaintStyle.strokeWidth > 0, m_textBoxIsHorizontal); } else paintTextWithShadows(m_context, m_combinedText ? m_combinedText->originalFont() : m_font, emphasisMarkTextRun, m_emphasisMark, m_emphasisMarkOffset, m_endPositionInTextRun, m_startPositionInTextRun, m_length, emphasisMarkTextOrigin, m_boxRect, m_textShadow, m_textPaintStyle.strokeWidth > 0, m_textBoxIsHorizontal); if (m_combinedText) m_context.concatCTM(rotation(m_boxRect, Counterclockwise)); } } if ((m_paintSelectedTextOnly || m_paintSelectedTextSeparately) && m_startPositionInTextRun < m_endPositionInTextRun) { // paint only the text that is selected GraphicsContextStateSaver stateSaver(m_context, m_selectionPaintStyle.strokeWidth > 0); updateGraphicsContext(m_context, m_selectionPaintStyle); paintTextWithShadows(m_context, m_font, m_textRun, nullAtom, 0, m_startPositionInTextRun, m_endPositionInTextRun, m_length, m_textOrigin, m_boxRect, m_selectionShadow, m_selectionPaintStyle.strokeWidth > 0, m_textBoxIsHorizontal); if (!m_emphasisMark.isEmpty()) { updateGraphicsContext(m_context, m_selectionPaintStyle, UseEmphasisMarkColor); DEPRECATED_DEFINE_STATIC_LOCAL(TextRun, objectReplacementCharacterTextRun, (&objectReplacementCharacter, 1)); TextRun& emphasisMarkTextRun = m_combinedText ? objectReplacementCharacterTextRun : m_textRun; FloatPoint emphasisMarkTextOrigin = m_combinedText ? FloatPoint(boxOrigin.x() + m_boxRect.width() / 2, boxOrigin.y() + m_font.fontMetrics().ascent()) : m_textOrigin; if (m_combinedText) m_context.concatCTM(rotation(m_boxRect, Clockwise)); paintTextWithShadows(m_context, m_combinedText ? m_combinedText->originalFont() : m_font, emphasisMarkTextRun, m_emphasisMark, m_emphasisMarkOffset, m_startPositionInTextRun, m_endPositionInTextRun, m_length, emphasisMarkTextOrigin, m_boxRect, m_selectionShadow, m_selectionPaintStyle.strokeWidth > 0, m_textBoxIsHorizontal); if (m_combinedText) m_context.concatCTM(rotation(m_boxRect, Counterclockwise)); } } }
void fillWithEmptyClients(Page::PageClients& pageClients) { static NeverDestroyed<EmptyChromeClient> dummyChromeClient; pageClients.chromeClient = &dummyChromeClient.get(); #if ENABLE(CONTEXT_MENUS) static NeverDestroyed<EmptyContextMenuClient> dummyContextMenuClient; pageClients.contextMenuClient = &dummyContextMenuClient.get(); #endif #if ENABLE(DRAG_SUPPORT) static NeverDestroyed<EmptyDragClient> dummyDragClient; pageClients.dragClient = &dummyDragClient.get(); #endif static NeverDestroyed<EmptyEditorClient> dummyEditorClient; pageClients.editorClient = &dummyEditorClient.get(); #if ENABLE(INSPECTOR) static NeverDestroyed<EmptyInspectorClient> dummyInspectorClient; pageClients.inspectorClient = &dummyInspectorClient.get(); #endif static NeverDestroyed<EmptyFrameLoaderClient> dummyFrameLoaderClient; pageClients.loaderClientForMainFrame = &dummyFrameLoaderClient.get(); static NeverDestroyed<EmptyProgressTrackerClient> dummyProgressTrackerClient; pageClients.progressTrackerClient = &dummyProgressTrackerClient.get(); }