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

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

Issue 337753005: Make iterator for Element's attributes more lightweight (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Proper rebase Created 6 years, 6 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 | « Source/core/page/PageSerializer.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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 if (nodes.contains(n)) 230 if (nodes.contains(n))
231 sortedNodes.append(n); 231 sortedNodes.append(n);
232 232
233 if (!containsAttributeNodes || !n->isElementNode()) 233 if (!containsAttributeNodes || !n->isElementNode())
234 continue; 234 continue;
235 235
236 Element* element = toElement(n); 236 Element* element = toElement(n);
237 if (!element->hasAttributes()) 237 if (!element->hasAttributes())
238 continue; 238 continue;
239 239
240 AttributeIteratorAccessor attributes = element->attributesIterator(); 240 AttributeCollection attributes = element->attributes();
241 AttributeConstIterator end = attributes.end(); 241 AttributeCollection::const_iterator end = attributes.end();
242 for (AttributeConstIterator it = attributes.begin(); it != end; ++it) { 242 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) {
243 RefPtrWillBeRawPtr<Attr> attr = element->attrIfExists(it->name()); 243 RefPtrWillBeRawPtr<Attr> attr = element->attrIfExists(it->name());
244 if (attr && nodes.contains(attr.get())) 244 if (attr && nodes.contains(attr.get()))
245 sortedNodes.append(attr); 245 sortedNodes.append(attr);
246 } 246 }
247 } 247 }
248 248
249 ASSERT(sortedNodes.size() == nodeCount); 249 ASSERT(sortedNodes.size() == nodeCount);
250 const_cast<WillBeHeapVector<RefPtrWillBeMember<Node> >&>(m_nodes).swap(sorte dNodes); 250 const_cast<WillBeHeapVector<RefPtrWillBeMember<Node> >&>(m_nodes).swap(sorte dNodes);
251 } 251 }
252 252
(...skipping 25 matching lines...) Expand all
278 Node* NodeSet::anyNode() const 278 Node* NodeSet::anyNode() const
279 { 279 {
280 if (isEmpty()) 280 if (isEmpty())
281 return 0; 281 return 0;
282 282
283 return m_nodes.at(0).get(); 283 return m_nodes.at(0).get();
284 } 284 }
285 285
286 } 286 }
287 } 287 }
OLDNEW
« no previous file with comments | « Source/core/page/PageSerializer.cpp ('k') | Source/core/xml/XPathStep.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698