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

Side by Side Diff: Source/core/xml/XPathNodeSet.cpp

Issue 67473002: Have ElementTraversal / NodeTraversal's next() methods take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month 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/svg/animation/SMILTimeContainer.cpp ('k') | Source/core/xml/XPathStep.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) 2007 Alexey Proskuryakov <ap@webkit.org> 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 for (unsigned i = 0; i < nodeCount; ++i) { 200 for (unsigned i = 0; i < nodeCount; ++i) {
201 Node* node = m_nodes[i].get(); 201 Node* node = m_nodes[i].get();
202 nodes.add(node); 202 nodes.add(node);
203 if (node->isAttributeNode()) 203 if (node->isAttributeNode())
204 containsAttributeNodes = true; 204 containsAttributeNodes = true;
205 } 205 }
206 206
207 Vector<RefPtr<Node> > sortedNodes; 207 Vector<RefPtr<Node> > sortedNodes;
208 sortedNodes.reserveInitialCapacity(nodeCount); 208 sortedNodes.reserveInitialCapacity(nodeCount);
209 209
210 for (Node* n = findRootNode(m_nodes.first().get()); n; n = NodeTraversal::ne xt(n)) { 210 for (Node* n = findRootNode(m_nodes.first().get()); n; n = NodeTraversal::ne xt(*n)) {
211 if (nodes.contains(n)) 211 if (nodes.contains(n))
212 sortedNodes.append(n); 212 sortedNodes.append(n);
213 213
214 if (!containsAttributeNodes || !n->isElementNode()) 214 if (!containsAttributeNodes || !n->isElementNode())
215 continue; 215 continue;
216 216
217 Element* element = toElement(n); 217 Element* element = toElement(n);
218 if (!element->hasAttributes()) 218 if (!element->hasAttributes())
219 continue; 219 continue;
220 220
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 Node* NodeSet::anyNode() const 256 Node* NodeSet::anyNode() const
257 { 257 {
258 if (isEmpty()) 258 if (isEmpty())
259 return 0; 259 return 0;
260 260
261 return m_nodes.at(0).get(); 261 return m_nodes.at(0).get();
262 } 262 }
263 263
264 } 264 }
265 } 265 }
OLDNEW
« no previous file with comments | « Source/core/svg/animation/SMILTimeContainer.cpp ('k') | Source/core/xml/XPathStep.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698