diff options
Diffstat (limited to 'Source/WebCore/dom/TagNodeList.cpp')
-rw-r--r-- | Source/WebCore/dom/TagNodeList.cpp | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/Source/WebCore/dom/TagNodeList.cpp b/Source/WebCore/dom/TagNodeList.cpp index 4914e09..df51fe1 100644 --- a/Source/WebCore/dom/TagNodeList.cpp +++ b/Source/WebCore/dom/TagNodeList.cpp @@ -4,6 +4,7 @@ * (C) 2001 Dirk Mueller (mueller@kde.org) * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2012 The Linux Foundation All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -29,25 +30,45 @@ namespace WebCore { -TagNodeList::TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName) +TagNodeListNS::TagNodeListNS(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName) : DynamicNodeList(rootNode) , m_namespaceURI(namespaceURI) , m_localName(localName) + , m_isStarAtomNamespaceURI(m_namespaceURI == starAtom) + , m_isStarAtomlocalName(m_localName == starAtom) { ASSERT(m_namespaceURI.isNull() || !m_namespaceURI.isEmpty()); } -TagNodeList::~TagNodeList() +TagNodeListNS::~TagNodeListNS() { - m_rootNode->removeCachedTagNodeList(this, QualifiedName(nullAtom, m_localName, m_namespaceURI)); -} + m_rootNode->removeCachedTagNodeListNS(this, QualifiedName(nullAtom, m_localName, m_namespaceURI)); +} -bool TagNodeList::nodeMatches(Element* testNode) const +bool TagNodeListNS::nodeMatches(Element* testNode) const { - if (m_namespaceURI != starAtom && m_namespaceURI != testNode->namespaceURI()) + if (!m_isStarAtomNamespaceURI && m_namespaceURI != testNode->namespaceURI()) return false; - return m_localName == starAtom || m_localName == testNode->localName(); + return m_isStarAtomlocalName || m_localName == testNode->localName(); } +TagNodeList::TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& localName) + : DynamicNodeList(rootNode) + , m_localName(localName) + , m_isStarAtomlocalName(m_localName == starAtom) +{ +} + +TagNodeList::~TagNodeList() +{ + m_rootNode->removeCachedTagNodeList(this, m_localName); +} + +bool TagNodeList::nodeMatches(Element* testNode) const +{ + return m_isStarAtomlocalName || m_localName == testNode->localName(); +} + + } // namespace WebCore |