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

Side by Side Diff: Source/core/dom/EmptyNodeList.h

Issue 180143003: Have LiveNodeListBase::ownerNode() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/ClassCollection.cpp ('k') | Source/core/dom/EmptyNodeList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 22 matching lines...) Expand all
33 #define EmptyNodeList_h 33 #define EmptyNodeList_h
34 34
35 #include "core/dom/NodeList.h" 35 #include "core/dom/NodeList.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 class EmptyNodeList FINAL : public NodeList { 39 class EmptyNodeList FINAL : public NodeList {
40 public: 40 public:
41 static PassRefPtr<EmptyNodeList> create(Node* rootNode) 41 static PassRefPtr<EmptyNodeList> create(Node* rootNode)
42 { 42 {
43 ASSERT(rootNode);
43 return adoptRef(new EmptyNodeList(rootNode)); 44 return adoptRef(new EmptyNodeList(rootNode));
44 } 45 }
45 virtual ~EmptyNodeList(); 46 virtual ~EmptyNodeList();
46 47
47 Node* ownerNode() const { return m_owner.get(); } 48 Node& ownerNode() const { return *m_owner; }
48 49
49 private: 50 private:
50 explicit EmptyNodeList(Node* rootNode) : m_owner(rootNode) { } 51 explicit EmptyNodeList(Node* rootNode) : m_owner(rootNode) { }
51 52
52 virtual unsigned length() const OVERRIDE { return 0; } 53 virtual unsigned length() const OVERRIDE { return 0; }
53 virtual Node* item(unsigned) const OVERRIDE { return 0; } 54 virtual Node* item(unsigned) const OVERRIDE { return 0; }
54 55
55 virtual bool isEmptyNodeList() const OVERRIDE { return true; } 56 virtual bool isEmptyNodeList() const OVERRIDE { return true; }
56 virtual Node* virtualOwnerNode() const OVERRIDE; 57 virtual Node* virtualOwnerNode() const OVERRIDE;
57 58
58 RefPtr<Node> m_owner; 59 RefPtr<Node> m_owner;
59 }; 60 };
60 61
61 DEFINE_TYPE_CASTS(EmptyNodeList, NodeList, nodeList, nodeList->isEmptyNodeList() , nodeList.isEmptyNodeList()); 62 DEFINE_TYPE_CASTS(EmptyNodeList, NodeList, nodeList, nodeList->isEmptyNodeList() , nodeList.isEmptyNodeList());
62 63
63 } // namespace WebCore 64 } // namespace WebCore
64 65
65 #endif // EmptyNodeList_h 66 #endif // EmptyNodeList_h
OLDNEW
« no previous file with comments | « Source/core/dom/ClassCollection.cpp ('k') | Source/core/dom/EmptyNodeList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698