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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 for (Node* node : liveNodeSet()) { | 160 for (Node* node : liveNodeSet()) { |
161 if (node->hasRareData()) { | 161 if (node->hasRareData()) { |
162 ++nodesWithRareData; | 162 ++nodesWithRareData; |
163 if (node->isElementNode()) { | 163 if (node->isElementNode()) { |
164 ++elementsWithRareData; | 164 ++elementsWithRareData; |
165 if (toElement(node)->hasNamedNodeMap()) | 165 if (toElement(node)->hasNamedNodeMap()) |
166 ++elementsWithNamedNodeMap; | 166 ++elementsWithNamedNodeMap; |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 switch (node->nodeType()) { | 170 switch (node->getNodeType()) { |
171 case ELEMENT_NODE: { | 171 case ELEMENT_NODE: { |
172 ++elementNodes; | 172 ++elementNodes; |
173 | 173 |
174 // Tag stats | 174 // Tag stats |
175 Element* element = toElement(node); | 175 Element* element = toElement(node); |
176 HashMap<String, size_t>::AddResult result = perTagCount.add(elem
ent->tagName(), 1); | 176 HashMap<String, size_t>::AddResult result = perTagCount.add(elem
ent->tagName(), 1); |
177 if (!result.isNewEntry) | 177 if (!result.isNewEntry) |
178 result.storedValue->value++; | 178 result.storedValue->value++; |
179 | 179 |
180 if (const ElementData* elementData = element->elementData()) { | 180 if (const ElementData* elementData = element->elementData()) { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // Go through the subtree beneath us, normalizing all nodes. This means that | 512 // Go through the subtree beneath us, normalizing all nodes. This means that |
513 // any two adjacent text nodes are merged and any empty text nodes are remov
ed. | 513 // any two adjacent text nodes are merged and any empty text nodes are remov
ed. |
514 | 514 |
515 RefPtrWillBeRawPtr<Node> node = this; | 515 RefPtrWillBeRawPtr<Node> node = this; |
516 while (Node* firstChild = node->firstChild()) | 516 while (Node* firstChild = node->firstChild()) |
517 node = firstChild; | 517 node = firstChild; |
518 while (node) { | 518 while (node) { |
519 if (node == this) | 519 if (node == this) |
520 break; | 520 break; |
521 | 521 |
522 if (node->nodeType() == TEXT_NODE) | 522 if (node->getNodeType() == TEXT_NODE) |
523 node = toText(node)->mergeNextSiblingNodesIfPossible(); | 523 node = toText(node)->mergeNextSiblingNodesIfPossible(); |
524 else | 524 else |
525 node = NodeTraversal::nextPostOrder(*node); | 525 node = NodeTraversal::nextPostOrder(*node); |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 bool Node::isContentEditable(UserSelectAllTreatment treatment) const | 529 bool Node::isContentEditable(UserSelectAllTreatment treatment) const |
530 { | 530 { |
531 document().updateLayoutTreeIfNeeded(); | 531 document().updateLayoutTreeIfNeeded(); |
532 return hasEditableStyle(Editable, treatment); | 532 return hasEditableStyle(Editable, treatment); |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 if (!inActiveDocument()) | 721 if (!inActiveDocument()) |
722 return; | 722 return; |
723 | 723 |
724 TRACE_EVENT_INSTANT1( | 724 TRACE_EVENT_INSTANT1( |
725 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"), | 725 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"), |
726 "StyleRecalcInvalidationTracking", | 726 "StyleRecalcInvalidationTracking", |
727 TRACE_EVENT_SCOPE_THREAD, | 727 TRACE_EVENT_SCOPE_THREAD, |
728 "data", | 728 "data", |
729 InspectorStyleRecalcInvalidationTrackingEvent::data(this, reason)); | 729 InspectorStyleRecalcInvalidationTrackingEvent::data(this, reason)); |
730 | 730 |
731 StyleChangeType existingChangeType = styleChangeType(); | 731 StyleChangeType existingChangeType = getStyleChangeType(); |
732 if (changeType > existingChangeType) | 732 if (changeType > existingChangeType) |
733 setStyleChange(changeType); | 733 setStyleChange(changeType); |
734 | 734 |
735 if (existingChangeType == NoStyleChange) | 735 if (existingChangeType == NoStyleChange) |
736 markAncestorsWithChildNeedsStyleRecalc(); | 736 markAncestorsWithChildNeedsStyleRecalc(); |
737 | 737 |
738 if (isElementNode() && hasRareData()) | 738 if (isElementNode() && hasRareData()) |
739 toElement(*this).setAnimationStyleChange(false); | 739 toElement(*this).setAnimationStyleChange(false); |
740 } | 740 } |
741 | 741 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 ASSERT(!otherIterator); | 892 ASSERT(!otherIterator); |
893 return nullptr; | 893 return nullptr; |
894 } | 894 } |
895 | 895 |
896 void Node::reattach(const AttachContext& context) | 896 void Node::reattach(const AttachContext& context) |
897 { | 897 { |
898 AttachContext reattachContext(context); | 898 AttachContext reattachContext(context); |
899 reattachContext.performingReattach = true; | 899 reattachContext.performingReattach = true; |
900 | 900 |
901 // We only need to detach if the node has already been through attach(). | 901 // We only need to detach if the node has already been through attach(). |
902 if (styleChangeType() < NeedsReattachStyleChange) | 902 if (getStyleChangeType() < NeedsReattachStyleChange) |
903 detach(reattachContext); | 903 detach(reattachContext); |
904 attach(reattachContext); | 904 attach(reattachContext); |
905 } | 905 } |
906 | 906 |
907 void Node::attach(const AttachContext&) | 907 void Node::attach(const AttachContext&) |
908 { | 908 { |
909 ASSERT(document().inStyleRecalc() || isDocumentNode()); | 909 ASSERT(document().inStyleRecalc() || isDocumentNode()); |
910 ASSERT(!document().lifecycle().inDetach()); | 910 ASSERT(!document().lifecycle().inDetach()); |
911 ASSERT(needsAttach()); | 911 ASSERT(needsAttach()); |
912 ASSERT(!layoutObject() || (layoutObject()->style() && (layoutObject()->paren
t() || layoutObject()->isLayoutView()))); | 912 ASSERT(!layoutObject() || (layoutObject()->style() && (layoutObject()->paren
t() || layoutObject()->isLayoutView()))); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 const KURL& Node::baseURI() const | 1110 const KURL& Node::baseURI() const |
1111 { | 1111 { |
1112 return document().baseURL(); | 1112 return document().baseURL(); |
1113 } | 1113 } |
1114 | 1114 |
1115 bool Node::isEqualNode(Node* other) const | 1115 bool Node::isEqualNode(Node* other) const |
1116 { | 1116 { |
1117 if (!other) | 1117 if (!other) |
1118 return false; | 1118 return false; |
1119 | 1119 |
1120 NodeType nodeType = this->nodeType(); | 1120 NodeType nodeType = this->getNodeType(); |
1121 if (nodeType != other->nodeType()) | 1121 if (nodeType != other->getNodeType()) |
1122 return false; | 1122 return false; |
1123 | 1123 |
1124 if (nodeName() != other->nodeName()) | 1124 if (nodeName() != other->nodeName()) |
1125 return false; | 1125 return false; |
1126 | 1126 |
1127 if (nodeValue() != other->nodeValue()) | 1127 if (nodeValue() != other->nodeValue()) |
1128 return false; | 1128 return false; |
1129 | 1129 |
1130 if (isAttributeNode()) { | 1130 if (isAttributeNode()) { |
1131 if (toAttr(this)->localName() != toAttr(other)->localName()) | 1131 if (toAttr(this)->localName() != toAttr(other)->localName()) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1169 return false; | 1169 return false; |
1170 } | 1170 } |
1171 | 1171 |
1172 return true; | 1172 return true; |
1173 } | 1173 } |
1174 | 1174 |
1175 bool Node::isDefaultNamespace(const AtomicString& namespaceURIMaybeEmpty) const | 1175 bool Node::isDefaultNamespace(const AtomicString& namespaceURIMaybeEmpty) const |
1176 { | 1176 { |
1177 const AtomicString& namespaceURI = namespaceURIMaybeEmpty.isEmpty() ? nullAt
om : namespaceURIMaybeEmpty; | 1177 const AtomicString& namespaceURI = namespaceURIMaybeEmpty.isEmpty() ? nullAt
om : namespaceURIMaybeEmpty; |
1178 | 1178 |
1179 switch (nodeType()) { | 1179 switch (getNodeType()) { |
1180 case ELEMENT_NODE: { | 1180 case ELEMENT_NODE: { |
1181 const Element& element = toElement(*this); | 1181 const Element& element = toElement(*this); |
1182 | 1182 |
1183 if (element.prefix().isNull()) | 1183 if (element.prefix().isNull()) |
1184 return element.namespaceURI() == namespaceURI; | 1184 return element.namespaceURI() == namespaceURI; |
1185 | 1185 |
1186 AttributeCollection attributes = element.attributes(); | 1186 AttributeCollection attributes = element.attributes(); |
1187 for (const Attribute& attr : attributes) { | 1187 for (const Attribute& attr : attributes) { |
1188 if (attr.localName() == xmlnsAtom) | 1188 if (attr.localName() == xmlnsAtom) |
1189 return attr.value() == namespaceURI; | 1189 return attr.value() == namespaceURI; |
(...skipping 27 matching lines...) Expand all Loading... |
1217 const AtomicString& Node::lookupPrefix(const AtomicString& namespaceURI) const | 1217 const AtomicString& Node::lookupPrefix(const AtomicString& namespaceURI) const |
1218 { | 1218 { |
1219 // Implemented according to | 1219 // Implemented according to |
1220 // https://dom.spec.whatwg.org/#dom-node-lookupprefix | 1220 // https://dom.spec.whatwg.org/#dom-node-lookupprefix |
1221 | 1221 |
1222 if (namespaceURI.isEmpty() || namespaceURI.isNull()) | 1222 if (namespaceURI.isEmpty() || namespaceURI.isNull()) |
1223 return nullAtom; | 1223 return nullAtom; |
1224 | 1224 |
1225 const Element* context; | 1225 const Element* context; |
1226 | 1226 |
1227 switch (nodeType()) { | 1227 switch (getNodeType()) { |
1228 case ELEMENT_NODE: | 1228 case ELEMENT_NODE: |
1229 context = toElement(this); | 1229 context = toElement(this); |
1230 break; | 1230 break; |
1231 case DOCUMENT_NODE: | 1231 case DOCUMENT_NODE: |
1232 context = toDocument(this)->documentElement(); | 1232 context = toDocument(this)->documentElement(); |
1233 break; | 1233 break; |
1234 case DOCUMENT_FRAGMENT_NODE: | 1234 case DOCUMENT_FRAGMENT_NODE: |
1235 case DOCUMENT_TYPE_NODE: | 1235 case DOCUMENT_TYPE_NODE: |
1236 context = nullptr; | 1236 context = nullptr; |
1237 break; | 1237 break; |
(...skipping 13 matching lines...) Expand all Loading... |
1251 } | 1251 } |
1252 | 1252 |
1253 const AtomicString& Node::lookupNamespaceURI(const String& prefix) const | 1253 const AtomicString& Node::lookupNamespaceURI(const String& prefix) const |
1254 { | 1254 { |
1255 // Implemented according to | 1255 // Implemented according to |
1256 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algori
thms.html#lookupNamespaceURIAlgo | 1256 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algori
thms.html#lookupNamespaceURIAlgo |
1257 | 1257 |
1258 if (!prefix.isNull() && prefix.isEmpty()) | 1258 if (!prefix.isNull() && prefix.isEmpty()) |
1259 return nullAtom; | 1259 return nullAtom; |
1260 | 1260 |
1261 switch (nodeType()) { | 1261 switch (getNodeType()) { |
1262 case ELEMENT_NODE: { | 1262 case ELEMENT_NODE: { |
1263 const Element& element = toElement(*this); | 1263 const Element& element = toElement(*this); |
1264 | 1264 |
1265 if (!element.namespaceURI().isNull() && element.prefix() == prefix) | 1265 if (!element.namespaceURI().isNull() && element.prefix() == prefix) |
1266 return element.namespaceURI(); | 1266 return element.namespaceURI(); |
1267 | 1267 |
1268 AttributeCollection attributes = element.attributes(); | 1268 AttributeCollection attributes = element.attributes(); |
1269 for (const Attribute& attr : attributes) { | 1269 for (const Attribute& attr : attributes) { |
1270 if (attr.prefix() == xmlnsAtom && attr.localName() == prefix) { | 1270 if (attr.prefix() == xmlnsAtom && attr.localName() == prefix) { |
1271 if (!attr.value().isEmpty()) | 1271 if (!attr.value().isEmpty()) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 content.append('\n'); | 1322 content.append('\n'); |
1323 } else if (node.isTextNode()) { | 1323 } else if (node.isTextNode()) { |
1324 content.append(toText(node).data()); | 1324 content.append(toText(node).data()); |
1325 } | 1325 } |
1326 } | 1326 } |
1327 return content.toString(); | 1327 return content.toString(); |
1328 } | 1328 } |
1329 | 1329 |
1330 void Node::setTextContent(const String& text) | 1330 void Node::setTextContent(const String& text) |
1331 { | 1331 { |
1332 switch (nodeType()) { | 1332 switch (getNodeType()) { |
1333 case TEXT_NODE: | 1333 case TEXT_NODE: |
1334 case CDATA_SECTION_NODE: | 1334 case CDATA_SECTION_NODE: |
1335 case COMMENT_NODE: | 1335 case COMMENT_NODE: |
1336 case PROCESSING_INSTRUCTION_NODE: | 1336 case PROCESSING_INSTRUCTION_NODE: |
1337 setNodeValue(text); | 1337 setNodeValue(text); |
1338 return; | 1338 return; |
1339 case ELEMENT_NODE: | 1339 case ELEMENT_NODE: |
1340 case DOCUMENT_FRAGMENT_NODE: { | 1340 case DOCUMENT_FRAGMENT_NODE: { |
1341 // FIXME: Merge this logic into replaceChildrenWithText. | 1341 // FIXME: Merge this logic into replaceChildrenWithText. |
1342 RefPtrWillBeRawPtr<ContainerNode> container = toContainerNode(this); | 1342 RefPtrWillBeRawPtr<ContainerNode> container = toContainerNode(this); |
(...skipping 27 matching lines...) Expand all Loading... |
1370 bool Node::offsetInCharacters() const | 1370 bool Node::offsetInCharacters() const |
1371 { | 1371 { |
1372 return isCharacterDataNode(); | 1372 return isCharacterDataNode(); |
1373 } | 1373 } |
1374 | 1374 |
1375 unsigned short Node::compareDocumentPosition(const Node* otherNode, ShadowTreesT
reatment treatment) const | 1375 unsigned short Node::compareDocumentPosition(const Node* otherNode, ShadowTreesT
reatment treatment) const |
1376 { | 1376 { |
1377 if (otherNode == this) | 1377 if (otherNode == this) |
1378 return DOCUMENT_POSITION_EQUIVALENT; | 1378 return DOCUMENT_POSITION_EQUIVALENT; |
1379 | 1379 |
1380 const Attr* attr1 = nodeType() == ATTRIBUTE_NODE ? toAttr(this) : nullptr; | 1380 const Attr* attr1 = getNodeType() == ATTRIBUTE_NODE ? toAttr(this) : nullptr
; |
1381 const Attr* attr2 = otherNode->nodeType() == ATTRIBUTE_NODE ? toAttr(otherNo
de) : nullptr; | 1381 const Attr* attr2 = otherNode->getNodeType() == ATTRIBUTE_NODE ? toAttr(othe
rNode) : nullptr; |
1382 | 1382 |
1383 const Node* start1 = attr1 ? attr1->ownerElement() : this; | 1383 const Node* start1 = attr1 ? attr1->ownerElement() : this; |
1384 const Node* start2 = attr2 ? attr2->ownerElement() : otherNode; | 1384 const Node* start2 = attr2 ? attr2->ownerElement() : otherNode; |
1385 | 1385 |
1386 // If either of start1 or start2 is null, then we are disconnected, since on
e of the nodes is | 1386 // If either of start1 or start2 is null, then we are disconnected, since on
e of the nodes is |
1387 // an orphaned attribute node. | 1387 // an orphaned attribute node. |
1388 if (!start1 || !start2) { | 1388 if (!start1 || !start2) { |
1389 unsigned short direction = (this > otherNode) ? DOCUMENT_POSITION_PRECED
ING : DOCUMENT_POSITION_FOLLOWING; | 1389 unsigned short direction = (this > otherNode) ? DOCUMENT_POSITION_PRECED
ING : DOCUMENT_POSITION_FOLLOWING; |
1390 return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION
_SPECIFIC | direction; | 1390 return DOCUMENT_POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION
_SPECIFIC | direction; |
1391 } | 1391 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 } | 1442 } |
1443 | 1443 |
1444 unsigned connection = start1->treeScope() != start2->treeScope() ? DOCUMENT_
POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC : 0; | 1444 unsigned connection = start1->treeScope() != start2->treeScope() ? DOCUMENT_
POSITION_DISCONNECTED | DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC : 0; |
1445 | 1445 |
1446 // Walk the two chains backwards and look for the first difference. | 1446 // Walk the two chains backwards and look for the first difference. |
1447 for (unsigned i = std::min(index1, index2); i; --i) { | 1447 for (unsigned i = std::min(index1, index2); i; --i) { |
1448 const Node* child1 = chain1[--index1]; | 1448 const Node* child1 = chain1[--index1]; |
1449 const Node* child2 = chain2[--index2]; | 1449 const Node* child2 = chain2[--index2]; |
1450 if (child1 != child2) { | 1450 if (child1 != child2) { |
1451 // If one of the children is an attribute, it wins. | 1451 // If one of the children is an attribute, it wins. |
1452 if (child1->nodeType() == ATTRIBUTE_NODE) | 1452 if (child1->getNodeType() == ATTRIBUTE_NODE) |
1453 return DOCUMENT_POSITION_FOLLOWING | connection; | 1453 return DOCUMENT_POSITION_FOLLOWING | connection; |
1454 if (child2->nodeType() == ATTRIBUTE_NODE) | 1454 if (child2->getNodeType() == ATTRIBUTE_NODE) |
1455 return DOCUMENT_POSITION_PRECEDING | connection; | 1455 return DOCUMENT_POSITION_PRECEDING | connection; |
1456 | 1456 |
1457 // If one of the children is a shadow root, | 1457 // If one of the children is a shadow root, |
1458 if (child1->isShadowRoot() || child2->isShadowRoot()) { | 1458 if (child1->isShadowRoot() || child2->isShadowRoot()) { |
1459 if (!child2->isShadowRoot()) | 1459 if (!child2->isShadowRoot()) |
1460 return Node::DOCUMENT_POSITION_FOLLOWING | connection; | 1460 return Node::DOCUMENT_POSITION_FOLLOWING | connection; |
1461 if (!child1->isShadowRoot()) | 1461 if (!child1->isShadowRoot()) |
1462 return Node::DOCUMENT_POSITION_PRECEDING | connection; | 1462 return Node::DOCUMENT_POSITION_PRECEDING | connection; |
1463 | 1463 |
1464 for (const ShadowRoot* child = toShadowRoot(child2)->olderShadow
Root(); child; child = child->olderShadowRoot()) { | 1464 for (const ShadowRoot* child = toShadowRoot(child2)->olderShadow
Root(); child; child = child->olderShadowRoot()) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1542 { | 1542 { |
1543 if (!prefix) | 1543 if (!prefix) |
1544 prefix = ""; | 1544 prefix = ""; |
1545 if (isTextNode()) { | 1545 if (isTextNode()) { |
1546 String value = nodeValue(); | 1546 String value = nodeValue(); |
1547 value.replaceWithLiteral('\\', "\\\\"); | 1547 value.replaceWithLiteral('\\', "\\\\"); |
1548 value.replaceWithLiteral('\n', "\\n"); | 1548 value.replaceWithLiteral('\n', "\\n"); |
1549 WTFLogAlways("%s%s\t%p \"%s\"\n", prefix, nodeName().utf8().data(), this
, value.utf8().data()); | 1549 WTFLogAlways("%s%s\t%p \"%s\"\n", prefix, nodeName().utf8().data(), this
, value.utf8().data()); |
1550 } else if (isDocumentTypeNode()) { | 1550 } else if (isDocumentTypeNode()) { |
1551 WTFLogAlways("%sDOCTYPE %s\t%p\n", prefix, nodeName().utf8().data(), thi
s); | 1551 WTFLogAlways("%sDOCTYPE %s\t%p\n", prefix, nodeName().utf8().data(), thi
s); |
1552 } else if (nodeType() == PROCESSING_INSTRUCTION_NODE) { | 1552 } else if (getNodeType() == PROCESSING_INSTRUCTION_NODE) { |
1553 WTFLogAlways("%s?%s\t%p\n", prefix, nodeName().utf8().data(), this); | 1553 WTFLogAlways("%s?%s\t%p\n", prefix, nodeName().utf8().data(), this); |
1554 } else if (isShadowRoot()) { | 1554 } else if (isShadowRoot()) { |
1555 // nodeName of ShadowRoot is #document-fragment. It's confused with | 1555 // nodeName of ShadowRoot is #document-fragment. It's confused with |
1556 // DocumentFragment. | 1556 // DocumentFragment. |
1557 WTFLogAlways("%s#shadow-root\t%p\n", prefix, this); | 1557 WTFLogAlways("%s#shadow-root\t%p\n", prefix, this); |
1558 } else { | 1558 } else { |
1559 StringBuilder attrs; | 1559 StringBuilder attrs; |
1560 appendAttributeDesc(this, attrs, idAttr, " ID"); | 1560 appendAttributeDesc(this, attrs, idAttr, " ID"); |
1561 appendAttributeDesc(this, attrs, classAttr, " CLASS"); | 1561 appendAttributeDesc(this, attrs, classAttr, " CLASS"); |
1562 appendAttributeDesc(this, attrs, styleAttr, " STYLE"); | 1562 appendAttributeDesc(this, attrs, styleAttr, " STYLE"); |
(...skipping 26 matching lines...) Expand all Loading... |
1589 for (unsigned index = chain.size(); index > 0; --index) { | 1589 for (unsigned index = chain.size(); index > 0; --index) { |
1590 const Node* node = chain[index - 1]; | 1590 const Node* node = chain[index - 1]; |
1591 if (node->isShadowRoot()) { | 1591 if (node->isShadowRoot()) { |
1592 int count = 0; | 1592 int count = 0; |
1593 for (const ShadowRoot* shadowRoot = toShadowRoot(node)->olderShadowR
oot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) | 1593 for (const ShadowRoot* shadowRoot = toShadowRoot(node)->olderShadowR
oot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) |
1594 ++count; | 1594 ++count; |
1595 WTFLogAlways("/#shadow-root[%d]", count); | 1595 WTFLogAlways("/#shadow-root[%d]", count); |
1596 continue; | 1596 continue; |
1597 } | 1597 } |
1598 | 1598 |
1599 switch (node->nodeType()) { | 1599 switch (node->getNodeType()) { |
1600 case ELEMENT_NODE: { | 1600 case ELEMENT_NODE: { |
1601 WTFLogAlways("/%s", node->nodeName().utf8().data()); | 1601 WTFLogAlways("/%s", node->nodeName().utf8().data()); |
1602 | 1602 |
1603 const Element* element = toElement(node); | 1603 const Element* element = toElement(node); |
1604 const AtomicString& idattr = element->getIdAttribute(); | 1604 const AtomicString& idattr = element->getIdAttribute(); |
1605 bool hasIdAttr = !idattr.isNull() && !idattr.isEmpty(); | 1605 bool hasIdAttr = !idattr.isNull() && !idattr.isEmpty(); |
1606 if (node->previousSibling() || node->nextSibling()) { | 1606 if (node->previousSibling() || node->nextSibling()) { |
1607 int count = 0; | 1607 int count = 0; |
1608 for (const Node* previous = node->previousSibling(); previous; p
revious = previous->previousSibling()) { | 1608 for (const Node* previous = node->previousSibling(); previous; p
revious = previous->previousSibling()) { |
1609 if (previous->nodeName() == node->nodeName()) { | 1609 if (previous->nodeName() == node->nodeName()) { |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 visitor->trace(rareData()); | 2370 visitor->trace(rareData()); |
2371 | 2371 |
2372 visitor->trace(m_treeScope); | 2372 visitor->trace(m_treeScope); |
2373 #endif | 2373 #endif |
2374 EventTarget::trace(visitor); | 2374 EventTarget::trace(visitor); |
2375 } | 2375 } |
2376 | 2376 |
2377 unsigned Node::lengthOfContents() const | 2377 unsigned Node::lengthOfContents() const |
2378 { | 2378 { |
2379 // This switch statement must be consistent with that of Range::processConte
ntsBetweenOffsets. | 2379 // This switch statement must be consistent with that of Range::processConte
ntsBetweenOffsets. |
2380 switch (nodeType()) { | 2380 switch (getNodeType()) { |
2381 case Node::TEXT_NODE: | 2381 case Node::TEXT_NODE: |
2382 case Node::CDATA_SECTION_NODE: | 2382 case Node::CDATA_SECTION_NODE: |
2383 case Node::COMMENT_NODE: | 2383 case Node::COMMENT_NODE: |
2384 case Node::PROCESSING_INSTRUCTION_NODE: | 2384 case Node::PROCESSING_INSTRUCTION_NODE: |
2385 return toCharacterData(this)->length(); | 2385 return toCharacterData(this)->length(); |
2386 case Node::ELEMENT_NODE: | 2386 case Node::ELEMENT_NODE: |
2387 case Node::DOCUMENT_NODE: | 2387 case Node::DOCUMENT_NODE: |
2388 case Node::DOCUMENT_FRAGMENT_NODE: | 2388 case Node::DOCUMENT_FRAGMENT_NODE: |
2389 return toContainerNode(this)->countChildren(); | 2389 return toContainerNode(this)->countChildren(); |
2390 case Node::ATTRIBUTE_NODE: | 2390 case Node::ATTRIBUTE_NODE: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 | 2441 |
2442 void showNodePath(const blink::Node* node) | 2442 void showNodePath(const blink::Node* node) |
2443 { | 2443 { |
2444 if (node) | 2444 if (node) |
2445 node->showNodePathForThis(); | 2445 node->showNodePathForThis(); |
2446 else | 2446 else |
2447 fprintf(stderr, "Cannot showNodePath for (nil)\n"); | 2447 fprintf(stderr, "Cannot showNodePath for (nil)\n"); |
2448 } | 2448 } |
2449 | 2449 |
2450 #endif | 2450 #endif |
OLD | NEW |