summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLAllCollection.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/HTMLAllCollection.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/html/HTMLAllCollection.cpp')
-rw-r--r--Source/WebCore/html/HTMLAllCollection.cpp39
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