Index: Source/core/dom/Node.cpp |
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp |
index 43aadde596cb0c388ab7d3bdede6a592b50675fe..59208c60e056bb8ee9b36eb1dadb58d29647a12b 100644 |
--- a/Source/core/dom/Node.cpp |
+++ b/Source/core/dom/Node.cpp |
@@ -2558,6 +2558,28 @@ void Node::trace(Visitor* visitor) |
EventTarget::trace(visitor); |
} |
+unsigned Node::lengthOfContents() const |
+{ |
+ // This switch statement must be consistent with that of Range::processContentsBetweenOffsets. |
+ switch (nodeType()) { |
+ case Node::TEXT_NODE: |
+ case Node::CDATA_SECTION_NODE: |
+ case Node::COMMENT_NODE: |
+ return toCharacterData(this)->length(); |
+ case Node::PROCESSING_INSTRUCTION_NODE: |
+ return toProcessingInstruction(this)->data().length(); |
+ case Node::ELEMENT_NODE: |
+ case Node::ATTRIBUTE_NODE: |
+ case Node::DOCUMENT_NODE: |
+ case Node::DOCUMENT_FRAGMENT_NODE: |
+ return toContainerNode(this)->countChildren(); |
+ case Node::DOCUMENT_TYPE_NODE: |
+ return 0; |
+ } |
+ ASSERT_NOT_REACHED(); |
+ return 0; |
+} |
+ |
} // namespace WebCore |
#ifndef NDEBUG |