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

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

Issue 425223005: Move Node/ContainerNode's traverseToChildAt() to NodeTraversal (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | « no previous file | Source/core/dom/ContainerNode.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) 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, 2013 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2013 Apple Inc. All r ights 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 Node* lastChild() const { return m_lastChild; } 68 Node* lastChild() const { return m_lastChild; }
69 bool hasChildren() const { return m_firstChild; } 69 bool hasChildren() const { return m_firstChild; }
70 70
71 bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling (); } 71 bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling (); }
72 bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextN ode(); } 72 bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextN ode(); }
73 bool hasChildCount(unsigned) const; 73 bool hasChildCount(unsigned) const;
74 74
75 PassRefPtrWillBeRawPtr<HTMLCollection> children(); 75 PassRefPtrWillBeRawPtr<HTMLCollection> children();
76 76
77 unsigned countChildren() const; 77 unsigned countChildren() const;
78 Node* traverseToChildAt(unsigned index) const;
79 78
80 PassRefPtrWillBeRawPtr<Element> querySelector(const AtomicString& selectors, ExceptionState&); 79 PassRefPtrWillBeRawPtr<Element> querySelector(const AtomicString& selectors, ExceptionState&);
81 PassRefPtrWillBeRawPtr<StaticNodeList> querySelectorAll(const AtomicString& selectors, ExceptionState&); 80 PassRefPtrWillBeRawPtr<StaticNodeList> querySelectorAll(const AtomicString& selectors, ExceptionState&);
82 81
83 PassRefPtrWillBeRawPtr<Node> insertBefore(PassRefPtrWillBeRawPtr<Node> newCh ild, Node* refChild, ExceptionState& = ASSERT_NO_EXCEPTION); 82 PassRefPtrWillBeRawPtr<Node> insertBefore(PassRefPtrWillBeRawPtr<Node> newCh ild, Node* refChild, ExceptionState& = ASSERT_NO_EXCEPTION);
84 PassRefPtrWillBeRawPtr<Node> replaceChild(PassRefPtrWillBeRawPtr<Node> newCh ild, PassRefPtrWillBeRawPtr<Node> oldChild, ExceptionState& = ASSERT_NO_EXCEPTIO N); 83 PassRefPtrWillBeRawPtr<Node> replaceChild(PassRefPtrWillBeRawPtr<Node> newCh ild, PassRefPtrWillBeRawPtr<Node> oldChild, ExceptionState& = ASSERT_NO_EXCEPTIO N);
85 PassRefPtrWillBeRawPtr<Node> removeChild(PassRefPtrWillBeRawPtr<Node> child, ExceptionState& = ASSERT_NO_EXCEPTION); 84 PassRefPtrWillBeRawPtr<Node> removeChild(PassRefPtrWillBeRawPtr<Node> child, ExceptionState& = ASSERT_NO_EXCEPTION);
86 PassRefPtrWillBeRawPtr<Node> appendChild(PassRefPtrWillBeRawPtr<Node> newChi ld, ExceptionState& = ASSERT_NO_EXCEPTION); 85 PassRefPtrWillBeRawPtr<Node> appendChild(PassRefPtrWillBeRawPtr<Node> newChi ld, ExceptionState& = ASSERT_NO_EXCEPTION);
87 86
88 Element* getElementById(const AtomicString& id) const; 87 Element* getElementById(const AtomicString& id) const;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 child->detach(childrenContext); 273 child->detach(childrenContext);
275 } 274 }
276 275
277 inline unsigned Node::countChildren() const 276 inline unsigned Node::countChildren() const
278 { 277 {
279 if (!isContainerNode()) 278 if (!isContainerNode())
280 return 0; 279 return 0;
281 return toContainerNode(this)->countChildren(); 280 return toContainerNode(this)->countChildren();
282 } 281 }
283 282
284 inline Node* Node::traverseToChildAt(unsigned index) const
285 {
286 if (!isContainerNode())
287 return 0;
288 return toContainerNode(this)->traverseToChildAt(index);
289 }
290
291 inline Node* Node::firstChild() const 283 inline Node* Node::firstChild() const
292 { 284 {
293 if (!isContainerNode()) 285 if (!isContainerNode())
294 return 0; 286 return 0;
295 return toContainerNode(this)->firstChild(); 287 return toContainerNode(this)->firstChild();
296 } 288 }
297 289
298 inline Node* Node::lastChild() const 290 inline Node* Node::lastChild() const
299 { 291 {
300 if (!isContainerNode()) 292 if (!isContainerNode())
(...skipping 21 matching lines...) Expand all
322 inline void getChildNodes(Node& node, NodeVector& nodes) 314 inline void getChildNodes(Node& node, NodeVector& nodes)
323 { 315 {
324 ASSERT(!nodes.size()); 316 ASSERT(!nodes.size());
325 for (Node* child = node.firstChild(); child; child = child->nextSibling()) 317 for (Node* child = node.firstChild(); child; child = child->nextSibling())
326 nodes.append(child); 318 nodes.append(child);
327 } 319 }
328 320
329 } // namespace blink 321 } // namespace blink
330 322
331 #endif // ContainerNode_h 323 #endif // ContainerNode_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698