| 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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 6 * rights reserved. | 6 * rights reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * | 10 * |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 return attr->ownerElement()->lookupNamespaceURI(prefix); | 1281 return attr->ownerElement()->lookupNamespaceURI(prefix); |
| 1282 return g_null_atom; | 1282 return g_null_atom; |
| 1283 } | 1283 } |
| 1284 default: | 1284 default: |
| 1285 if (Element* parent = parentElement()) | 1285 if (Element* parent = parentElement()) |
| 1286 return parent->lookupNamespaceURI(prefix); | 1286 return parent->lookupNamespaceURI(prefix); |
| 1287 return g_null_atom; | 1287 return g_null_atom; |
| 1288 } | 1288 } |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 String Node::textContent(bool convert_b_rs_to_newlines) const { | 1291 String Node::textContent(bool convert_brs_to_newlines) const { |
| 1292 // This covers ProcessingInstruction and Comment that should return their | 1292 // This covers ProcessingInstruction and Comment that should return their |
| 1293 // value when .textContent is accessed on them, but should be ignored when | 1293 // value when .textContent is accessed on them, but should be ignored when |
| 1294 // iterated over as a descendant of a ContainerNode. | 1294 // iterated over as a descendant of a ContainerNode. |
| 1295 if (IsCharacterDataNode()) | 1295 if (IsCharacterDataNode()) |
| 1296 return ToCharacterData(this)->data(); | 1296 return ToCharacterData(this)->data(); |
| 1297 | 1297 |
| 1298 // Attribute nodes have their attribute values as textContent. | 1298 // Attribute nodes have their attribute values as textContent. |
| 1299 if (IsAttributeNode()) | 1299 if (IsAttributeNode()) |
| 1300 return ToAttr(this)->value(); | 1300 return ToAttr(this)->value(); |
| 1301 | 1301 |
| 1302 // Documents and non-container nodes (that are not CharacterData) | 1302 // Documents and non-container nodes (that are not CharacterData) |
| 1303 // have null textContent. | 1303 // have null textContent. |
| 1304 if (IsDocumentNode() || !IsContainerNode()) | 1304 if (IsDocumentNode() || !IsContainerNode()) |
| 1305 return String(); | 1305 return String(); |
| 1306 | 1306 |
| 1307 StringBuilder content; | 1307 StringBuilder content; |
| 1308 for (const Node& node : NodeTraversal::InclusiveDescendantsOf(*this)) { | 1308 for (const Node& node : NodeTraversal::InclusiveDescendantsOf(*this)) { |
| 1309 if (isHTMLBRElement(node) && convert_b_rs_to_newlines) { | 1309 if (isHTMLBRElement(node) && convert_brs_to_newlines) { |
| 1310 content.Append('\n'); | 1310 content.Append('\n'); |
| 1311 } else if (node.IsTextNode()) { | 1311 } else if (node.IsTextNode()) { |
| 1312 content.Append(ToText(node).data()); | 1312 content.Append(ToText(node).data()); |
| 1313 } | 1313 } |
| 1314 } | 1314 } |
| 1315 return content.ToString(); | 1315 return content.ToString(); |
| 1316 } | 1316 } |
| 1317 | 1317 |
| 1318 void Node::setTextContent(const String& text) { | 1318 void Node::setTextContent(const String& text) { |
| 1319 switch (getNodeType()) { | 1319 switch (getNodeType()) { |
| (...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2531 if (node) { | 2531 if (node) { |
| 2532 std::stringstream stream; | 2532 std::stringstream stream; |
| 2533 node->PrintNodePathTo(stream); | 2533 node->PrintNodePathTo(stream); |
| 2534 LOG(INFO) << stream.str(); | 2534 LOG(INFO) << stream.str(); |
| 2535 } else { | 2535 } else { |
| 2536 LOG(INFO) << "Cannot showNodePath for <null>"; | 2536 LOG(INFO) << "Cannot showNodePath for <null>"; |
| 2537 } | 2537 } |
| 2538 } | 2538 } |
| 2539 | 2539 |
| 2540 #endif | 2540 #endif |
| OLD | NEW |