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

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: 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/xml/XPathNodeSet.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.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) 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 if (n && n->namespaceURI() != XMLNSNames::xmlnsNamespaceURI) { / / In XPath land, namespace nodes are not accessible on the attribute axis. 353 if (n && n->namespaceURI() != XMLNSNames::xmlnsNamespaceURI) { / / In XPath land, namespace nodes are not accessible on the attribute axis.
354 if (nodeMatches(n.get(), AttributeAxis, nodeTest())) // Stil l need to check merged predicates. 354 if (nodeMatches(n.get(), AttributeAxis, nodeTest())) // Stil l need to check merged predicates.
355 nodes.append(n.release()); 355 nodes.append(n.release());
356 } 356 }
357 return; 357 return;
358 } 358 }
359 359
360 if (!contextElement->hasAttributes()) 360 if (!contextElement->hasAttributes())
361 return; 361 return;
362 362
363 unsigned attributeCount = contextElement->attributeCount(); 363 AttributeIteratorAccessor attributes = contextElement->attributesIte rator();
364 for (unsigned i = 0; i < attributeCount; ++i) { 364 AttributeConstIterator end = attributes.end();
365 RefPtrWillBeRawPtr<Attr> attr = contextElement->ensureAttr(conte xtElement->attributeItem(i).name()); 365 for (AttributeConstIterator it = attributes.begin(); it != end; ++it ) {
366 RefPtrWillBeRawPtr<Attr> attr = contextElement->ensureAttr(it->n ame());
366 if (nodeMatches(attr.get(), AttributeAxis, nodeTest())) 367 if (nodeMatches(attr.get(), AttributeAxis, nodeTest()))
367 nodes.append(attr.release()); 368 nodes.append(attr.release());
368 } 369 }
369 return; 370 return;
370 } 371 }
371 case NamespaceAxis: 372 case NamespaceAxis:
372 // XPath namespace nodes are not implemented. 373 // XPath namespace nodes are not implemented.
373 return; 374 return;
374 case SelfAxis: 375 case SelfAxis:
375 if (nodeMatches(context, SelfAxis, nodeTest())) 376 if (nodeMatches(context, SelfAxis, nodeTest()))
(...skipping 26 matching lines...) Expand all
402 nodes.markSorted(false); 403 nodes.markSorted(false);
403 return; 404 return;
404 } 405 }
405 } 406 }
406 ASSERT_NOT_REACHED(); 407 ASSERT_NOT_REACHED();
407 } 408 }
408 409
409 410
410 } 411 }
411 } 412 }
OLDNEW
« no previous file with comments | « Source/core/xml/XPathNodeSet.cpp ('k') | Source/core/xml/parser/XMLDocumentParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698