| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 #endif | 133 #endif |
| 134 | 134 |
| 135 void Node::dumpStatistics() | 135 void Node::dumpStatistics() |
| 136 { | 136 { |
| 137 #if DUMP_NODE_STATISTICS | 137 #if DUMP_NODE_STATISTICS |
| 138 size_t nodesWithRareData = 0; | 138 size_t nodesWithRareData = 0; |
| 139 | 139 |
| 140 size_t elementNodes = 0; | 140 size_t elementNodes = 0; |
| 141 size_t attrNodes = 0; | 141 size_t attrNodes = 0; |
| 142 size_t textNodes = 0; | 142 size_t textNodes = 0; |
| 143 size_t cdataNodes = 0; | |
| 144 size_t commentNodes = 0; | 143 size_t commentNodes = 0; |
| 145 size_t piNodes = 0; | 144 size_t piNodes = 0; |
| 146 size_t documentNodes = 0; | 145 size_t documentNodes = 0; |
| 147 size_t docTypeNodes = 0; | 146 size_t docTypeNodes = 0; |
| 148 size_t fragmentNodes = 0; | 147 size_t fragmentNodes = 0; |
| 149 size_t shadowRootNodes = 0; | 148 size_t shadowRootNodes = 0; |
| 150 | 149 |
| 151 HashMap<String, size_t> perTagCount; | 150 HashMap<String, size_t> perTagCount; |
| 152 | 151 |
| 153 size_t attributes = 0; | 152 size_t attributes = 0; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 182 break; | 181 break; |
| 183 } | 182 } |
| 184 case ATTRIBUTE_NODE: { | 183 case ATTRIBUTE_NODE: { |
| 185 ++attrNodes; | 184 ++attrNodes; |
| 186 break; | 185 break; |
| 187 } | 186 } |
| 188 case TEXT_NODE: { | 187 case TEXT_NODE: { |
| 189 ++textNodes; | 188 ++textNodes; |
| 190 break; | 189 break; |
| 191 } | 190 } |
| 192 case CDATA_SECTION_NODE: { | |
| 193 ++cdataNodes; | |
| 194 break; | |
| 195 } | |
| 196 case COMMENT_NODE: { | 191 case COMMENT_NODE: { |
| 197 ++commentNodes; | 192 ++commentNodes; |
| 198 break; | 193 break; |
| 199 } | 194 } |
| 200 case PROCESSING_INSTRUCTION_NODE: { | 195 case PROCESSING_INSTRUCTION_NODE: { |
| 201 ++piNodes; | 196 ++piNodes; |
| 202 break; | 197 break; |
| 203 } | 198 } |
| 204 case DOCUMENT_NODE: { | 199 case DOCUMENT_NODE: { |
| 205 ++documentNodes; | 200 ++documentNodes; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 219 } | 214 } |
| 220 } | 215 } |
| 221 | 216 |
| 222 printf("Number of Nodes: %d\n\n", liveNodeSet().size()); | 217 printf("Number of Nodes: %d\n\n", liveNodeSet().size()); |
| 223 printf("Number of Nodes with RareData: %zu\n\n", nodesWithRareData); | 218 printf("Number of Nodes with RareData: %zu\n\n", nodesWithRareData); |
| 224 | 219 |
| 225 printf("NodeType distribution:\n"); | 220 printf("NodeType distribution:\n"); |
| 226 printf(" Number of Element nodes: %zu\n", elementNodes); | 221 printf(" Number of Element nodes: %zu\n", elementNodes); |
| 227 printf(" Number of Attribute nodes: %zu\n", attrNodes); | 222 printf(" Number of Attribute nodes: %zu\n", attrNodes); |
| 228 printf(" Number of Text nodes: %zu\n", textNodes); | 223 printf(" Number of Text nodes: %zu\n", textNodes); |
| 229 printf(" Number of CDATASection nodes: %zu\n", cdataNodes); | |
| 230 printf(" Number of Comment nodes: %zu\n", commentNodes); | 224 printf(" Number of Comment nodes: %zu\n", commentNodes); |
| 231 printf(" Number of ProcessingInstruction nodes: %zu\n", piNodes); | 225 printf(" Number of ProcessingInstruction nodes: %zu\n", piNodes); |
| 232 printf(" Number of Document nodes: %zu\n", documentNodes); | 226 printf(" Number of Document nodes: %zu\n", documentNodes); |
| 233 printf(" Number of DocumentType nodes: %zu\n", docTypeNodes); | 227 printf(" Number of DocumentType nodes: %zu\n", docTypeNodes); |
| 234 printf(" Number of DocumentFragment nodes: %zu\n", fragmentNodes); | 228 printf(" Number of DocumentFragment nodes: %zu\n", fragmentNodes); |
| 235 printf(" Number of ShadowRoot nodes: %zu\n", shadowRootNodes); | 229 printf(" Number of ShadowRoot nodes: %zu\n", shadowRootNodes); |
| 236 | 230 |
| 237 printf("Element tag name distibution:\n"); | 231 printf("Element tag name distibution:\n"); |
| 238 for (const auto& entry : perTagCount) | 232 for (const auto& entry : perTagCount) |
| 239 printf(" Number of <%s> tags: %zu\n", entry.key.utf8().data(), entry.va
lue); | 233 printf(" Number of <%s> tags: %zu\n", entry.key.utf8().data(), entry.va
lue); |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 content.append(toText(node).data()); | 1346 content.append(toText(node).data()); |
| 1353 } | 1347 } |
| 1354 } | 1348 } |
| 1355 return content.toString(); | 1349 return content.toString(); |
| 1356 } | 1350 } |
| 1357 | 1351 |
| 1358 void Node::setTextContent(const String& text) | 1352 void Node::setTextContent(const String& text) |
| 1359 { | 1353 { |
| 1360 switch (nodeType()) { | 1354 switch (nodeType()) { |
| 1361 case TEXT_NODE: | 1355 case TEXT_NODE: |
| 1362 case CDATA_SECTION_NODE: | |
| 1363 case COMMENT_NODE: | 1356 case COMMENT_NODE: |
| 1364 case PROCESSING_INSTRUCTION_NODE: | 1357 case PROCESSING_INSTRUCTION_NODE: |
| 1365 setNodeValue(text); | 1358 setNodeValue(text); |
| 1366 return; | 1359 return; |
| 1367 case ELEMENT_NODE: | 1360 case ELEMENT_NODE: |
| 1368 case ATTRIBUTE_NODE: | 1361 case ATTRIBUTE_NODE: |
| 1369 case DOCUMENT_FRAGMENT_NODE: { | 1362 case DOCUMENT_FRAGMENT_NODE: { |
| 1370 // FIXME: Merge this logic into replaceChildrenWithText. | 1363 // FIXME: Merge this logic into replaceChildrenWithText. |
| 1371 RefPtrWillBeRawPtr<ContainerNode> container = toContainerNode(this); | 1364 RefPtrWillBeRawPtr<ContainerNode> container = toContainerNode(this); |
| 1372 | 1365 |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 visitor->trace(m_treeScope); | 2364 visitor->trace(m_treeScope); |
| 2372 #endif | 2365 #endif |
| 2373 EventTarget::trace(visitor); | 2366 EventTarget::trace(visitor); |
| 2374 } | 2367 } |
| 2375 | 2368 |
| 2376 unsigned Node::lengthOfContents() const | 2369 unsigned Node::lengthOfContents() const |
| 2377 { | 2370 { |
| 2378 // This switch statement must be consistent with that of Range::processConte
ntsBetweenOffsets. | 2371 // This switch statement must be consistent with that of Range::processConte
ntsBetweenOffsets. |
| 2379 switch (nodeType()) { | 2372 switch (nodeType()) { |
| 2380 case Node::TEXT_NODE: | 2373 case Node::TEXT_NODE: |
| 2381 case Node::CDATA_SECTION_NODE: | |
| 2382 case Node::COMMENT_NODE: | 2374 case Node::COMMENT_NODE: |
| 2383 return toCharacterData(this)->length(); | 2375 return toCharacterData(this)->length(); |
| 2384 case Node::PROCESSING_INSTRUCTION_NODE: | 2376 case Node::PROCESSING_INSTRUCTION_NODE: |
| 2385 return toProcessingInstruction(this)->data().length(); | 2377 return toProcessingInstruction(this)->data().length(); |
| 2386 case Node::ELEMENT_NODE: | 2378 case Node::ELEMENT_NODE: |
| 2387 case Node::ATTRIBUTE_NODE: | 2379 case Node::ATTRIBUTE_NODE: |
| 2388 case Node::DOCUMENT_NODE: | 2380 case Node::DOCUMENT_NODE: |
| 2389 case Node::DOCUMENT_FRAGMENT_NODE: | 2381 case Node::DOCUMENT_FRAGMENT_NODE: |
| 2390 return toContainerNode(this)->countChildren(); | 2382 return toContainerNode(this)->countChildren(); |
| 2391 case Node::DOCUMENT_TYPE_NODE: | 2383 case Node::DOCUMENT_TYPE_NODE: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2435 node->showTreeForThis(); | 2427 node->showTreeForThis(); |
| 2436 } | 2428 } |
| 2437 | 2429 |
| 2438 void showNodePath(const blink::Node* node) | 2430 void showNodePath(const blink::Node* node) |
| 2439 { | 2431 { |
| 2440 if (node) | 2432 if (node) |
| 2441 node->showNodePathForThis(); | 2433 node->showNodePathForThis(); |
| 2442 } | 2434 } |
| 2443 | 2435 |
| 2444 #endif | 2436 #endif |
| OLD | NEW |