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

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

Issue 2470233009: WTF/std normalization: replace WTF::Vector::first() with ::front() (Closed)
Patch Set: rebase Created 4 years 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
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 for (unsigned i = 0; i < nodeCount; ++i) { 218 for (unsigned i = 0; i < nodeCount; ++i) {
219 Node* node = m_nodes[i].get(); 219 Node* node = m_nodes[i].get();
220 nodes.add(node); 220 nodes.add(node);
221 if (node->isAttributeNode()) 221 if (node->isAttributeNode())
222 containsAttributeNodes = true; 222 containsAttributeNodes = true;
223 } 223 }
224 224
225 HeapVector<Member<Node>> sortedNodes; 225 HeapVector<Member<Node>> sortedNodes;
226 sortedNodes.reserveInitialCapacity(nodeCount); 226 sortedNodes.reserveInitialCapacity(nodeCount);
227 227
228 for (Node& n : NodeTraversal::startsAt(*findRootNode(m_nodes.first()))) { 228 for (Node& n : NodeTraversal::startsAt(*findRootNode(m_nodes.front()))) {
229 if (nodes.contains(&n)) 229 if (nodes.contains(&n))
230 sortedNodes.append(&n); 230 sortedNodes.append(&n);
231 231
232 if (!containsAttributeNodes || !n.isElementNode()) 232 if (!containsAttributeNodes || !n.isElementNode())
233 continue; 233 continue;
234 234
235 Element* element = toElement(&n); 235 Element* element = toElement(&n);
236 AttributeCollection attributes = element->attributes(); 236 AttributeCollection attributes = element->attributes();
237 for (auto& attribute : attributes) { 237 for (auto& attribute : attributes) {
238 Attr* attr = element->attrIfExists(attribute.name()); 238 Attr* attr = element->attrIfExists(attribute.name());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 Node* NodeSet::anyNode() const { 271 Node* NodeSet::anyNode() const {
272 if (isEmpty()) 272 if (isEmpty())
273 return nullptr; 273 return nullptr;
274 274
275 return m_nodes.at(0).get(); 275 return m_nodes.at(0).get();
276 } 276 }
277 277
278 } // namespace XPath 278 } // namespace XPath
279 } // namespace blink 279 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698