diff options
Diffstat (limited to 'Source/WebCore/dom/ChildNodeList.h')
-rw-r--r-- | Source/WebCore/dom/ChildNodeList.h | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/Source/WebCore/dom/ChildNodeList.h b/Source/WebCore/dom/ChildNodeList.h index 2454e8e0c..818227aa8 100644 --- a/Source/WebCore/dom/ChildNodeList.h +++ b/Source/WebCore/dom/ChildNodeList.h @@ -21,13 +21,11 @@ * */ -#ifndef ChildNodeList_h -#define ChildNodeList_h +#pragma once #include "CollectionIndexCache.h" #include "NodeList.h" #include <wtf/Ref.h> -#include <wtf/RefPtr.h> namespace WebCore { @@ -35,59 +33,59 @@ class ContainerNode; class EmptyNodeList final : public NodeList { public: - static PassRefPtr<EmptyNodeList> create(Node& owner) + static Ref<EmptyNodeList> create(Node& owner) { - return adoptRef(new EmptyNodeList(owner)); + return adoptRef(*new EmptyNodeList(owner)); } virtual ~EmptyNodeList(); - Node& ownerNode() { return m_owner.get(); } + Node& ownerNode() { return m_owner; } private: explicit EmptyNodeList(Node& owner) : m_owner(owner) { } - virtual unsigned length() const override { return 0; } - virtual Node* item(unsigned) const override { return nullptr; } - virtual Node* namedItem(const AtomicString&) const override { return nullptr; } + unsigned length() const override { return 0; } + Node* item(unsigned) const override { return nullptr; } + size_t memoryCost() const override { return 0; } - virtual bool isEmptyNodeList() const override { return true; } + bool isEmptyNodeList() const override { return true; } Ref<Node> m_owner; }; class ChildNodeList final : public NodeList { public: - static PassRefPtr<ChildNodeList> create(ContainerNode& parent) + static Ref<ChildNodeList> create(ContainerNode& parent) { - return adoptRef(new ChildNodeList(parent)); + return adoptRef(*new ChildNodeList(parent)); } virtual ~ChildNodeList(); - ContainerNode& ownerNode() { return m_parent.get(); } + ContainerNode& ownerNode() { return m_parent; } void invalidateCache(); // For CollectionIndexCache - Node* collectionFirst() const; + Node* collectionBegin() const; Node* collectionLast() const; - Node* collectionTraverseForward(Node&, unsigned count, unsigned& traversedCount) const; - Node* collectionTraverseBackward(Node&, unsigned count) const; + Node* collectionEnd() const { return nullptr; } + void collectionTraverseForward(Node*&, unsigned count, unsigned& traversedCount) const; + void collectionTraverseBackward(Node*&, unsigned count) const; bool collectionCanTraverseBackward() const { return true; } + void willValidateIndexCache() const { } private: explicit ChildNodeList(ContainerNode& parent); - virtual unsigned length() const override; - virtual Node* item(unsigned index) const override; - virtual Node* namedItem(const AtomicString&) const override; + unsigned length() const override; + Node* item(unsigned index) const override; + size_t memoryCost() const override { return m_indexCache.memoryCost(); } - virtual bool isChildNodeList() const override { return true; } + bool isChildNodeList() const override { return true; } Ref<ContainerNode> m_parent; - mutable CollectionIndexCache<ChildNodeList, Node> m_indexCache; + mutable CollectionIndexCache<ChildNodeList, Node*> m_indexCache; }; } // namespace WebCore - -#endif // ChildNodeList_h |