本文整理汇总了C++中QualifiedName::namespaceURI方法的典型用法代码示例。如果您正苦于以下问题:C++ QualifiedName::namespaceURI方法的具体用法?C++ QualifiedName::namespaceURI怎么用?C++ QualifiedName::namespaceURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QualifiedName
的用法示例。
在下文中一共展示了QualifiedName::namespaceURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
PassRefPtr<Element> CustomElementRegistry::createCustomTagElement(const QualifiedName& tagName)
{
if (!document())
return 0;
ASSERT(isCustomTagName(tagName.localName()));
RefPtr<Element> element;
if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI())
element = HTMLElement::create(tagName, document());
else if (SVGNames::svgNamespaceURI == tagName.namespaceURI())
element = SVGElement::create(tagName, document());
else
return Element::create(tagName, document());
element->setIsCustomElement();
RefPtr<CustomElementDefinition> definition = findAndCheckNamespace(tagName.localName(), tagName.namespaceURI());
if (!definition || definition->isTypeExtension()) {
// If a definition for a type extension was available, this
// custom tag element will be unresolved in perpetuity.
didCreateUnresolvedElement(CustomElementDefinition::CustomTag, tagName.localName(), element.get());
} else {
didCreateCustomTagElement(definition.get(), element.get());
}
return element.release();
}
示例2: registerElement
void CustomElementRegistry::registerElement(CustomElementConstructorBuilder* constructorBuilder, const AtomicString& userSuppliedName, ExceptionCode& ec)
{
RefPtr<CustomElementRegistry> protect(this);
if (!constructorBuilder->isFeatureAllowed())
return;
AtomicString type = userSuppliedName.lower();
if (!isValidName(type)) {
ec = INVALID_CHARACTER_ERR;
return;
}
if (!constructorBuilder->validateOptions()) {
ec = INVALID_STATE_ERR;
return;
}
QualifiedName tagName = nullQName();
if (!constructorBuilder->findTagName(type, tagName)) {
ec = NAMESPACE_ERR;
return;
}
ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.namespaceURI() == SVGNames::svgNamespaceURI);
if (m_definitions.contains(type)) {
ec = INVALID_STATE_ERR;
return;
}
RefPtr<CustomElementCallback> lifecycleCallbacks = constructorBuilder->createCallback(document());
// Consulting the constructor builder could execute script and
// kill the document.
if (!document()) {
ec = INVALID_STATE_ERR;
return;
}
RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create(type, tagName.localName(), tagName.namespaceURI(), lifecycleCallbacks);
if (!constructorBuilder->createConstructor(document(), definition.get())) {
ec = NOT_SUPPORTED_ERR;
return;
}
m_definitions.add(definition->type(), definition);
// Upgrade elements that were waiting for this definition.
CustomElementUpgradeCandidateMap::ElementSet upgradeCandidates = m_candidates.takeUpgradeCandidatesFor(definition.get());
constructorBuilder->didRegisterDefinition(definition.get(), upgradeCandidates);
for (CustomElementUpgradeCandidateMap::ElementSet::iterator it = upgradeCandidates.begin(); it != upgradeCandidates.end(); ++it) {
(*it)->setNeedsStyleRecalc(); // :unresolved has changed
enqueueReadyCallback(lifecycleCallbacks.get(), *it);
}
}
示例3: registerElement
CustomElementDefinition* CustomElementRegistry::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& userSuppliedName, CustomElement::NameSet validNames, ExceptionState& exceptionState)
{
AtomicString type = userSuppliedName.lower();
if (!constructorBuilder->isFeatureAllowed()) {
CustomElementException::throwException(CustomElementException::CannotRegisterFromExtension, type, exceptionState);
return 0;
}
if (!CustomElement::isValidName(type, validNames)) {
CustomElementException::throwException(CustomElementException::InvalidName, type, exceptionState);
return 0;
}
if (m_registeredTypeNames.contains(type)) {
CustomElementException::throwException(CustomElementException::TypeAlreadyRegistered, type, exceptionState);
return 0;
}
QualifiedName tagName = QualifiedName::null();
if (!constructorBuilder->validateOptions(type, tagName, exceptionState))
return 0;
ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.namespaceURI() == SVGNames::svgNamespaceURI);
ASSERT(!m_documentWasDetached);
RefPtrWillBeRawPtr<CustomElementLifecycleCallbacks> lifecycleCallbacks = constructorBuilder->createCallbacks();
// Consulting the constructor builder could execute script and
// kill the document.
if (m_documentWasDetached) {
CustomElementException::throwException(CustomElementException::ContextDestroyedCreatingCallbacks, type, exceptionState);
return 0;
}
const CustomElementDescriptor descriptor(type, tagName.namespaceURI(), tagName.localName());
RefPtrWillBeRawPtr<CustomElementDefinition> definition = CustomElementDefinition::create(descriptor, lifecycleCallbacks);
if (!constructorBuilder->createConstructor(document, definition.get(), exceptionState))
return 0;
m_definitions.add(descriptor, definition);
m_registeredTypeNames.add(descriptor.type());
if (!constructorBuilder->didRegisterDefinition(definition.get())) {
CustomElementException::throwException(CustomElementException::ContextDestroyedRegisteringDefinition, type, exceptionState);
return 0;
}
return definition.get();
}
示例4: create
PassRefPtrWillBeRawPtr<Element> CustomElementRegistrationContext::createCustomTagElement(Document& document, const QualifiedName& tagName)
{
ASSERT(CustomElement::isValidName(tagName.localName()));
RefPtrWillBeRawPtr<Element> element;
if (HTMLNames::xhtmlNamespaceURI == tagName.namespaceURI()) {
element = HTMLElement::create(tagName, document);
} else if (SVGNames::svgNamespaceURI == tagName.namespaceURI()) {
element = SVGUnknownElement::create(tagName, document);
} else {
// XML elements are not custom elements, so return early.
return Element::create(tagName, &document);
}
element->setCustomElementState(Element::WaitingForUpgrade);
resolveOrScheduleResolution(element.get(), nullAtom);
return element.release();
}
示例5: isCaseSensitiveAttribute
bool HTMLDocument::isCaseSensitiveAttribute(
const QualifiedName& attributeName) {
static HashSet<StringImpl*>* htmlCaseInsensitiveAttributesSet =
createHtmlCaseInsensitiveAttributesSet();
bool isPossibleHTMLAttr =
!attributeName.hasPrefix() && (attributeName.namespaceURI() == nullAtom);
return !isPossibleHTMLAttr ||
!htmlCaseInsensitiveAttributesSet->contains(
attributeName.localName().impl());
}
示例6: cssPropertyIdForSVGAttributeName
CSSPropertyID SVGElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
{
if (!attrName.namespaceURI().isNull())
return CSSPropertyInvalid;
static NeverDestroyed<HashMap<AtomicStringImpl*, CSSPropertyID>> properties;
if (properties.get().isEmpty())
populateAttributeNameToCSSPropertyIDMap(properties.get());
return properties.get().get(attrName.localName().impl());
}
示例7: setTypeExtension
PassRefPtr<Element> CustomElementRegistry::createElement(const QualifiedName& localName, const AtomicString& typeExtension) const
{
const QualifiedName& typeName = QualifiedName(nullAtom, typeExtension, localName.namespaceURI());
if (RefPtr<CustomElementConstructor> found = find(typeName, localName)) {
RefPtr<Element> created = found->createElement();
if (!typeName.localName().isEmpty() && localName != typeName)
return setTypeExtension(created, typeExtension);
return created.release();
}
return 0;
}
示例8: findAttributeWithName
static bool findAttributeWithName(const HTMLToken& token, const QualifiedName& name, size_t& indexOfMatchingAttribute)
{
// Notice that we're careful not to ref the StringImpl here because we might be on a background thread.
const String& attrName = name.namespaceURI() == XLinkNames::xlinkNamespaceURI ? "xlink:" + name.localName().string() : name.localName().string();
for (size_t i = 0; i < token.attributes().size(); ++i) {
if (equalIgnoringNullity(token.attributes().at(i).name, attrName)) {
indexOfMatchingAttribute = i;
return true;
}
}
return false;
}
示例9: collectElementsByTagName
void SelectorDataList::collectElementsByTagName(ContainerNode& rootNode, const QualifiedName& tagName, typename SelectorQueryTrait::OutputType& output) const
{
for (Element& element : ElementTraversal::descendantsOf(rootNode)) {
// querySelector*() doesn't allow namespaces and throws before it gets
// here so we can ignore them.
ASSERT(tagName.namespaceURI() == starAtom);
if (matchesTagName(tagName, element)) {
SelectorQueryTrait::appendElement(output, element);
if (SelectorQueryTrait::shouldOnlyMatchFirstElement)
return;
}
}
}
示例10: cssPropertyIdForFontFaceAttributeName
static CSSPropertyID cssPropertyIdForFontFaceAttributeName(const QualifiedName& attrName)
{
if (!attrName.namespaceURI().isNull())
return CSSPropertyInvalid;
static HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap = 0;
if (!propertyNameToIdMap) {
propertyNameToIdMap = new HashMap<StringImpl*, CSSPropertyID>;
// This is a list of all @font-face CSS properties which are exposed as SVG XML attributes
// Those commented out are not yet supported by WebCore's style system
// mapAttributeToCSSProperty(propertyNameToIdMap, accent_heightAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, alphabeticAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, ascentAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, bboxAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, cap_heightAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, descentAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, font_familyAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, font_sizeAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, font_stretchAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, font_styleAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, font_variantAttr);
mapAttributeToCSSProperty(propertyNameToIdMap, font_weightAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, hangingAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, ideographicAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, mathematicalAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, overline_positionAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, overline_thicknessAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, panose_1Attr);
// mapAttributeToCSSProperty(propertyNameToIdMap, slopeAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, stemhAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, stemvAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_positionAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_thicknessAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, underline_positionAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, underline_thicknessAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, unicode_rangeAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, units_per_emAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, v_alphabeticAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, v_hangingAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, v_ideographicAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, v_mathematicalAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, widthsAttr);
// mapAttributeToCSSProperty(propertyNameToIdMap, x_heightAttr);
}
return propertyNameToIdMap->get(attrName.localName().impl());
}
示例11: runAttributeChangedCallback
void ScriptCustomElementDefinition::runAttributeChangedCallback(
Element* element,
const QualifiedName& name,
const AtomicString& oldValue,
const AtomicString& newValue) {
if (!m_scriptState->contextIsValid())
return;
ScriptState::Scope scope(m_scriptState.get());
v8::Isolate* isolate = m_scriptState->isolate();
v8::Local<v8::Value> argv[] = {
v8String(isolate, name.localName()), v8StringOrNull(isolate, oldValue),
v8StringOrNull(isolate, newValue),
v8StringOrNull(isolate, name.namespaceURI()),
};
runCallback(m_attributeChangedCallback.newLocal(isolate), element,
WTF_ARRAY_LENGTH(argv), argv);
}
示例12: appendAttribute
void MarkupAccumulator::appendAttribute(StringBuilder& result, const Element& element, const Attribute& attribute, Namespaces* namespaces)
{
bool documentIsHTML = element.document().isHTMLDocument();
result.append(' ');
QualifiedName prefixedName = attribute.name();
if (documentIsHTML && !attributeIsInSerializedNamespace(attribute))
result.append(attribute.name().localName());
else {
if (!attribute.namespaceURI().isEmpty()) {
AtomicStringImpl* foundNS = namespaces && attribute.prefix().impl() ? namespaces->get(attribute.prefix().impl()) : 0;
bool prefixIsAlreadyMappedToOtherNS = foundNS && foundNS != attribute.namespaceURI().impl();
if (attribute.prefix().isEmpty() || !foundNS || prefixIsAlreadyMappedToOtherNS) {
if (AtomicStringImpl* prefix = namespaces ? namespaces->get(attribute.namespaceURI().impl()) : 0)
prefixedName.setPrefix(AtomicString(prefix));
else {
bool shouldBeDeclaredUsingAppendNamespace = !attribute.prefix().isEmpty() && !foundNS;
if (!shouldBeDeclaredUsingAppendNamespace && attribute.localName() != xmlnsAtom && namespaces)
generateUniquePrefix(prefixedName, *namespaces);
}
}
}
result.append(prefixedName.toString());
}
result.append('=');
if (element.isURLAttribute(attribute))
appendQuotedURLAttributeValue(result, element, attribute);
else {
result.append('"');
appendAttributeValue(result, attribute.value(), documentIsHTML);
result.append('"');
}
if ((inXMLFragmentSerialization() || !documentIsHTML) && namespaces && shouldAddNamespaceAttribute(attribute, *namespaces))
appendNamespace(result, prefixedName.prefix(), prefixedName.namespaceURI(), *namespaces);
}
示例13: appendAttribute
void MarkupAccumulator::appendAttribute(StringBuilder& result, const Element& element, const Attribute& attribute, Namespaces* namespaces)
{
bool documentIsHTML = serializeAsHTMLDocument(element);
result.append(' ');
QualifiedName prefixedName = attribute.name();
if (documentIsHTML && !attributeIsInSerializedNamespace(attribute)) {
result.append(attribute.name().localName());
} else {
if (attribute.namespaceURI() == XLinkNames::xlinkNamespaceURI) {
if (!attribute.prefix())
prefixedName.setPrefix(xlinkAtom);
} else if (attribute.namespaceURI() == XMLNames::xmlNamespaceURI) {
if (!attribute.prefix())
prefixedName.setPrefix(xmlAtom);
} else if (attribute.namespaceURI() == XMLNSNames::xmlnsNamespaceURI) {
if (attribute.name() != XMLNSNames::xmlnsAttr && !attribute.prefix())
prefixedName.setPrefix(xmlnsAtom);
}
result.append(prefixedName.toString());
}
result.append('=');
if (element.isURLAttribute(attribute)) {
appendQuotedURLAttributeValue(result, element, attribute);
} else {
result.append('"');
appendAttributeValue(result, attribute.value(), documentIsHTML);
result.append('"');
}
if (!documentIsHTML && namespaces && shouldAddNamespaceAttribute(attribute, *namespaces))
appendNamespace(result, prefixedName.prefix(), prefixedName.namespaceURI(), *namespaces);
}
示例14: hasAttribute
bool Element::hasAttribute(const QualifiedName& name) const
{
return hasAttributeNS(name.namespaceURI(), name.localName());
}
示例15: cssPropertyIdForSVGAttributeName
CSSPropertyID SVGElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
{
if (!attrName.namespaceURI().isNull())
return CSSPropertyInvalid;
static HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap = 0;
if (!propertyNameToIdMap) {
propertyNameToIdMap = new HashMap<StringImpl*, CSSPropertyID>;
// This is a list of all base CSS and SVG CSS properties which are exposed as SVG XML attributes
const QualifiedName* const attrNames[] = {
&alignment_baselineAttr,
&baseline_shiftAttr,
&buffered_renderingAttr,
&clipAttr,
&clip_pathAttr,
&clip_ruleAttr,
&SVGNames::colorAttr,
&color_interpolationAttr,
&color_interpolation_filtersAttr,
&color_renderingAttr,
&cursorAttr,
&SVGNames::directionAttr,
&displayAttr,
&dominant_baselineAttr,
&fillAttr,
&fill_opacityAttr,
&fill_ruleAttr,
&filterAttr,
&flood_colorAttr,
&flood_opacityAttr,
&font_familyAttr,
&font_sizeAttr,
&font_stretchAttr,
&font_styleAttr,
&font_variantAttr,
&font_weightAttr,
&image_renderingAttr,
&letter_spacingAttr,
&lighting_colorAttr,
&marker_endAttr,
&marker_midAttr,
&marker_startAttr,
&maskAttr,
&mask_typeAttr,
&opacityAttr,
&overflowAttr,
&paint_orderAttr,
&pointer_eventsAttr,
&shape_renderingAttr,
&stop_colorAttr,
&stop_opacityAttr,
&strokeAttr,
&stroke_dasharrayAttr,
&stroke_dashoffsetAttr,
&stroke_linecapAttr,
&stroke_linejoinAttr,
&stroke_miterlimitAttr,
&stroke_opacityAttr,
&stroke_widthAttr,
&text_anchorAttr,
&text_decorationAttr,
&text_renderingAttr,
&transform_originAttr,
&unicode_bidiAttr,
&vector_effectAttr,
&visibilityAttr,
&word_spacingAttr,
&writing_modeAttr,
};
for (size_t i = 0; i < WTF_ARRAY_LENGTH(attrNames); i++) {
CSSPropertyID propertyId = cssPropertyID(attrNames[i]->localName());
ASSERT(propertyId > 0);
propertyNameToIdMap->set(attrNames[i]->localName().impl(), propertyId);
}
}
return propertyNameToIdMap->get(attrName.localName().impl());
}