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

Unified Diff: Source/core/dom/Range.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.cpp ('k') | Source/core/editing/Editor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Range.cpp
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index de80933a0d7c44ca9b1199373eeefd183c60eb2f..31f24a347f3000d21e7b7235a16e73d1a731d726 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -548,28 +548,6 @@ static inline Node* childOfCommonRootBeforeOffset(Node* container, unsigned offs
return container;
}
-static inline unsigned lengthOfContentsInNode(Node* node)
-{
- // This switch statement must be consistent with that of Range::processContentsBetweenOffsets.
- switch (node->nodeType()) {
- case Node::TEXT_NODE:
- case Node::CDATA_SECTION_NODE:
- case Node::COMMENT_NODE:
- return toCharacterData(node)->length();
- case Node::PROCESSING_INSTRUCTION_NODE:
- return toProcessingInstruction(node)->data().length();
- case Node::ELEMENT_NODE:
- case Node::ATTRIBUTE_NODE:
- case Node::DOCUMENT_NODE:
- case Node::DOCUMENT_FRAGMENT_NODE:
- return toContainerNode(node)->countChildren();
- case Node::DOCUMENT_TYPE_NODE:
- return 0;
- }
- ASSERT_NOT_REACHED();
- return 0;
-}
-
PassRefPtrWillBeRawPtr<DocumentFragment> Range::processContents(ActionType action, ExceptionState& exceptionState)
{
typedef WillBeHeapVector<RefPtrWillBeMember<Node> > NodeVector;
@@ -619,7 +597,7 @@ PassRefPtrWillBeRawPtr<DocumentFragment> Range::processContents(ActionType actio
RefPtrWillBeRawPtr<Node> leftContents = nullptr;
if (originalStart.container() != commonRoot && commonRoot->contains(originalStart.container())) {
- leftContents = processContentsBetweenOffsets(action, nullptr, originalStart.container(), originalStart.offset(), lengthOfContentsInNode(originalStart.container()), exceptionState);
+ leftContents = processContentsBetweenOffsets(action, nullptr, originalStart.container(), originalStart.offset(), originalStart.container()->lengthOfContents(), exceptionState);
leftContents = processAncestorsAndTheirSiblings(action, originalStart.container(), ProcessContentsForward, leftContents, commonRoot.get(), exceptionState);
}
@@ -687,7 +665,7 @@ PassRefPtrWillBeRawPtr<Node> Range::processContentsBetweenOffsets(ActionType act
ASSERT(container);
ASSERT(startOffset <= endOffset);
- // This switch statement must be consistent with that of lengthOfContentsInNode.
+ // This switch statement must be consistent with that of Node::lengthOfContents.
RefPtrWillBeRawPtr<Node> result = nullptr;
switch (container->nodeType()) {
case Node::TEXT_NODE:
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698