| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 hasChildNodes() 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 | 90 |
| 90 PassRefPtr<HTMLCollection> children(); | 91 PassRefPtr<HTMLCollection> children(); |
| 91 | 92 |
| 92 unsigned childNodeCount() const; | 93 unsigned childNodeCount() const; |
| 93 Node* childNode(unsigned index) const; | 94 Node* childNode(unsigned index) const; |
| 94 | 95 |
| 95 PassRefPtr<Element> querySelector(const AtomicString& selectors, ExceptionSt
ate&); | 96 PassRefPtr<Element> querySelector(const AtomicString& selectors, ExceptionSt
ate&); |
| 96 PassRefPtr<NodeList> querySelectorAll(const AtomicString& selectors, Excepti
onState&); | 97 PassRefPtr<NodeList> querySelectorAll(const AtomicString& selectors, Excepti
onState&); |
| 97 | 98 |
| 98 void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionState&
= ASSERT_NO_EXCEPTION); | 99 void insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionState&
= ASSERT_NO_EXCEPTION); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 Node* m_firstChild; | 170 Node* m_firstChild; |
| 170 Node* m_lastChild; | 171 Node* m_lastChild; |
| 171 }; | 172 }; |
| 172 | 173 |
| 173 #ifndef NDEBUG | 174 #ifndef NDEBUG |
| 174 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*); | 175 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*); |
| 175 #endif | 176 #endif |
| 176 | 177 |
| 177 DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode()); | 178 DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode()); |
| 178 | 179 |
| 180 inline bool ContainerNode::hasChildCount(unsigned count) const |
| 181 { |
| 182 Node* child = m_firstChild; |
| 183 while (count && child) { |
| 184 child = child->nextSibling(); |
| 185 --count; |
| 186 } |
| 187 return !count && !child; |
| 188 } |
| 189 |
| 179 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type) | 190 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type) |
| 180 : Node(treeScope, type) | 191 : Node(treeScope, type) |
| 181 , m_firstChild(0) | 192 , m_firstChild(0) |
| 182 , m_lastChild(0) | 193 , m_lastChild(0) |
| 183 { | 194 { |
| 184 } | 195 } |
| 185 | 196 |
| 186 inline void ContainerNode::attachChildren(const AttachContext& context) | 197 inline void ContainerNode::attachChildren(const AttachContext& context) |
| 187 { | 198 { |
| 188 AttachContext childrenContext(context); | 199 AttachContext childrenContext(context); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 332 |
| 322 RefPtr<Node> m_currentNode; | 333 RefPtr<Node> m_currentNode; |
| 323 unsigned m_currentIndex; | 334 unsigned m_currentIndex; |
| 324 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. | 335 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. |
| 325 ChildNodesLazySnapshot* m_nextSnapshot; | 336 ChildNodesLazySnapshot* m_nextSnapshot; |
| 326 }; | 337 }; |
| 327 | 338 |
| 328 } // namespace WebCore | 339 } // namespace WebCore |
| 329 | 340 |
| 330 #endif // ContainerNode_h | 341 #endif // ContainerNode_h |
| OLD | NEW |