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

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

Issue 298253009: Add iterator object to iterate efficiently over an Element's attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org>
3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 if (n && n->namespaceURI() != XMLNSNames::xmlnsNamespaceURI) { / / In XPath land, namespace nodes are not accessible on the attribute axis. 350 if (n && n->namespaceURI() != XMLNSNames::xmlnsNamespaceURI) { / / In XPath land, namespace nodes are not accessible on the attribute axis.
351 if (nodeMatches(n.get(), AttributeAxis, nodeTest())) // Stil l need to check merged predicates. 351 if (nodeMatches(n.get(), AttributeAxis, nodeTest())) // Stil l need to check merged predicates.
352 nodes.append(n.release()); 352 nodes.append(n.release());
353 } 353 }
354 return; 354 return;
355 } 355 }
356 356
357 if (!contextElement->hasAttributes()) 357 if (!contextElement->hasAttributes())
358 return; 358 return;
359 359
360 unsigned attributeCount = contextElement->attributeCount(); 360 AttributeIteratorAccessor attributes = contextElement->attributesIte rator();
361 for (unsigned i = 0; i < attributeCount; ++i) { 361 AttributeConstIterator end = attributes.end();
362 RefPtrWillBeRawPtr<Attr> attr = contextElement->ensureAttr(conte xtElement->attributeItem(i).name()); 362 for (AttributeConstIterator it = attributes.begin(); it != end; ++it ) {
363 RefPtrWillBeRawPtr<Attr> attr = contextElement->ensureAttr(it->n ame());
363 if (nodeMatches(attr.get(), AttributeAxis, nodeTest())) 364 if (nodeMatches(attr.get(), AttributeAxis, nodeTest()))
364 nodes.append(attr.release()); 365 nodes.append(attr.release());
365 } 366 }
366 return; 367 return;
367 } 368 }
368 case NamespaceAxis: 369 case NamespaceAxis:
369 // XPath namespace nodes are not implemented. 370 // XPath namespace nodes are not implemented.
370 return; 371 return;
371 case SelfAxis: 372 case SelfAxis:
372 if (nodeMatches(context, SelfAxis, nodeTest())) 373 if (nodeMatches(context, SelfAxis, nodeTest()))
(...skipping 26 matching lines...) Expand all
399 nodes.markSorted(false); 400 nodes.markSorted(false);
400 return; 401 return;
401 } 402 }
402 } 403 }
403 ASSERT_NOT_REACHED(); 404 ASSERT_NOT_REACHED();
404 } 405 }
405 406
406 407
407 } 408 }
408 } 409 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698