summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLAllCollection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/html/HTMLAllCollection.cpp')
-rw-r--r--Source/WebCore/html/HTMLAllCollection.cpp33
1 files changed, 15 insertions, 18 deletions
diff --git a/Source/WebCore/html/HTMLAllCollection.cpp b/Source/WebCore/html/HTMLAllCollection.cpp
index 465fa1c7b..dab0500fa 100644
--- a/Source/WebCore/html/HTMLAllCollection.cpp
+++ b/Source/WebCore/html/HTMLAllCollection.cpp
@@ -30,36 +30,33 @@
namespace WebCore {
-PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(Node* node, CollectionType type)
+Ref<HTMLAllCollection> HTMLAllCollection::create(Document& document, CollectionType type)
{
- return adoptRef(new HTMLAllCollection(node, type));
+ return adoptRef(*new HTMLAllCollection(document, type));
}
-HTMLAllCollection::HTMLAllCollection(Node* node, CollectionType type)
- : HTMLCollection(node, type, DoesNotOverrideItemAfter)
+inline HTMLAllCollection::HTMLAllCollection(Document& document, CollectionType type)
+ : CachedHTMLCollection<HTMLAllCollection, CollectionTypeTraits<DocAll>::traversalType>(document, type)
{
}
-HTMLAllCollection::~HTMLAllCollection()
+Element* HTMLAllCollection::namedItemWithIndex(const AtomicString& name, unsigned index) const
{
-}
-
-Node* HTMLAllCollection::namedItemWithIndex(const AtomicString& name, unsigned index) const
-{
- updateNameCache();
+ updateNamedElementCache();
+ const CollectionNamedElementCache& cache = namedItemCaches();
- if (Vector<Element*>* cache = idCache(name)) {
- if (index < cache->size())
- return cache->at(index);
- index -= cache->size();
+ if (const Vector<Element*>* elements = cache.findElementsWithId(name)) {
+ if (index < elements->size())
+ return elements->at(index);
+ index -= elements->size();
}
- if (Vector<Element*>* cache = nameCache(name)) {
- if (index < cache->size())
- return cache->at(index);
+ if (const Vector<Element*>* elements = cache.findElementsWithName(name)) {
+ if (index < elements->size())
+ return elements->at(index);
}
- return 0;
+ return nullptr;
}
} // namespace WebCore