| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return *set; | 117 return *set; |
| 118 } | 118 } |
| 119 #endif | 119 #endif |
| 120 | 120 |
| 121 void Node::dumpStatistics() | 121 void Node::dumpStatistics() |
| 122 { | 122 { |
| 123 #if DUMP_NODE_STATISTICS | 123 #if DUMP_NODE_STATISTICS |
| 124 size_t nodesWithRareData = 0; | 124 size_t nodesWithRareData = 0; |
| 125 | 125 |
| 126 size_t elementNodes = 0; | 126 size_t elementNodes = 0; |
| 127 size_t attrNodes = 0; | |
| 128 size_t textNodes = 0; | 127 size_t textNodes = 0; |
| 129 size_t piNodes = 0; | 128 size_t piNodes = 0; |
| 130 size_t documentNodes = 0; | 129 size_t documentNodes = 0; |
| 131 size_t docTypeNodes = 0; | 130 size_t docTypeNodes = 0; |
| 132 size_t fragmentNodes = 0; | 131 size_t fragmentNodes = 0; |
| 133 size_t shadowRootNodes = 0; | 132 size_t shadowRootNodes = 0; |
| 134 | 133 |
| 135 HashMap<String, size_t> perTagCount; | 134 HashMap<String, size_t> perTagCount; |
| 136 | 135 |
| 137 size_t attributes = 0; | 136 size_t attributes = 0; |
| 138 size_t elementsWithAttributeStorage = 0; | 137 size_t elementsWithAttributeStorage = 0; |
| 139 size_t elementsWithRareData = 0; | 138 size_t elementsWithRareData = 0; |
| 140 size_t elementsWithNamedNodeMap = 0; | |
| 141 | 139 |
| 142 for (WeakNodeSet::iterator it = liveNodeSet().begin(); it != liveNodeSet().e
nd(); ++it) { | 140 for (WeakNodeSet::iterator it = liveNodeSet().begin(); it != liveNodeSet().e
nd(); ++it) { |
| 143 Node* node = *it; | 141 Node* node = *it; |
| 144 | 142 |
| 145 if (node->hasRareData()) { | 143 if (node->hasRareData()) { |
| 146 ++nodesWithRareData; | 144 ++nodesWithRareData; |
| 147 if (node->isElementNode()) { | 145 if (node->isElementNode()) { |
| 148 ++elementsWithRareData; | 146 ++elementsWithRareData; |
| 149 if (toElement(node)->hasNamedNodeMap()) | |
| 150 ++elementsWithNamedNodeMap; | |
| 151 } | 147 } |
| 152 } | 148 } |
| 153 | 149 |
| 154 switch (node->nodeType()) { | 150 switch (node->nodeType()) { |
| 155 case ELEMENT_NODE: { | 151 case ELEMENT_NODE: { |
| 156 ++elementNodes; | 152 ++elementNodes; |
| 157 | 153 |
| 158 // Tag stats | 154 // Tag stats |
| 159 Element* element = toElement(node); | 155 Element* element = toElement(node); |
| 160 HashMap<String, size_t>::AddResult result = perTagCount.add(elem
ent->tagName(), 1); | 156 HashMap<String, size_t>::AddResult result = perTagCount.add(elem
ent->tagName(), 1); |
| 161 if (!result.isNewEntry) | 157 if (!result.isNewEntry) |
| 162 result.storedValue->value++; | 158 result.storedValue->value++; |
| 163 | 159 |
| 164 if (const ElementData* elementData = element->elementData()) { | 160 if (const ElementData* elementData = element->elementData()) { |
| 165 attributes += elementData->attributes().size(); | 161 attributes += elementData->attributes().size(); |
| 166 ++elementsWithAttributeStorage; | 162 ++elementsWithAttributeStorage; |
| 167 } | 163 } |
| 168 break; | 164 break; |
| 169 } | 165 } |
| 170 case ATTRIBUTE_NODE: { | |
| 171 ++attrNodes; | |
| 172 break; | |
| 173 } | |
| 174 case TEXT_NODE: { | 166 case TEXT_NODE: { |
| 175 ++textNodes; | 167 ++textNodes; |
| 176 break; | 168 break; |
| 177 } | 169 } |
| 178 case DOCUMENT_NODE: { | 170 case DOCUMENT_NODE: { |
| 179 ++documentNodes; | 171 ++documentNodes; |
| 180 break; | 172 break; |
| 181 } | 173 } |
| 182 case DOCUMENT_FRAGMENT_NODE: { | 174 case DOCUMENT_FRAGMENT_NODE: { |
| 183 if (node->isShadowRoot()) | 175 if (node->isShadowRoot()) |
| 184 ++shadowRootNodes; | 176 ++shadowRootNodes; |
| 185 else | 177 else |
| 186 ++fragmentNodes; | 178 ++fragmentNodes; |
| 187 break; | 179 break; |
| 188 } | 180 } |
| 189 } | 181 } |
| 190 } | 182 } |
| 191 | 183 |
| 192 printf("Number of Nodes: %d\n\n", liveNodeSet().size()); | 184 printf("Number of Nodes: %d\n\n", liveNodeSet().size()); |
| 193 printf("Number of Nodes with RareData: %zu\n\n", nodesWithRareData); | 185 printf("Number of Nodes with RareData: %zu\n\n", nodesWithRareData); |
| 194 | 186 |
| 195 printf("NodeType distribution:\n"); | 187 printf("NodeType distribution:\n"); |
| 196 printf(" Number of Element nodes: %zu\n", elementNodes); | 188 printf(" Number of Element nodes: %zu\n", elementNodes); |
| 197 printf(" Number of Attribute nodes: %zu\n", attrNodes); | |
| 198 printf(" Number of Text nodes: %zu\n", textNodes); | 189 printf(" Number of Text nodes: %zu\n", textNodes); |
| 199 printf(" Number of Document nodes: %zu\n", documentNodes); | 190 printf(" Number of Document nodes: %zu\n", documentNodes); |
| 200 printf(" Number of DocumentType nodes: %zu\n", docTypeNodes); | 191 printf(" Number of DocumentType nodes: %zu\n", docTypeNodes); |
| 201 printf(" Number of DocumentFragment nodes: %zu\n", fragmentNodes); | 192 printf(" Number of DocumentFragment nodes: %zu\n", fragmentNodes); |
| 202 printf(" Number of ShadowRoot nodes: %zu\n", shadowRootNodes); | 193 printf(" Number of ShadowRoot nodes: %zu\n", shadowRootNodes); |
| 203 | 194 |
| 204 printf("Element tag name distibution:\n"); | 195 printf("Element tag name distibution:\n"); |
| 205 for (HashMap<String, size_t>::iterator it = perTagCount.begin(); it != perTa
gCount.end(); ++it) | 196 for (HashMap<String, size_t>::iterator it = perTagCount.begin(); it != perTa
gCount.end(); ++it) |
| 206 printf(" Number of <%s> tags: %zu\n", it->key.utf8().data(), it->value)
; | 197 printf(" Number of <%s> tags: %zu\n", it->key.utf8().data(), it->value)
; |
| 207 | 198 |
| 208 printf("Attributes:\n"); | 199 printf("Attributes:\n"); |
| 209 printf(" Number of Attributes (non-Node and Node): %zu [%zu]\n", attributes
, sizeof(Attribute)); | 200 printf(" Number of Attributes (non-Node and Node): %zu [%zu]\n", attributes
, sizeof(Attribute)); |
| 210 printf(" Number of Elements with attribute storage: %zu [%zu]\n", elementsW
ithAttributeStorage, sizeof(ElementData)); | 201 printf(" Number of Elements with attribute storage: %zu [%zu]\n", elementsW
ithAttributeStorage, sizeof(ElementData)); |
| 211 printf(" Number of Elements with RareData: %zu\n", elementsWithRareData); | 202 printf(" Number of Elements with RareData: %zu\n", elementsWithRareData); |
| 212 printf(" Number of Elements with NamedNodeMap: %zu [%zu]\n", elementsWithNa
medNodeMap, sizeof(NamedNodeMap)); | |
| 213 #endif | 203 #endif |
| 214 } | 204 } |
| 215 | 205 |
| 216 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, nodeCounter, ("WebCoreNode"
)); | 206 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, nodeCounter, ("WebCoreNode"
)); |
| 217 | 207 |
| 218 void Node::trackForDebugging() | 208 void Node::trackForDebugging() |
| 219 { | 209 { |
| 220 #ifndef NDEBUG | 210 #ifndef NDEBUG |
| 221 nodeCounter.increment(); | 211 nodeCounter.increment(); |
| 222 #endif | 212 #endif |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 395 |
| 406 void Node::normalize() | 396 void Node::normalize() |
| 407 { | 397 { |
| 408 // Go through the subtree beneath us, normalizing all nodes. This means that | 398 // Go through the subtree beneath us, normalizing all nodes. This means that |
| 409 // any two adjacent text nodes are merged and any empty text nodes are remov
ed. | 399 // any two adjacent text nodes are merged and any empty text nodes are remov
ed. |
| 410 | 400 |
| 411 RefPtr<Node> node = this; | 401 RefPtr<Node> node = this; |
| 412 while (Node* firstChild = node->firstChild()) | 402 while (Node* firstChild = node->firstChild()) |
| 413 node = firstChild; | 403 node = firstChild; |
| 414 while (node) { | 404 while (node) { |
| 415 if (node->isElementNode()) | |
| 416 toElement(node)->normalizeAttributes(); | |
| 417 | |
| 418 if (node == this) | 405 if (node == this) |
| 419 break; | 406 break; |
| 420 | 407 |
| 421 if (node->nodeType() == TEXT_NODE) | 408 if (node->nodeType() == TEXT_NODE) |
| 422 node = toText(node)->mergeNextSiblingNodesIfPossible(); | 409 node = toText(node)->mergeNextSiblingNodesIfPossible(); |
| 423 else | 410 else |
| 424 node = NodeTraversal::nextPostOrder(*node); | 411 node = NodeTraversal::nextPostOrder(*node); |
| 425 } | 412 } |
| 426 } | 413 } |
| 427 | 414 |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 return content.toString(); | 1098 return content.toString(); |
| 1112 } | 1099 } |
| 1113 | 1100 |
| 1114 void Node::setTextContent(const String& text) | 1101 void Node::setTextContent(const String& text) |
| 1115 { | 1102 { |
| 1116 switch (nodeType()) { | 1103 switch (nodeType()) { |
| 1117 case TEXT_NODE: | 1104 case TEXT_NODE: |
| 1118 setNodeValue(text); | 1105 setNodeValue(text); |
| 1119 return; | 1106 return; |
| 1120 case ELEMENT_NODE: | 1107 case ELEMENT_NODE: |
| 1121 case ATTRIBUTE_NODE: | |
| 1122 case DOCUMENT_FRAGMENT_NODE: { | 1108 case DOCUMENT_FRAGMENT_NODE: { |
| 1123 // FIXME: Merge this logic into replaceChildrenWithText. | 1109 // FIXME: Merge this logic into replaceChildrenWithText. |
| 1124 RefPtr<ContainerNode> container = toContainerNode(this); | 1110 RefPtr<ContainerNode> container = toContainerNode(this); |
| 1125 | 1111 |
| 1126 // Note: This is an intentional optimization. | 1112 // Note: This is an intentional optimization. |
| 1127 // See crbug.com/352836 also. | 1113 // See crbug.com/352836 also. |
| 1128 // No need to do anything if the text is identical. | 1114 // No need to do anything if the text is identical. |
| 1129 if (container->hasOneTextChild() && toText(container->firstChild())-
>data() == text) | 1115 if (container->hasOneTextChild() && toText(container->firstChild())-
>data() == text) |
| 1130 return; | 1116 return; |
| 1131 | 1117 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1151 | 1137 |
| 1152 unsigned short Node::compareDocumentPosition(const Node* otherNode, ShadowTreesT
reatment treatment) const | 1138 unsigned short Node::compareDocumentPosition(const Node* otherNode, ShadowTreesT
reatment treatment) const |
| 1153 { | 1139 { |
| 1154 // It is not clear what should be done if |otherNode| is 0. | 1140 // It is not clear what should be done if |otherNode| is 0. |
| 1155 if (!otherNode) | 1141 if (!otherNode) |
| 1156 return DOCUMENT_POSITION_DISCONNECTED; | 1142 return DOCUMENT_POSITION_DISCONNECTED; |
| 1157 | 1143 |
| 1158 if (otherNode == this) | 1144 if (otherNode == this) |
| 1159 return DOCUMENT_POSITION_EQUIVALENT; | 1145 return DOCUMENT_POSITION_EQUIVALENT; |
| 1160 | 1146 |
| 1161 const Attr* attr1 = nodeType() == ATTRIBUTE_NODE ? toAttr(this) : 0; | 1147 const Node* start1 = this; |
| 1162 const Attr* attr2 = otherNode->nodeType() == ATTRIBUTE_NODE ? toAttr(otherNo
de) : 0; | 1148 const Node* start2 = otherNode; |
| 1163 | |
| 1164 const Node* start1 = attr1 ? attr1->ownerElement() : this; | |
| 1165 const Node* start2 = attr2 ? attr2->ownerElement() : otherNode; | |
| 1166 | 1149 |
| 1167 // If either of start1 or start2 is null, then we are disconnected, since on
e of the nodes is | 1150 // If either of start1 or start2 is null, then we are disconnected, since on
e of the nodes is |
| 1168 // an orphaned attribute node. | 1151 // an orphaned attribute node. |
| 1169 if (!start1 || !start2) { | 1152 if (!start1 || !start2) { |
| 1170 unsigned short direction = (this > otherNode) ? DOCUMENT_POSITION_PRECED
ING : DOCUMENT_POSITION_FOLLOWING; | 1153 unsigned short direction = (this > otherNode) ? DOCUMENT_POSITION_PRECED
ING : DOCUMENT_POSITION_FOLLOWING; |
| 1171 return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION
_SPECIFIC | direction; | 1154 return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION
_SPECIFIC | direction; |
| 1172 } | 1155 } |
| 1173 | 1156 |
| 1174 Vector<const Node*, 16> chain1; | 1157 Vector<const Node*, 16> chain1; |
| 1175 Vector<const Node*, 16> chain2; | 1158 Vector<const Node*, 16> chain2; |
| 1176 if (attr1) | |
| 1177 chain1.append(attr1); | |
| 1178 if (attr2) | |
| 1179 chain2.append(attr2); | |
| 1180 | |
| 1181 // FIXME(sky): Attrs are not nodes, remove all this code. | |
| 1182 if (attr1 && attr2 && start1 == start2 && start1) { | |
| 1183 // We are comparing two attributes on the same node. Crawl our attribute
map and see which one we hit first. | |
| 1184 const Element* owner1 = attr1->ownerElement(); | |
| 1185 AttributeCollection attributes = owner1->attributes(); | |
| 1186 AttributeCollection::iterator end = attributes.end(); | |
| 1187 for (AttributeCollection::iterator it = attributes.begin(); it != end; +
+it) { | |
| 1188 // If neither of the two determining nodes is a child node and nodeT
ype is the same for both determining nodes, then an | |
| 1189 // implementation-dependent order between the determining nodes is r
eturned. This order is stable as long as no nodes of | |
| 1190 // the same nodeType are inserted into or removed from the direct co
ntainer. This would be the case, for example, | |
| 1191 // when comparing two attributes of the same element, and inserting
or removing additional attributes might change | |
| 1192 // the order between existing attributes. | |
| 1193 if (attr1->name() == it->localName()) | |
| 1194 return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSI
TION_FOLLOWING; | |
| 1195 if (attr2->name() == it->localName()) | |
| 1196 return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSI
TION_PRECEDING; | |
| 1197 } | |
| 1198 | |
| 1199 ASSERT_NOT_REACHED(); | |
| 1200 return DOCUMENT_POSITION_DISCONNECTED; | |
| 1201 } | |
| 1202 | 1159 |
| 1203 // If one node is in the document and the other is not, we must be disconnec
ted. | 1160 // If one node is in the document and the other is not, we must be disconnec
ted. |
| 1204 // If the nodes have different owning documents, they must be disconnected.
Note that we avoid | 1161 // If the nodes have different owning documents, they must be disconnected.
Note that we avoid |
| 1205 // comparing Attr nodes here, since they return false from inDocument() all
the time (which seems like a bug). | 1162 // comparing Attr nodes here, since they return false from inDocument() all
the time (which seems like a bug). |
| 1206 if (start1->inDocument() != start2->inDocument() || (treatment == TreatShado
wTreesAsDisconnected && start1->treeScope() != start2->treeScope())) { | 1163 if (start1->inDocument() != start2->inDocument() || (treatment == TreatShado
wTreesAsDisconnected && start1->treeScope() != start2->treeScope())) { |
| 1207 unsigned short direction = (this > otherNode) ? DOCUMENT_POSITION_PRECED
ING : DOCUMENT_POSITION_FOLLOWING; | 1164 unsigned short direction = (this > otherNode) ? DOCUMENT_POSITION_PRECED
ING : DOCUMENT_POSITION_FOLLOWING; |
| 1208 return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION
_SPECIFIC | direction; | 1165 return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION
_SPECIFIC | direction; |
| 1209 } | 1166 } |
| 1210 | 1167 |
| 1211 // We need to find a common ancestor container, and then compare the indices
of the two immediate children. | 1168 // We need to find a common ancestor container, and then compare the indices
of the two immediate children. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1224 return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION
_SPECIFIC | direction; | 1181 return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION
_SPECIFIC | direction; |
| 1225 } | 1182 } |
| 1226 | 1183 |
| 1227 unsigned connection = start1->treeScope() != start2->treeScope() ? DOCUMENT_
POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC : 0; | 1184 unsigned connection = start1->treeScope() != start2->treeScope() ? DOCUMENT_
POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC : 0; |
| 1228 | 1185 |
| 1229 // Walk the two chains backwards and look for the first difference. | 1186 // Walk the two chains backwards and look for the first difference. |
| 1230 for (unsigned i = std::min(index1, index2); i; --i) { | 1187 for (unsigned i = std::min(index1, index2); i; --i) { |
| 1231 const Node* child1 = chain1[--index1]; | 1188 const Node* child1 = chain1[--index1]; |
| 1232 const Node* child2 = chain2[--index2]; | 1189 const Node* child2 = chain2[--index2]; |
| 1233 if (child1 != child2) { | 1190 if (child1 != child2) { |
| 1234 // If one of the children is an attribute, it wins. | |
| 1235 if (child1->nodeType() == ATTRIBUTE_NODE) | |
| 1236 return DOCUMENT_POSITION_FOLLOWING | connection; | |
| 1237 if (child2->nodeType() == ATTRIBUTE_NODE) | |
| 1238 return DOCUMENT_POSITION_PRECEDING | connection; | |
| 1239 | |
| 1240 // If one of the children is a shadow root, | 1191 // If one of the children is a shadow root, |
| 1241 if (child1->isShadowRoot() || child2->isShadowRoot()) { | 1192 if (child1->isShadowRoot() || child2->isShadowRoot()) { |
| 1242 if (!child2->isShadowRoot()) | 1193 if (!child2->isShadowRoot()) |
| 1243 return Node::DOCUMENT_POSITION_FOLLOWING | connection; | 1194 return Node::DOCUMENT_POSITION_FOLLOWING | connection; |
| 1244 if (!child1->isShadowRoot()) | 1195 if (!child1->isShadowRoot()) |
| 1245 return Node::DOCUMENT_POSITION_PRECEDING | connection; | 1196 return Node::DOCUMENT_POSITION_PRECEDING | connection; |
| 1246 | 1197 |
| 1247 for (ShadowRoot* child = toShadowRoot(child2)->olderShadowRoot()
; child; child = child->olderShadowRoot()) | 1198 for (ShadowRoot* child = toShadowRoot(child2)->olderShadowRoot()
; child; child = child->olderShadowRoot()) |
| 1248 if (child == child1) | 1199 if (child == child1) |
| 1249 return Node::DOCUMENT_POSITION_FOLLOWING | connection; | 1200 return Node::DOCUMENT_POSITION_FOLLOWING | connection; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 else | 1325 else |
| 1375 fprintf(stderr, "[%d]", count); | 1326 fprintf(stderr, "[%d]", count); |
| 1376 } else if (hasIdAttr) { | 1327 } else if (hasIdAttr) { |
| 1377 fprintf(stderr, "[@id=\"%s\"]", idattr.utf8().data()); | 1328 fprintf(stderr, "[@id=\"%s\"]", idattr.utf8().data()); |
| 1378 } | 1329 } |
| 1379 break; | 1330 break; |
| 1380 } | 1331 } |
| 1381 case TEXT_NODE: | 1332 case TEXT_NODE: |
| 1382 fprintf(stderr, "/text()"); | 1333 fprintf(stderr, "/text()"); |
| 1383 break; | 1334 break; |
| 1384 case ATTRIBUTE_NODE: | |
| 1385 fprintf(stderr, "/@%s", node->nodeName().utf8().data()); | |
| 1386 break; | |
| 1387 default: | 1335 default: |
| 1388 break; | 1336 break; |
| 1389 } | 1337 } |
| 1390 } | 1338 } |
| 1391 fprintf(stderr, "\n"); | 1339 fprintf(stderr, "\n"); |
| 1392 } | 1340 } |
| 1393 | 1341 |
| 1394 static void traverseTreeAndMark(const String& baseIndent, const Node* rootNode,
const Node* markedNode1, const char* markedLabel1, const Node* markedNode2, cons
t char* markedLabel2) | 1342 static void traverseTreeAndMark(const String& baseIndent, const Node* rootNode,
const Node* markedNode1, const char* markedLabel1, const Node* markedNode2, cons
t char* markedLabel2) |
| 1395 { | 1343 { |
| 1396 for (const Node* node = rootNode; node; node = NodeTraversal::next(*node)) { | 1344 for (const Node* node = rootNode; node; node = NodeTraversal::next(*node)) { |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 EventTarget::trace(visitor); | 1948 EventTarget::trace(visitor); |
| 2001 } | 1949 } |
| 2002 | 1950 |
| 2003 unsigned Node::lengthOfContents() const | 1951 unsigned Node::lengthOfContents() const |
| 2004 { | 1952 { |
| 2005 // This switch statement must be consistent with that of Range::processConte
ntsBetweenOffsets. | 1953 // This switch statement must be consistent with that of Range::processConte
ntsBetweenOffsets. |
| 2006 switch (nodeType()) { | 1954 switch (nodeType()) { |
| 2007 case Node::TEXT_NODE: | 1955 case Node::TEXT_NODE: |
| 2008 return toCharacterData(this)->length(); | 1956 return toCharacterData(this)->length(); |
| 2009 case Node::ELEMENT_NODE: | 1957 case Node::ELEMENT_NODE: |
| 2010 case Node::ATTRIBUTE_NODE: | |
| 2011 case Node::DOCUMENT_NODE: | 1958 case Node::DOCUMENT_NODE: |
| 2012 case Node::DOCUMENT_FRAGMENT_NODE: | 1959 case Node::DOCUMENT_FRAGMENT_NODE: |
| 2013 return toContainerNode(this)->countChildren(); | 1960 return toContainerNode(this)->countChildren(); |
| 2014 return 0; | 1961 return 0; |
| 2015 } | 1962 } |
| 2016 ASSERT_NOT_REACHED(); | 1963 ASSERT_NOT_REACHED(); |
| 2017 return 0; | 1964 return 0; |
| 2018 } | 1965 } |
| 2019 | 1966 |
| 2020 v8::Handle<v8::Object> Node::wrap(v8::Handle<v8::Object> creationContext, v8::Is
olate* isolate) | 1967 v8::Handle<v8::Object> Node::wrap(v8::Handle<v8::Object> creationContext, v8::Is
olate* isolate) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2048 node->showTreeForThis(); | 1995 node->showTreeForThis(); |
| 2049 } | 1996 } |
| 2050 | 1997 |
| 2051 void showNodePath(const blink::Node* node) | 1998 void showNodePath(const blink::Node* node) |
| 2052 { | 1999 { |
| 2053 if (node) | 2000 if (node) |
| 2054 node->showNodePathForThis(); | 2001 node->showNodePathForThis(); |
| 2055 } | 2002 } |
| 2056 | 2003 |
| 2057 #endif | 2004 #endif |
| OLD | NEW |