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

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

Issue 188033005: 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 df9cb378959c13b2bc5e9afe24d067c4a0ae7413..0ad5d2b85edac63604212bc5a0992c53cd8bd2eb 100644
--- a/Source/core/editing/InsertListCommand.cpp
+++ b/Source/core/editing/InsertListCommand.cpp
@@ -242,7 +242,7 @@ void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const Qu
if (rangeStartIsInList && newList)
currentSelection.setStart(newList, 0, IGNORE_EXCEPTION);
if (rangeEndIsInList && newList)
- currentSelection.setEnd(newList, lastOffsetInNode(newList.get()), IGNORE_EXCEPTION);
+ currentSelection.setEnd(newList, lastOffsetInNode(*newList), IGNORE_EXCEPTION);
setEndingSelection(VisiblePosition(firstPositionInNode(newList.get())));
@@ -308,7 +308,7 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart,
} else
insertNodeAfter(nodeToInsert, listNode);
- VisiblePosition insertionPoint = VisiblePosition(positionBeforeNode(placeholder.get()));
+ VisiblePosition insertionPoint = VisiblePosition(positionBeforeNode(*placeholder));
moveParagraphs(start, end, insertionPoint, /* preserveSelection */ true, /* preserveStyle */ true, listChildNode);
}
@@ -348,11 +348,11 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio
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 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio
// 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.get()));
+ start = VisiblePosition(positionBeforeNode(*placeholder));
end = start;
}
@@ -390,7 +390,7 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio
}
}
- moveParagraph(start, end, VisiblePosition(positionBeforeNode(placeholder.get())), true);
+ moveParagraph(start, end, VisiblePosition(positionBeforeNode(*placeholder)), 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