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

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

Issue 67473002: Have ElementTraversal / NodeTraversal's next() methods take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month 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/editing/CompositeEditCommand.cpp ('k') | Source/core/editing/EditingStyle.cpp » ('j') | 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 8b07307c10abd6d0920576f69f7decfa298d2dc1..3fc44584c7440334205c86601d43ffd155e7823c 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -337,7 +337,7 @@ static Position firstEditablePositionInNode(Node* node)
ASSERT(node);
Node* next = node;
while (next && !next->rendererIsEditable())
- next = NodeTraversal::next(next, node);
+ next = NodeTraversal::next(*next, node);
return next ? firstPositionInOrBeforeNode(next) : Position();
}
@@ -429,7 +429,7 @@ void DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPr
RefPtr<Range> range = m_selectionToDelete.toNormalizedRange();
RefPtr<Node> node = range->firstNode();
while (node && node != range->pastLastNode()) {
- RefPtr<Node> nextNode = NodeTraversal::next(node.get());
+ RefPtr<Node> nextNode = NodeTraversal::next(*node);
if ((node->hasTagName(styleTag) && !(toElement(node)->hasAttribute(scopedAttr))) || node->hasTagName(linkTag)) {
nextNode = NodeTraversal::nextSkippingChildren(node.get());
RefPtr<ContainerNode> rootEditableElement = node->rootEditableElement();
@@ -449,13 +449,14 @@ void DeleteSelectionCommand::handleGeneralDelete()
int startOffset = m_upstreamStart.deprecatedEditingOffset();
Node* startNode = m_upstreamStart.deprecatedNode();
+ ASSERT(startNode);
makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss();
// Never remove the start block unless it's a table, in which case we won't merge content in.
if (startNode->isSameNode(m_startBlock.get()) && !startOffset && canHaveChildrenForEditing(startNode) && !isHTMLTableElement(startNode)) {
startOffset = 0;
- startNode = NodeTraversal::next(startNode);
+ startNode = NodeTraversal::next(*startNode);
if (!startNode)
return;
}
@@ -501,7 +502,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
// in a text node that needs to be trimmed
Text* text = toText(node);
deleteTextFromNode(text, startOffset, text->length() - startOffset);
- node = NodeTraversal::next(node.get());
+ node = NodeTraversal::next(*node);
} else {
node = startNode->childNode(startOffset);
}
@@ -527,8 +528,9 @@ void DeleteSelectionCommand::handleGeneralDelete()
if (m_downstreamEnd.deprecatedNode() == n && m_downstreamEnd.deprecatedEditingOffset() >= caretMaxOffset(&n)) {
removeNode(node.get());
node = 0;
- } else
- node = NodeTraversal::next(node.get());
+ } else {
+ node = NodeTraversal::next(*node);
+ }
}
}
« no previous file with comments | « Source/core/editing/CompositeEditCommand.cpp ('k') | Source/core/editing/EditingStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698