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

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

Issue 1310043003: Introduce previousPositionOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T16:28:03 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
Index: Source/core/editing/commands/InsertListCommand.cpp
diff --git a/Source/core/editing/commands/InsertListCommand.cpp b/Source/core/editing/commands/InsertListCommand.cpp
index 65286dd52140b6883d2b38cc67cf99c519275415..4a08169c43797b7a0312f519ab584a28dbb5630f 100644
--- a/Source/core/editing/commands/InsertListCommand.cpp
+++ b/Source/core/editing/commands/InsertListCommand.cpp
@@ -132,7 +132,7 @@ void InsertListCommand::doApply()
// margin/padding, but not others. We should make the gap painting more consistent and
// then use a left margin/padding rule here.
if (visibleEnd.deepEquivalent() != visibleStart.deepEquivalent() && isStartOfParagraph(visibleEnd, CanSkipOverEditingBoundary)) {
- setEndingSelection(VisibleSelection(visibleStart, visibleEnd.previous(CannotCrossEditingBoundary), endingSelection().isDirectional()));
+ setEndingSelection(VisibleSelection(visibleStart, previousPositionOf(visibleEnd, CannotCrossEditingBoundary), endingSelection().isDirectional()));
if (!endingSelection().rootEditableElement())
return;
}
@@ -296,7 +296,7 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart,
end = endOfParagraph(start, CanSkipOverEditingBoundary);
nextListChild = enclosingListChild(end.next().deepEquivalent().anchorNode(), listElement);
ASSERT(nextListChild != listChildNode);
- previousListChild = enclosingListChild(start.previous().deepEquivalent().anchorNode(), listElement);
+ previousListChild = enclosingListChild(previousPositionOf(start).deepEquivalent().anchorNode(), listElement);
ASSERT(previousListChild != listChildNode);
}
// When removing a list, we must always create a placeholder to act as a point of insertion
@@ -369,7 +369,7 @@ PassRefPtrWillBeRawPtr<HTMLElement> InsertListCommand::listifyParagraph(const Vi
appendNode(placeholder, listItemElement);
// Place list item into adjoining lists.
- HTMLElement* previousList = adjacentEnclosingList(start, start.previous(CannotCrossEditingBoundary), listTag);
+ HTMLElement* previousList = adjacentEnclosingList(start, previousPositionOf(start, CannotCrossEditingBoundary), listTag);
HTMLElement* nextList = adjacentEnclosingList(start, end.next(CannotCrossEditingBoundary), listTag);
RefPtrWillBeRawPtr<HTMLElement> listElement = nullptr;
if (previousList) {

Powered by Google App Engine
This is Rietveld 408576698