const AtomicString& CSSStyleSheet::determineNamespace(const AtomicString& prefix) { if (prefix.isNull()) return nullAtom; // No namespace. If an element/attribute has a namespace, we won't match it. if (prefix == starAtom) return starAtom; // We'll match any namespace. if (m_namespaces) { CSSNamespace* ns = m_namespaces->namespaceForPrefix(prefix); if (ns) return ns->uri(); } return nullAtom; // Assume we wont match any namespaces. }
void CSSStyleSheetImpl::determineNamespace(Q_UINT32& id, const DOM::DOMString& prefix) { // If the stylesheet has no namespaces we can just return. There won't be any need to ever check // namespace values in selectors. if (!m_namespaces) return; if (prefix.isEmpty()) id = makeId(noNamespace, localNamePart(id)); // No namespace. If an element/attribute has a namespace, we won't match it. else if (prefix == "*") id = makeId(anyNamespace, localNamePart(id)); // We'll match any namespace. else { CSSNamespace* ns = m_namespaces->namespaceForPrefix(prefix); if (ns) // Look up the id for this namespace URI. id = makeId(XmlNamespaceTable::getNamespaceID(ns->uri(), false), localNamePart(id)); } }
void CSSStyleSheetImpl::determineNamespace(Q_UINT32& id, const DOM::DOMString& prefix) { // If the stylesheet has no namespaces we can just return. There won't be any need to ever check // namespace values in selectors. if (!m_namespaces) return; if (prefix.isEmpty()) id = makeId(emptyNamespace, localNamePart(id)); // No namespace. If an element/attribute has a namespace, we won't match it. else if (prefix == "*") id = makeId(anyNamespace, localNamePart(id)); // We'll match any namespace. else { int exceptioncode = 0; CSSNamespace* ns = m_namespaces->namespaceForPrefix(prefix); if (ns) { Q_ASSERT(m_doc != 0); // Look up the id for this namespace URI. Q_UINT16 nsid = m_doc->getId(NodeImpl::NamespaceId, 0, 0, ns->uri().implementation(), false, false, &exceptioncode); id = makeId(nsid, localNamePart(id)); } } }