diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebCore/html/HTMLAllCollection.cpp | |
parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebCore/html/HTMLAllCollection.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLAllCollection.cpp | 33 |
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 |