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

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

Issue 413133008: Remove Traversal<Element> specializations for lastWithin() / previous() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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 | no next file » | 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, 2013 Appl e Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Appl e 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Specialized for pure Element to exploit the fact that Elements parent is alwa ys either another Element or the root. 106 // Specialized for pure Element to exploit the fact that Elements parent is alwa ys either another Element or the root.
107 template <> 107 template <>
108 template <class NodeType> 108 template <class NodeType>
109 inline Element* Traversal<Element>::firstWithinTemplate(NodeType& current) 109 inline Element* Traversal<Element>::firstWithinTemplate(NodeType& current)
110 { 110 {
111 return firstChildTemplate(current); 111 return firstChildTemplate(current);
112 } 112 }
113 113
114 template <> 114 template <>
115 template <class NodeType> 115 template <class NodeType>
116 inline Element* Traversal<Element>::lastWithinTemplate(NodeType& current)
117 {
118 Node* node = NodeTraversal::lastWithin(current);
119 while (node && !node->isElementNode())
120 node = NodeTraversal::previous(*node, &current);
121 return toElement(node);
122 }
123
124 template <>
125 template <class NodeType>
126 inline Element* Traversal<Element>::nextTemplate(NodeType& current) 116 inline Element* Traversal<Element>::nextTemplate(NodeType& current)
127 { 117 {
128 Node* node = NodeTraversal::next(current); 118 Node* node = NodeTraversal::next(current);
129 while (node && !node->isElementNode()) 119 while (node && !node->isElementNode())
130 node = NodeTraversal::nextSkippingChildren(*node); 120 node = NodeTraversal::nextSkippingChildren(*node);
131 return toElement(node); 121 return toElement(node);
132 } 122 }
133 123
134 template <> 124 template <>
135 template <class NodeType> 125 template <class NodeType>
136 inline Element* Traversal<Element>::nextTemplate(NodeType& current, const Node* stayWithin) 126 inline Element* Traversal<Element>::nextTemplate(NodeType& current, const Node* stayWithin)
137 { 127 {
138 Node* node = NodeTraversal::next(current, stayWithin); 128 Node* node = NodeTraversal::next(current, stayWithin);
139 while (node && !node->isElementNode()) 129 while (node && !node->isElementNode())
140 node = NodeTraversal::nextSkippingChildren(*node, stayWithin); 130 node = NodeTraversal::nextSkippingChildren(*node, stayWithin);
141 return toElement(node); 131 return toElement(node);
142 } 132 }
143 133
144 template <>
145 template <class NodeType>
146 inline Element* Traversal<Element>::previousTemplate(NodeType& current)
147 {
148 Node* node = NodeTraversal::previous(current);
149 while (node && !node->isElementNode())
150 node = NodeTraversal::previous(*node);
151 return toElement(node);
152 }
153
154 template <>
155 template <class NodeType>
156 inline Element* Traversal<Element>::previousTemplate(NodeType& current, const No de* stayWithin)
157 {
158 Node* node = NodeTraversal::previous(current, stayWithin);
159 while (node && !node->isElementNode())
160 node = NodeTraversal::previous(*node, stayWithin);
161 return toElement(node);
162 }
163
164 // Generic versions. 134 // Generic versions.
165 template <class ElementType> 135 template <class ElementType>
166 template <class NodeType> 136 template <class NodeType>
167 inline ElementType* Traversal<ElementType>::firstChildTemplate(NodeType& current ) 137 inline ElementType* Traversal<ElementType>::firstChildTemplate(NodeType& current )
168 { 138 {
169 Node* node = current.firstChild(); 139 Node* node = current.firstChild();
170 while (node && !isElementOfType<const ElementType>(*node)) 140 while (node && !isElementOfType<const ElementType>(*node))
171 node = node->nextSibling(); 141 node = node->nextSibling();
172 return toElement<ElementType>(node); 142 return toElement<ElementType>(node);
173 } 143 }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 { 298 {
329 Node* node = current.nextSibling(); 299 Node* node = current.nextSibling();
330 while (node && !isElementOfType<const ElementType>(*node)) 300 while (node && !isElementOfType<const ElementType>(*node))
331 node = node->nextSibling(); 301 node = node->nextSibling();
332 return toElement<ElementType>(node); 302 return toElement<ElementType>(node);
333 } 303 }
334 304
335 } // namespace blink 305 } // namespace blink
336 306
337 #endif 307 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698