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

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

Issue 1304043002: Make classes and structures in core/dom fast-allocated. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/core/dom/NodeListsNodeData.h ('k') | Source/core/dom/NthIndexCache.h » ('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, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
7 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 7 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 11 matching lines...) Expand all
22 * Boston, MA 02110-1301, USA. 22 * Boston, MA 02110-1301, USA.
23 * 23 *
24 */ 24 */
25 25
26 #ifndef NodeTraversal_h 26 #ifndef NodeTraversal_h
27 #define NodeTraversal_h 27 #define NodeTraversal_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/dom/ContainerNode.h" 30 #include "core/dom/ContainerNode.h"
31 #include "core/dom/Node.h" 31 #include "core/dom/Node.h"
32 #include "wtf/Allocator.h"
32 33
33 namespace blink { 34 namespace blink {
34 35
35 template <class Iterator> class TraversalRange; 36 template <class Iterator> class TraversalRange;
36 template <class TraversalNext> class TraversalChildrenIterator; 37 template <class TraversalNext> class TraversalChildrenIterator;
37 template <class TraversalNext> class TraversalDescendantIterator; 38 template <class TraversalNext> class TraversalDescendantIterator;
38 template <class TraversalNext> class TraversalInclusiveDescendantIterator; 39 template <class TraversalNext> class TraversalInclusiveDescendantIterator;
39 template <class TraversalNext> class TraversalNextIterator; 40 template <class TraversalNext> class TraversalNextIterator;
40 41
41 class NodeTraversal { 42 class NodeTraversal {
43 STATIC_ONLY(NodeTraversal);
42 public: 44 public:
43 using TraversalNodeType = Node; 45 using TraversalNodeType = Node;
44 46
45 // Does a pre-order traversal of the tree to find the next node after this o ne. 47 // Does a pre-order traversal of the tree to find the next node after this o ne.
46 // This uses the same order that tags appear in the source file. If the stay Within 48 // This uses the same order that tags appear in the source file. If the stay Within
47 // argument is non-null, the traversal will stop once the specified node is reached. 49 // argument is non-null, the traversal will stop once the specified node is reached.
48 // This can be used to restrict traversal to a particular sub-tree. 50 // This can be used to restrict traversal to a particular sub-tree.
49 static Node* next(const Node& current) { return traverseNextTemplate(current ); } 51 static Node* next(const Node& current) { return traverseNextTemplate(current ); }
50 static Node* next(const ContainerNode& current) { return traverseNextTemplat e(current); } 52 static Node* next(const ContainerNode& current) { return traverseNextTemplat e(current); }
51 static Node* next(const Node& current, const Node* stayWithin) { return trav erseNextTemplate(current, stayWithin); } 53 static Node* next(const Node& current, const Node* stayWithin) { return trav erseNextTemplate(current, stayWithin); }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 { 268 {
267 Node* child = parent.firstChild(); 269 Node* child = parent.firstChild();
268 while (child && index--) 270 while (child && index--)
269 child = child->nextSibling(); 271 child = child->nextSibling();
270 return child; 272 return child;
271 } 273 }
272 274
273 } // namespace blink 275 } // namespace blink
274 276
275 #endif 277 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/NodeListsNodeData.h ('k') | Source/core/dom/NthIndexCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698