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

Unified Diff: Source/core/editing/DeleteSelectionCommand.cpp

Issue 1265123002: Make DeleteSelectionCommand not to use Position::deprecatedEditingOffset() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-03T15:48:20 Created 5 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/DeleteSelectionCommand.cpp
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index 70c10f47c2554061c2fce475611503c1ad10ff81..eb6d624bdfc2853fd5f02cda0c7b2f5a25566c6a 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -447,7 +447,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
if (m_upstreamStart.isNull())
return;
- int startOffset = m_upstreamStart.deprecatedEditingOffset();
+ int startOffset = m_upstreamStart.computeEditingOffset();
Node* startNode = m_upstreamStart.anchorNode();
ASSERT(startNode);
@@ -477,13 +477,13 @@ void DeleteSelectionCommand::handleGeneralDelete()
return;
if (startNode == m_downstreamEnd.anchorNode()) {
- if (m_downstreamEnd.deprecatedEditingOffset() - startOffset > 0) {
+ if (m_downstreamEnd.computeEditingOffset() - startOffset > 0) {
if (startNode->isTextNode()) {
// in a text node that needs to be trimmed
Text* text = toText(startNode);
deleteTextFromNode(text, startOffset, m_downstreamEnd.computeOffsetInContainerNode() - startOffset);
} else {
- removeChildrenInRange(startNode, startOffset, m_downstreamEnd.deprecatedEditingOffset());
+ removeChildrenInRange(startNode, startOffset, m_downstreamEnd.computeEditingOffset());
m_endingPosition = m_upstreamStart;
}
}
@@ -525,7 +525,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
node = nextNode.get();
} else {
Node& n = NodeTraversal::lastWithinOrSelf(*node);
- if (m_downstreamEnd.anchorNode() == n && m_downstreamEnd.deprecatedEditingOffset() >= caretMaxOffset(&n)) {
+ if (m_downstreamEnd.anchorNode() == n && m_downstreamEnd.computeEditingOffset() >= caretMaxOffset(&n)) {
removeNode(node.get());
node = nullptr;
} else {
@@ -534,7 +534,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
}
}
- if (m_downstreamEnd.anchorNode() != startNode && !m_upstreamStart.anchorNode()->isDescendantOf(m_downstreamEnd.anchorNode()) && m_downstreamEnd.inDocument() && m_downstreamEnd.deprecatedEditingOffset() >= caretMinOffset(m_downstreamEnd.anchorNode())) {
+ if (m_downstreamEnd.anchorNode() != startNode && !m_upstreamStart.anchorNode()->isDescendantOf(m_downstreamEnd.anchorNode()) && m_downstreamEnd.inDocument() && m_downstreamEnd.computeEditingOffset() >= caretMinOffset(m_downstreamEnd.anchorNode())) {
if (m_downstreamEnd.atLastEditingPositionForNode() && !canHaveChildrenForEditing(m_downstreamEnd.anchorNode())) {
// The node itself is fully selected, not just its contents. Delete it.
removeNode(m_downstreamEnd.anchorNode());
@@ -542,8 +542,8 @@ void DeleteSelectionCommand::handleGeneralDelete()
if (m_downstreamEnd.anchorNode()->isTextNode()) {
// in a text node that needs to be trimmed
Text* text = toText(m_downstreamEnd.anchorNode());
- if (m_downstreamEnd.deprecatedEditingOffset() > 0) {
- deleteTextFromNode(text, 0, m_downstreamEnd.deprecatedEditingOffset());
+ if (m_downstreamEnd.computeEditingOffset() > 0) {
+ deleteTextFromNode(text, 0, m_downstreamEnd.computeEditingOffset());
}
// Remove children of m_downstreamEnd.anchorNode() that come after m_upstreamStart.
// Don't try to remove children if m_upstreamStart was inside m_downstreamEnd.anchorNode()
@@ -560,7 +560,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
if (n)
offset = n->nodeIndex() + 1;
}
- removeChildrenInRange(m_downstreamEnd.anchorNode(), offset, m_downstreamEnd.deprecatedEditingOffset());
+ removeChildrenInRange(m_downstreamEnd.anchorNode(), offset, m_downstreamEnd.computeEditingOffset());
m_downstreamEnd = createLegacyEditingPosition(m_downstreamEnd.anchorNode(), offset);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698