diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
commit | 881da28418d380042aa95a97f0cbd42560a64f7c (patch) | |
tree | a794dff3274695e99c651902dde93d934ea7a5af /Source/WebCore/html/HTMLAllCollection.cpp | |
parent | 7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff) | |
parent | 0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff) | |
download | qtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz |
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
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 |