Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Unified Diff: Source/core/dom/Node.cpp

Issue 315493004: reset VisibleSelection at the Undo command. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add the VisibleSelection::validateIfNeeded method Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/Range.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/Range.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698