Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(856)

Unified Diff: Source/core/dom/NodeRareData.h

Issue 143453010: Have getElementsByClassName() / getElementsByTagName*() return an HTMLCollection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/TagCollection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/NodeRareData.h
diff --git a/Source/core/dom/NodeRareData.h b/Source/core/dom/NodeRareData.h
index 9b4c989f9fc082c52abc3ec892e54bd559ffae25..403a0b2cc7492bba5265d8653d530301231c13e1 100644
--- a/Source/core/dom/NodeRareData.h
+++ b/Source/core/dom/NodeRareData.h
@@ -27,7 +27,7 @@
#include "core/dom/LiveNodeList.h"
#include "core/dom/MutationObserverRegistration.h"
#include "core/dom/QualifiedName.h"
-#include "core/dom/TagNodeList.h"
+#include "core/dom/TagCollection.h"
#include "core/page/Page.h"
#include "wtf/HashSet.h"
#include "wtf/OwnPtr.h"
@@ -96,7 +96,7 @@ public:
typedef HashMap<std::pair<unsigned char, AtomicString>, LiveNodeListBase*, NodeListCacheMapEntryHash<AtomicString> > NodeListAtomicNameCacheMap;
typedef HashMap<std::pair<unsigned char, String>, LiveNodeListBase*, NodeListCacheMapEntryHash<String> > NodeListNameCacheMap;
- typedef HashMap<QualifiedName, TagNodeList*> TagNodeListCacheNS;
+ typedef HashMap<QualifiedName, TagCollection*> TagCollectionCacheNS;
template<typename T>
PassRefPtr<T> addCacheWithAtomicName(ContainerNode* node, CollectionType collectionType, const AtomicString& name)
@@ -141,14 +141,14 @@ public:
return list.release();
}
- PassRefPtr<TagNodeList> addCacheWithQualifiedName(ContainerNode* node, const AtomicString& namespaceURI, const AtomicString& localName)
+ PassRefPtr<TagCollection> addCacheWithQualifiedName(ContainerNode* node, const AtomicString& namespaceURI, const AtomicString& localName)
{
QualifiedName name(nullAtom, localName, namespaceURI);
- TagNodeListCacheNS::AddResult result = m_tagNodeListCacheNS.add(name, 0);
+ TagCollectionCacheNS::AddResult result = m_tagCollectionCacheNS.add(name, 0);
if (!result.isNewEntry)
return result.iterator->value;
- RefPtr<TagNodeList> list = TagNodeList::create(node, namespaceURI, localName);
+ RefPtr<TagCollection> list = TagCollection::create(node, namespaceURI, localName);
result.iterator->value = list.get();
return list.release();
}
@@ -169,13 +169,13 @@ public:
m_nameCaches.remove(namedNodeListKey(collectionType, name));
}
- void removeCacheWithQualifiedName(LiveNodeList* list, const AtomicString& namespaceURI, const AtomicString& localName)
+ void removeCacheWithQualifiedName(LiveNodeListBase* list, const AtomicString& namespaceURI, const AtomicString& localName)
{
QualifiedName name(nullAtom, localName, namespaceURI);
- ASSERT(list == m_tagNodeListCacheNS.get(name));
+ ASSERT(list == m_tagCollectionCacheNS.get(name));
if (deleteThisAndUpdateNodeRareDataIfAboutToRemoveLastList(list->ownerNode()))
return;
- m_tagNodeListCacheNS.remove(name);
+ m_tagCollectionCacheNS.remove(name);
}
static PassOwnPtr<NodeListsNodeData> create()
@@ -186,7 +186,7 @@ public:
void invalidateCaches(const QualifiedName* attrName = 0);
bool isEmpty() const
{
- return m_atomicNameCaches.isEmpty() && m_nameCaches.isEmpty() && m_tagNodeListCacheNS.isEmpty();
+ return m_atomicNameCaches.isEmpty() && m_nameCaches.isEmpty() && m_tagCollectionCacheNS.isEmpty();
}
void adoptTreeScope()
@@ -213,8 +213,8 @@ public:
newDocument.registerNodeList(list);
}
- TagNodeListCacheNS::const_iterator tagEnd = m_tagNodeListCacheNS.end();
- for (TagNodeListCacheNS::const_iterator it = m_tagNodeListCacheNS.begin(); it != tagEnd; ++it) {
+ TagCollectionCacheNS::const_iterator tagEnd = m_tagCollectionCacheNS.end();
+ for (TagCollectionCacheNS::const_iterator it = m_tagCollectionCacheNS.begin(); it != tagEnd; ++it) {
LiveNodeListBase* list = it->value;
ASSERT(!list->isRootedAtDocument());
oldDocument.unregisterNodeList(list);
@@ -244,7 +244,7 @@ private:
NodeList* m_childNodeList;
NodeListAtomicNameCacheMap m_atomicNameCaches;
NodeListNameCacheMap m_nameCaches;
- TagNodeListCacheNS m_tagNodeListCacheNS;
+ TagCollectionCacheNS m_tagCollectionCacheNS;
};
class NodeMutationObserverData {
@@ -310,7 +310,7 @@ inline bool NodeListsNodeData::deleteThisAndUpdateNodeRareDataIfAboutToRemoveLas
{
ASSERT(ownerNode);
ASSERT(ownerNode->nodeLists() == this);
- if ((m_childNodeList ? 1 : 0) + m_atomicNameCaches.size() + m_nameCaches.size() + m_tagNodeListCacheNS.size() != 1)
+ if ((m_childNodeList ? 1 : 0) + m_atomicNameCaches.size() + m_nameCaches.size() + m_tagCollectionCacheNS.size() != 1)
return false;
ownerNode->clearNodeLists();
return true;
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/TagCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698