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

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

Issue 182383012: Have positionInParentBeforeNode() / positionInParentAfterNode() take a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 10 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/editing/IndentOutdentCommand.cpp ('k') | Source/core/editing/InsertListCommand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/InsertLineBreakCommand.cpp
diff --git a/Source/core/editing/InsertLineBreakCommand.cpp b/Source/core/editing/InsertLineBreakCommand.cpp
index 606e7cd5884385984784dbff299cdbcfeb52db2c..5270238d9484c1824f62e95d00a0d919b2ccc811 100644
--- a/Source/core/editing/InsertLineBreakCommand.cpp
+++ b/Source/core/editing/InsertLineBreakCommand.cpp
@@ -106,12 +106,12 @@ void InsertLineBreakCommand::doApply()
if (!isStartOfParagraph(VisiblePosition(positionBeforeNode(nodeToInsert.get()))))
insertNodeBefore(nodeToInsert->cloneNode(false).get(), nodeToInsert.get());
- setEndingSelection(VisibleSelection(positionInParentAfterNode(nodeToInsert.get()), DOWNSTREAM, endingSelection().isDirectional()));
+ setEndingSelection(VisibleSelection(positionInParentAfterNode(*nodeToInsert), DOWNSTREAM, endingSelection().isDirectional()));
// If we're inserting after all of the rendered text in a text node, or into a non-text node,
// a simple insertion is sufficient.
} else if (pos.deprecatedEditingOffset() >= caretMaxOffset(pos.deprecatedNode()) || !pos.deprecatedNode()->isTextNode()) {
insertNodeAt(nodeToInsert.get(), pos);
- setEndingSelection(VisibleSelection(positionInParentAfterNode(nodeToInsert.get()), DOWNSTREAM, endingSelection().isDirectional()));
+ setEndingSelection(VisibleSelection(positionInParentAfterNode(*nodeToInsert), DOWNSTREAM, endingSelection().isDirectional()));
} else if (pos.deprecatedNode()->isTextNode()) {
// Split a text node
Text* textNode = toText(pos.deprecatedNode());
@@ -122,7 +122,7 @@ void InsertLineBreakCommand::doApply()
// Handle whitespace that occurs after the split
document().updateLayoutIgnorePendingStylesheets();
if (!endingPosition.isRenderedCharacter()) {
- Position positionBeforeTextNode(positionInParentBeforeNode(textNode));
+ Position positionBeforeTextNode(positionInParentBeforeNode(*textNode));
// Clear out all whitespace and insert one non-breaking space
deleteInsignificantTextDownstream(endingPosition);
ASSERT(!textNode->renderer() || textNode->renderer()->style()->collapseWhiteSpace());
« no previous file with comments | « Source/core/editing/IndentOutdentCommand.cpp ('k') | Source/core/editing/InsertListCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698