OLD | NEW |
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 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 { | 1263 { |
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 if (element.hasAttributes()) { | 1273 AttributeCollection attributes = element.attributes(); |
1274 AttributeCollection attributes = element.attributes(); | 1274 AttributeCollection::const_iterator end = attributes.end(); |
1275 AttributeCollection::const_iterator end = attributes.end(); | 1275 for (AttributeCollection::const_iterator it = attributes.begin(); it
!= end; ++it) { |
1276 for (AttributeCollection::const_iterator it = attributes.begin()
; it != end; ++it) { | 1276 if (it->localName() == xmlnsAtom) |
1277 if (it->localName() == xmlnsAtom) | 1277 return it->value() == namespaceURI; |
1278 return it->value() == namespaceURI; | |
1279 } | |
1280 } | 1278 } |
1281 | 1279 |
1282 if (Element* parent = parentElement()) | 1280 if (Element* parent = parentElement()) |
1283 return parent->isDefaultNamespace(namespaceURI); | 1281 return parent->isDefaultNamespace(namespaceURI); |
1284 | 1282 |
1285 return false; | 1283 return false; |
1286 } | 1284 } |
1287 case DOCUMENT_NODE: | 1285 case DOCUMENT_NODE: |
1288 if (Element* de = toDocument(this)->documentElement()) | 1286 if (Element* de = toDocument(this)->documentElement()) |
1289 return de->isDefaultNamespace(namespaceURI); | 1287 return de->isDefaultNamespace(namespaceURI); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 if (!prefix.isNull() && prefix.isEmpty()) | 1346 if (!prefix.isNull() && prefix.isEmpty()) |
1349 return nullAtom; | 1347 return nullAtom; |
1350 | 1348 |
1351 switch (nodeType()) { | 1349 switch (nodeType()) { |
1352 case ELEMENT_NODE: { | 1350 case ELEMENT_NODE: { |
1353 const Element& element = toElement(*this); | 1351 const Element& element = toElement(*this); |
1354 | 1352 |
1355 if (!element.namespaceURI().isNull() && element.prefix() == prefix) | 1353 if (!element.namespaceURI().isNull() && element.prefix() == prefix) |
1356 return element.namespaceURI(); | 1354 return element.namespaceURI(); |
1357 | 1355 |
1358 if (element.hasAttributes()) { | 1356 AttributeCollection attributes = element.attributes(); |
1359 AttributeCollection attributes = element.attributes(); | 1357 AttributeCollection::const_iterator end = attributes.end(); |
1360 AttributeCollection::const_iterator end = attributes.end(); | 1358 for (AttributeCollection::const_iterator it = attributes.begin(); it
!= end; ++it) { |
1361 for (AttributeCollection::const_iterator it = attributes.begin()
; it != end; ++it) { | 1359 if (it->prefix() == xmlnsAtom && it->localName() == prefix) { |
1362 if (it->prefix() == xmlnsAtom && it->localName() == prefix)
{ | 1360 if (!it->value().isEmpty()) |
1363 if (!it->value().isEmpty()) | 1361 return it->value(); |
1364 return it->value(); | 1362 return nullAtom; |
1365 return nullAtom; | 1363 } |
1366 } | 1364 if (it->localName() == xmlnsAtom && prefix.isNull()) { |
1367 if (it->localName() == xmlnsAtom && prefix.isNull()) { | 1365 if (!it->value().isEmpty()) |
1368 if (!it->value().isEmpty()) | 1366 return it->value(); |
1369 return it->value(); | 1367 return nullAtom; |
1370 return nullAtom; | |
1371 } | |
1372 } | 1368 } |
1373 } | 1369 } |
| 1370 |
1374 if (Element* parent = parentElement()) | 1371 if (Element* parent = parentElement()) |
1375 return parent->lookupNamespaceURI(prefix); | 1372 return parent->lookupNamespaceURI(prefix); |
1376 return nullAtom; | 1373 return nullAtom; |
1377 } | 1374 } |
1378 case DOCUMENT_NODE: | 1375 case DOCUMENT_NODE: |
1379 if (Element* de = toDocument(this)->documentElement()) | 1376 if (Element* de = toDocument(this)->documentElement()) |
1380 return de->lookupNamespaceURI(prefix); | 1377 return de->lookupNamespaceURI(prefix); |
1381 return nullAtom; | 1378 return nullAtom; |
1382 case DOCUMENT_TYPE_NODE: | 1379 case DOCUMENT_TYPE_NODE: |
1383 case DOCUMENT_FRAGMENT_NODE: | 1380 case DOCUMENT_FRAGMENT_NODE: |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 Vector<const Node*, 16> chain1; | 1507 Vector<const Node*, 16> chain1; |
1511 Vector<const Node*, 16> chain2; | 1508 Vector<const Node*, 16> chain2; |
1512 if (attr1) | 1509 if (attr1) |
1513 chain1.append(attr1); | 1510 chain1.append(attr1); |
1514 if (attr2) | 1511 if (attr2) |
1515 chain2.append(attr2); | 1512 chain2.append(attr2); |
1516 | 1513 |
1517 if (attr1 && attr2 && start1 == start2 && start1) { | 1514 if (attr1 && attr2 && start1 == start2 && start1) { |
1518 // 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. |
1519 const Element* owner1 = attr1->ownerElement(); | 1516 const Element* owner1 = attr1->ownerElement(); |
1520 owner1->synchronizeAllAttributes(); | |
1521 AttributeCollection attributes = owner1->attributes(); | 1517 AttributeCollection attributes = owner1->attributes(); |
1522 AttributeCollection::const_iterator end = attributes.end(); | 1518 AttributeCollection::const_iterator end = attributes.end(); |
1523 for (AttributeCollection::const_iterator it = attributes.begin(); it !=
end; ++it) { | 1519 for (AttributeCollection::const_iterator it = attributes.begin(); it !=
end; ++it) { |
1524 // 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 |
1525 // 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 |
1526 // 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, |
1527 // 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 |
1528 // the order between existing attributes. | 1524 // the order between existing attributes. |
1529 if (attr1->qualifiedName() == it->name()) | 1525 if (attr1->qualifiedName() == it->name()) |
1530 return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSI
TION_FOLLOWING; | 1526 return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSI
TION_FOLLOWING; |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2490 node->showTreeForThis(); | 2486 node->showTreeForThis(); |
2491 } | 2487 } |
2492 | 2488 |
2493 void showNodePath(const blink::Node* node) | 2489 void showNodePath(const blink::Node* node) |
2494 { | 2490 { |
2495 if (node) | 2491 if (node) |
2496 node->showNodePathForThis(); | 2492 node->showNodePathForThis(); |
2497 } | 2493 } |
2498 | 2494 |
2499 #endif | 2495 #endif |
OLD | NEW |