OLD | NEW |
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 21 matching lines...) Expand all Loading... |
32 #ifndef EmptyNodeList_h | 32 #ifndef EmptyNodeList_h |
33 #define EmptyNodeList_h | 33 #define EmptyNodeList_h |
34 | 34 |
35 #include "core/dom/NodeList.h" | 35 #include "core/dom/NodeList.h" |
36 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
37 | 37 |
38 namespace WebCore { | 38 namespace WebCore { |
39 | 39 |
40 class EmptyNodeList FINAL : public NodeList { | 40 class EmptyNodeList FINAL : public NodeList { |
41 public: | 41 public: |
42 static PassRefPtr<EmptyNodeList> create(Node* rootNode) | 42 static PassRefPtr<EmptyNodeList> create(Node& rootNode) |
43 { | 43 { |
44 ASSERT(rootNode); | |
45 return adoptRef(new EmptyNodeList(rootNode)); | 44 return adoptRef(new EmptyNodeList(rootNode)); |
46 } | 45 } |
47 virtual ~EmptyNodeList(); | 46 virtual ~EmptyNodeList(); |
48 | 47 |
49 Node& ownerNode() const { return *m_owner; } | 48 Node& ownerNode() const { return *m_owner; } |
50 | 49 |
51 private: | 50 private: |
52 explicit EmptyNodeList(Node* rootNode) : m_owner(rootNode) { } | 51 explicit EmptyNodeList(Node& rootNode) : m_owner(rootNode) { } |
53 | 52 |
54 virtual unsigned length() const OVERRIDE { return 0; } | 53 virtual unsigned length() const OVERRIDE { return 0; } |
55 virtual Node* item(unsigned) const OVERRIDE { return 0; } | 54 virtual Node* item(unsigned) const OVERRIDE { return 0; } |
56 | 55 |
57 virtual bool isEmptyNodeList() const OVERRIDE { return true; } | 56 virtual bool isEmptyNodeList() const OVERRIDE { return true; } |
58 virtual Node* virtualOwnerNode() const OVERRIDE; | 57 virtual Node* virtualOwnerNode() const OVERRIDE; |
59 | 58 |
60 RefPtr<Node> m_owner; | 59 RefPtr<Node> m_owner; |
61 }; | 60 }; |
62 | 61 |
63 DEFINE_TYPE_CASTS(EmptyNodeList, NodeList, nodeList, nodeList->isEmptyNodeList()
, nodeList.isEmptyNodeList()); | 62 DEFINE_TYPE_CASTS(EmptyNodeList, NodeList, nodeList, nodeList->isEmptyNodeList()
, nodeList.isEmptyNodeList()); |
64 | 63 |
65 } // namespace WebCore | 64 } // namespace WebCore |
66 | 65 |
67 #endif // EmptyNodeList_h | 66 #endif // EmptyNodeList_h |
OLD | NEW |