void CSSStyleSheetImpl::addNamespace(CSSParser* p, const DOM::DOMString& prefix, const DOM::DOMString& uri)
{
    if (uri.isEmpty())
        return;

    m_namespaces = new CSSNamespace(prefix, uri, m_namespaces);
    
    if (prefix.isEmpty())
        // Set the default namespace on the parser so that selectors that omit namespace info will
        // be able to pick it up easily.
        p->defaultNamespace = XmlNamespaceTable::getNamespaceID(uri, false);
}
Exemple #2
0
void CSSStyleSheetImpl::addNamespace(CSSParser* p, const DOM::DOMString& prefix, const DOM::DOMString& uri)
{
    int exceptioncode = 0;
    if (uri.isEmpty())
        return;

    m_namespaces = new CSSNamespace(prefix, uri, m_namespaces);

    if (prefix.isEmpty()) {
        Q_ASSERT(m_doc != 0);

        m_defaultNamespace = m_doc->getId(NodeImpl::NamespaceId, uri.implementation(), false, false, &exceptioncode);
    }
}
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));
    }
}
Exemple #4
0
void CSSStyleSheetImpl::determineNamespace(NamespaceName &namespacename, const DOM::DOMString &prefix)
{
    if (prefix.isEmpty()) {
        namespacename = NamespaceName::fromId(emptyNamespace);    // No namespace. If an element/attribute has a namespace, we won't match it.
    } else if (prefix == "*") {
        namespacename = NamespaceName::fromId(anyNamespace);    // We'll match any namespace.
    } else {
        if (!m_namespaces) {
            recomputeNamespaceInfo();
        }

        // To lookup the name, we go backwards, so the latest one wins
        for (int p = m_namespaces->count() - 1; p >= 0; --p) {
            CSSNamespaceRuleImpl *ns = m_namespaces->at(p);
            if (ns->prefix() == prefix) {
                namespacename = NamespaceName::fromString(ns->namespaceURI());
                return;
            }
        }
    }
}
Exemple #5
0
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));
        }
    }
}