Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Unified Diff: Source/core/dom/ChildNodeList.h

Issue 132923003: Make sure the rootNode of a LiveNodeListBase is always a ContainerNode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Slightly clearer cast Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/dom/ChildNodeList.cpp » ('j') | Source/core/dom/NodeRareData.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ChildNodeList.h
diff --git a/Source/core/dom/ChildNodeList.h b/Source/core/dom/ChildNodeList.h
index 46f5beab4b15b00610e0711d120b3b1de6f9e35d..a83afd182ab27a6a37984b594d22053912ef137b 100644
--- a/Source/core/dom/ChildNodeList.h
+++ b/Source/core/dom/ChildNodeList.h
@@ -31,7 +31,7 @@ namespace WebCore {
class ChildNodeList FINAL : public LiveNodeList {
public:
- static PassRefPtr<ChildNodeList> create(PassRefPtr<Node> rootNode)
+ static PassRefPtr<ChildNodeList> create(PassRefPtr<ContainerNode> rootNode)
{
return adoptRef(new ChildNodeList(rootNode));
}
@@ -39,11 +39,33 @@ public:
virtual ~ChildNodeList();
protected:
- explicit ChildNodeList(PassRefPtr<Node> rootNode);
+ explicit ChildNodeList(PassRefPtr<ContainerNode> rootNode);
virtual bool nodeMatches(Element*) const OVERRIDE;
};
+class EmptyNodeList FINAL : public NodeList {
esprehn 2014/01/17 07:06:20 Please put this in its own file.
Inactive 2014/01/17 15:00:48 Done.
+public:
+ static PassRefPtr<EmptyNodeList> create(Node* owner)
+ {
+ return adoptRef(new EmptyNodeList(owner));
+ }
+ virtual ~EmptyNodeList();
+
+ Node* ownerNode() const { return m_owner.get(); }
+
+private:
+ explicit EmptyNodeList(Node* owner) : m_owner(owner) { }
+
+ virtual unsigned length() const OVERRIDE { return 0; }
+ virtual Node* item(unsigned) const OVERRIDE { return 0; }
+ virtual Node* namedItem(const AtomicString&) const OVERRIDE { return 0; }
+
+ virtual bool isEmptyNodeList() const OVERRIDE { return true; }
+
+ RefPtr<Node> m_owner;
+};
+
} // namespace WebCore
#endif // ChildNodeList_h
« no previous file with comments | « no previous file | Source/core/dom/ChildNodeList.cpp » ('j') | Source/core/dom/NodeRareData.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698