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

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

Issue 189773005: Revert of Have Position deal with more references (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
Index: Source/core/editing/InsertListCommand.cpp
diff --git a/Source/core/editing/InsertListCommand.cpp b/Source/core/editing/InsertListCommand.cpp
index 0ad5d2b85edac63604212bc5a0992c53cd8bd2eb..df9cb378959c13b2bc5e9afe24d067c4a0ae7413 100644
--- a/Source/core/editing/InsertListCommand.cpp
+++ b/Source/core/editing/InsertListCommand.cpp
@@ -242,7 +242,7 @@
if (rangeStartIsInList && newList)
currentSelection.setStart(newList, 0, IGNORE_EXCEPTION);
if (rangeEndIsInList && newList)
- currentSelection.setEnd(newList, lastOffsetInNode(*newList), IGNORE_EXCEPTION);
+ currentSelection.setEnd(newList, lastOffsetInNode(newList.get()), IGNORE_EXCEPTION);
setEndingSelection(VisiblePosition(firstPositionInNode(newList.get())));
@@ -308,7 +308,7 @@
} else
insertNodeAfter(nodeToInsert, listNode);
- VisiblePosition insertionPoint = VisiblePosition(positionBeforeNode(*placeholder));
+ VisiblePosition insertionPoint = VisiblePosition(positionBeforeNode(placeholder.get()));
moveParagraphs(start, end, insertionPoint, /* preserveSelection */ true, /* preserveStyle */ true, listChildNode);
}
@@ -348,11 +348,11 @@
Element* previousList = adjacentEnclosingList(start, start.previous(CannotCrossEditingBoundary), listTag);
Element* nextList = adjacentEnclosingList(start, end.next(CannotCrossEditingBoundary), listTag);
RefPtr<HTMLElement> listElement;
- if (previousList) {
+ if (previousList)
appendNode(listItemElement, previousList);
- } else if (nextList) {
- insertNodeAt(listItemElement, positionBeforeNode(*nextList));
- } else {
+ else if (nextList)
+ insertNodeAt(listItemElement, positionBeforeNode(nextList));
+ else {
// Create the list.
listElement = createHTMLElement(document(), listTag);
appendNode(listItemElement, listElement);
@@ -362,7 +362,7 @@
// by a br or a '\n', will invalidate start and end. Insert
// a placeholder and then recompute start and end.
RefPtr<Node> placeholder = insertBlockPlaceholder(start.deepEquivalent());
- start = VisiblePosition(positionBeforeNode(*placeholder));
+ start = VisiblePosition(positionBeforeNode(placeholder.get()));
end = start;
}
@@ -390,7 +390,7 @@
}
}
- moveParagraph(start, end, VisiblePosition(positionBeforeNode(*placeholder)), true);
+ moveParagraph(start, end, VisiblePosition(positionBeforeNode(placeholder.get())), true);
if (listElement)
return mergeWithNeighboringLists(listElement);
« no previous file with comments | « Source/core/editing/InsertLineBreakCommand.cpp ('k') | Source/core/editing/InsertParagraphSeparatorCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698