OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 static unsigned s_count; | 75 static unsigned s_count; |
76 #endif | 76 #endif |
77 }; | 77 }; |
78 | 78 |
79 class ContainerNode : public Node { | 79 class ContainerNode : public Node { |
80 public: | 80 public: |
81 virtual ~ContainerNode(); | 81 virtual ~ContainerNode(); |
82 | 82 |
83 Node* firstChild() const { return m_firstChild; } | 83 Node* firstChild() const { return m_firstChild; } |
84 Node* lastChild() const { return m_lastChild; } | 84 Node* lastChild() const { return m_lastChild; } |
85 bool hasChildNodes() const { return m_firstChild; } | 85 bool hasChildren() const { return m_firstChild; } |
86 | 86 |
87 bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling
(); } | 87 bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling
(); } |
88 bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextN
ode(); } | 88 bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextN
ode(); } |
89 bool hasChildCount(unsigned) const; | 89 bool hasChildCount(unsigned) const; |
90 | 90 |
91 PassRefPtr<HTMLCollection> children(); | 91 PassRefPtr<HTMLCollection> children(); |
92 | 92 |
93 unsigned childNodeCount() const; | 93 unsigned countChildren() const; |
94 Node* childNode(unsigned index) const; | 94 Node* traverseToChildAt(unsigned index) const; |
95 | 95 |
96 PassRefPtr<Element> querySelector(const AtomicString& selectors, ExceptionSt
ate&); | 96 PassRefPtr<Element> querySelector(const AtomicString& selectors, ExceptionSt
ate&); |
97 PassRefPtr<NodeList> querySelectorAll(const AtomicString& selectors, Excepti
onState&); | 97 PassRefPtr<NodeList> querySelectorAll(const AtomicString& selectors, Excepti
onState&); |
98 | 98 |
99 void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionState&
= ASSERT_NO_EXCEPTION); | 99 void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionState&
= ASSERT_NO_EXCEPTION); |
100 void replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionState&
= ASSERT_NO_EXCEPTION); | 100 void replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionState&
= ASSERT_NO_EXCEPTION); |
101 void removeChild(Node* child, ExceptionState& = ASSERT_NO_EXCEPTION); | 101 void removeChild(Node* child, ExceptionState& = ASSERT_NO_EXCEPTION); |
102 void appendChild(PassRefPtr<Node> newChild, ExceptionState& = ASSERT_NO_EXCE
PTION); | 102 void appendChild(PassRefPtr<Node> newChild, ExceptionState& = ASSERT_NO_EXCE
PTION); |
103 | 103 |
104 PassRefPtr<HTMLCollection> getElementsByTagName(const AtomicString&); | 104 PassRefPtr<HTMLCollection> getElementsByTagName(const AtomicString&); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 208 |
209 inline void ContainerNode::detachChildren(const AttachContext& context) | 209 inline void ContainerNode::detachChildren(const AttachContext& context) |
210 { | 210 { |
211 AttachContext childrenContext(context); | 211 AttachContext childrenContext(context); |
212 childrenContext.resolvedStyle = 0; | 212 childrenContext.resolvedStyle = 0; |
213 | 213 |
214 for (Node* child = firstChild(); child; child = child->nextSibling()) | 214 for (Node* child = firstChild(); child; child = child->nextSibling()) |
215 child->detach(childrenContext); | 215 child->detach(childrenContext); |
216 } | 216 } |
217 | 217 |
218 inline unsigned Node::childNodeCount() const | 218 inline unsigned Node::countChildren() const |
219 { | 219 { |
220 if (!isContainerNode()) | 220 if (!isContainerNode()) |
221 return 0; | 221 return 0; |
222 return toContainerNode(this)->childNodeCount(); | 222 return toContainerNode(this)->countChildren(); |
223 } | 223 } |
224 | 224 |
225 inline Node* Node::childNode(unsigned index) const | 225 inline Node* Node::traverseToChildAt(unsigned index) const |
226 { | 226 { |
227 if (!isContainerNode()) | 227 if (!isContainerNode()) |
228 return 0; | 228 return 0; |
229 return toContainerNode(this)->childNode(index); | 229 return toContainerNode(this)->traverseToChildAt(index); |
230 } | 230 } |
231 | 231 |
232 inline Node* Node::firstChild() const | 232 inline Node* Node::firstChild() const |
233 { | 233 { |
234 if (!isContainerNode()) | 234 if (!isContainerNode()) |
235 return 0; | 235 return 0; |
236 return toContainerNode(this)->firstChild(); | 236 return toContainerNode(this)->firstChild(); |
237 } | 237 } |
238 | 238 |
239 inline Node* Node::lastChild() const | 239 inline Node* Node::lastChild() const |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 RefPtr<Node> m_currentNode; | 333 RefPtr<Node> m_currentNode; |
334 unsigned m_currentIndex; | 334 unsigned m_currentIndex; |
335 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. | 335 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. |
336 ChildNodesLazySnapshot* m_nextSnapshot; | 336 ChildNodesLazySnapshot* m_nextSnapshot; |
337 }; | 337 }; |
338 | 338 |
339 } // namespace WebCore | 339 } // namespace WebCore |
340 | 340 |
341 #endif // ContainerNode_h | 341 #endif // ContainerNode_h |
OLD | NEW |