From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/WebCore/html/HTMLAllCollection.cpp | 39 +++++++++++++++++-------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'Source/WebCore/html/HTMLAllCollection.cpp') 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::create(Document& document, CollectionType type) +Ref 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* cache = idCache(name)) { - if (index < cache->size()) - return cache->at(index); - index -= cache->size(); + if (const Vector* elements = cache.findElementsWithId(name)) { + if (index < elements->size()) + return elements->at(index); + index -= elements->size(); } - if (Vector* cache = nameCache(name)) { - if (index < cache->size()) - return cache->at(index); + if (const Vector* elements = cache.findElementsWithName(name)) { + if (index < elements->size()) + return elements->at(index); } - return 0; + return nullptr; +} + +RefPtr HTMLAllCollection::tags(const String& name) +{ + if (name.isNull()) + return nullptr; + + return ownerNode().getElementsByTagName(name); } } // namespace WebCore -- cgit v1.2.1