diff options
Diffstat (limited to 'Source/WebCore/html/HTMLAllCollection.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLAllCollection.cpp | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/Source/WebCore/html/HTMLAllCollection.cpp b/Source/WebCore/html/HTMLAllCollection.cpp index 1812ab176..13d8de770 100644 --- a/Source/WebCore/html/HTMLAllCollection.cpp +++ b/Source/WebCore/html/HTMLAllCollection.cpp @@ -30,36 +30,41 @@ namespace WebCore { -PassRef<HTMLAllCollection> HTMLAllCollection::create(Document& document, CollectionType type) +Ref<HTMLAllCollection> HTMLAllCollection::create(Document& document, CollectionType type) { return adoptRef(*new HTMLAllCollection(document, type)); } -HTMLAllCollection::HTMLAllCollection(Document& document, CollectionType type) - : HTMLCollection(document, type) +inline HTMLAllCollection::HTMLAllCollection(Document& document, CollectionType type) + : AllDescendantsCollection(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; +} + +RefPtr<NodeList> HTMLAllCollection::tags(const String& name) +{ + if (name.isNull()) + return nullptr; + + return ownerNode().getElementsByTagName(name); } } // namespace WebCore |