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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 448043003: Drop const_iterator for AttributeCollection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/dom/ElementData.cpp ('k') | Source/core/dom/PresentationAttributeStyle.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 const AtomicString& namespaceURI = namespaceURIMaybeEmpty.isEmpty() ? nullAt om : namespaceURIMaybeEmpty; 1264 const AtomicString& namespaceURI = namespaceURIMaybeEmpty.isEmpty() ? nullAt om : namespaceURIMaybeEmpty;
1265 1265
1266 switch (nodeType()) { 1266 switch (nodeType()) {
1267 case ELEMENT_NODE: { 1267 case ELEMENT_NODE: {
1268 const Element& element = toElement(*this); 1268 const Element& element = toElement(*this);
1269 1269
1270 if (element.prefix().isNull()) 1270 if (element.prefix().isNull())
1271 return element.namespaceURI() == namespaceURI; 1271 return element.namespaceURI() == namespaceURI;
1272 1272
1273 AttributeCollection attributes = element.attributes(); 1273 AttributeCollection attributes = element.attributes();
1274 AttributeCollection::const_iterator end = attributes.end(); 1274 AttributeCollection::iterator end = attributes.end();
1275 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) { 1275 for (AttributeCollection::iterator it = attributes.begin(); it != en d; ++it) {
1276 if (it->localName() == xmlnsAtom) 1276 if (it->localName() == xmlnsAtom)
1277 return it->value() == namespaceURI; 1277 return it->value() == namespaceURI;
1278 } 1278 }
1279 1279
1280 if (Element* parent = parentElement()) 1280 if (Element* parent = parentElement())
1281 return parent->isDefaultNamespace(namespaceURI); 1281 return parent->isDefaultNamespace(namespaceURI);
1282 1282
1283 return false; 1283 return false;
1284 } 1284 }
1285 case DOCUMENT_NODE: 1285 case DOCUMENT_NODE:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 return nullAtom; 1347 return nullAtom;
1348 1348
1349 switch (nodeType()) { 1349 switch (nodeType()) {
1350 case ELEMENT_NODE: { 1350 case ELEMENT_NODE: {
1351 const Element& element = toElement(*this); 1351 const Element& element = toElement(*this);
1352 1352
1353 if (!element.namespaceURI().isNull() && element.prefix() == prefix) 1353 if (!element.namespaceURI().isNull() && element.prefix() == prefix)
1354 return element.namespaceURI(); 1354 return element.namespaceURI();
1355 1355
1356 AttributeCollection attributes = element.attributes(); 1356 AttributeCollection attributes = element.attributes();
1357 AttributeCollection::const_iterator end = attributes.end(); 1357 AttributeCollection::iterator end = attributes.end();
1358 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) { 1358 for (AttributeCollection::iterator it = attributes.begin(); it != en d; ++it) {
1359 if (it->prefix() == xmlnsAtom && it->localName() == prefix) { 1359 if (it->prefix() == xmlnsAtom && it->localName() == prefix) {
1360 if (!it->value().isEmpty()) 1360 if (!it->value().isEmpty())
1361 return it->value(); 1361 return it->value();
1362 return nullAtom; 1362 return nullAtom;
1363 } 1363 }
1364 if (it->localName() == xmlnsAtom && prefix.isNull()) { 1364 if (it->localName() == xmlnsAtom && prefix.isNull()) {
1365 if (!it->value().isEmpty()) 1365 if (!it->value().isEmpty())
1366 return it->value(); 1366 return it->value();
1367 return nullAtom; 1367 return nullAtom;
1368 } 1368 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 Vector<const Node*, 16> chain2; 1508 Vector<const Node*, 16> chain2;
1509 if (attr1) 1509 if (attr1)
1510 chain1.append(attr1); 1510 chain1.append(attr1);
1511 if (attr2) 1511 if (attr2)
1512 chain2.append(attr2); 1512 chain2.append(attr2);
1513 1513
1514 if (attr1 && attr2 && start1 == start2 && start1) { 1514 if (attr1 && attr2 && start1 == start2 && start1) {
1515 // We are comparing two attributes on the same node. Crawl our attribute map and see which one we hit first. 1515 // We are comparing two attributes on the same node. Crawl our attribute map and see which one we hit first.
1516 const Element* owner1 = attr1->ownerElement(); 1516 const Element* owner1 = attr1->ownerElement();
1517 AttributeCollection attributes = owner1->attributes(); 1517 AttributeCollection attributes = owner1->attributes();
1518 AttributeCollection::const_iterator end = attributes.end(); 1518 AttributeCollection::iterator end = attributes.end();
1519 for (AttributeCollection::const_iterator it = attributes.begin(); it != end; ++it) { 1519 for (AttributeCollection::iterator it = attributes.begin(); it != end; + +it) {
1520 // If neither of the two determining nodes is a child node and nodeT ype is the same for both determining nodes, then an 1520 // If neither of the two determining nodes is a child node and nodeT ype is the same for both determining nodes, then an
1521 // implementation-dependent order between the determining nodes is r eturned. This order is stable as long as no nodes of 1521 // implementation-dependent order between the determining nodes is r eturned. This order is stable as long as no nodes of
1522 // the same nodeType are inserted into or removed from the direct co ntainer. This would be the case, for example, 1522 // the same nodeType are inserted into or removed from the direct co ntainer. This would be the case, for example,
1523 // when comparing two attributes of the same element, and inserting or removing additional attributes might change 1523 // when comparing two attributes of the same element, and inserting or removing additional attributes might change
1524 // the order between existing attributes. 1524 // the order between existing attributes.
1525 if (attr1->qualifiedName() == it->name()) 1525 if (attr1->qualifiedName() == it->name())
1526 return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSI TION_FOLLOWING; 1526 return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSI TION_FOLLOWING;
1527 if (attr2->qualifiedName() == it->name()) 1527 if (attr2->qualifiedName() == it->name())
1528 return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSI TION_PRECEDING; 1528 return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSI TION_PRECEDING;
1529 } 1529 }
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2486 node->showTreeForThis(); 2486 node->showTreeForThis();
2487 } 2487 }
2488 2488
2489 void showNodePath(const blink::Node* node) 2489 void showNodePath(const blink::Node* node)
2490 { 2490 {
2491 if (node) 2491 if (node)
2492 node->showNodePathForThis(); 2492 node->showNodePathForThis();
2493 } 2493 }
2494 2494
2495 #endif 2495 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/ElementData.cpp ('k') | Source/core/dom/PresentationAttributeStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698