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

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

Issue 436603003: Make Element::attributes() less error-prone and simplify call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take feedback into consideration Created 6 years, 4 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 RefPtrWillBeRawPtr<Node> n = contextElement->getAttributeNodeNS(node Test().namespaceURI(), nodeTest().data()); 376 RefPtrWillBeRawPtr<Node> n = contextElement->getAttributeNodeNS(node Test().namespaceURI(), nodeTest().data());
377 // In XPath land, namespace nodes are not accessible on the attribut e axis. 377 // In XPath land, namespace nodes are not accessible on the attribut e axis.
378 if (n && n->namespaceURI() != XMLNSNames::xmlnsNamespaceURI) { 378 if (n && n->namespaceURI() != XMLNSNames::xmlnsNamespaceURI) {
379 // Still need to check merged predicates. 379 // Still need to check merged predicates.
380 if (nodeMatches(evaluationContext, n.get(), AttributeAxis, nodeT est())) 380 if (nodeMatches(evaluationContext, n.get(), AttributeAxis, nodeT est()))
381 nodes.append(n.release()); 381 nodes.append(n.release());
382 } 382 }
383 return; 383 return;
384 } 384 }
385 385
386 if (!contextElement->hasAttributes())
387 return;
388
389 AttributeCollection attributes = contextElement->attributes(); 386 AttributeCollection attributes = contextElement->attributes();
390 AttributeCollection::const_iterator end = attributes.end(); 387 AttributeCollection::const_iterator end = attributes.end();
391 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) { 388 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) {
392 RefPtrWillBeRawPtr<Attr> attr = contextElement->ensureAttr(it->name( )); 389 RefPtrWillBeRawPtr<Attr> attr = contextElement->ensureAttr(it->name( ));
393 if (nodeMatches(evaluationContext, attr.get(), AttributeAxis, nodeTe st())) 390 if (nodeMatches(evaluationContext, attr.get(), AttributeAxis, nodeTe st()))
394 nodes.append(attr.release()); 391 nodes.append(attr.release());
395 } 392 }
396 return; 393 return;
397 } 394 }
398 395
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 nodes.markSorted(false); 431 nodes.markSorted(false);
435 return; 432 return;
436 } 433 }
437 } 434 }
438 ASSERT_NOT_REACHED(); 435 ASSERT_NOT_REACHED();
439 } 436 }
440 437
441 } 438 }
442 439
443 } 440 }
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