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

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

Issue 2731313003: Make InsertListCommand::selectionHasListOfType() to take Position objects (Closed)
Patch Set: 2017-03-07T14:02:25 Created 3 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/InsertListCommand.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
index bef69781f5aaa91504d976afe249e4422d3b5b11..c5bea18bc499cead96eb908dc5373a93a5d90df4 100644
--- a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
@@ -96,18 +96,20 @@ HTMLElement* InsertListCommand::mergeWithNeighboringLists(
}
bool InsertListCommand::selectionHasListOfType(
- const VisibleSelection& selection,
+ const Position& selectionStart,
+ const Position& selectionEnd,
const HTMLQualifiedName& listTag) {
+ DCHECK_LE(selectionStart, selectionEnd);
DCHECK(!document().needsLayoutTreeUpdate());
DocumentLifecycle::DisallowTransitionScope disallowTransition(
document().lifecycle());
- VisiblePosition start = selection.visibleStart();
+ VisiblePosition start = createVisiblePosition(selectionStart);
if (!enclosingList(start.deepEquivalent().anchorNode()))
return false;
- VisiblePosition end = startOfParagraph(selection.visibleEnd());
+ VisiblePosition end = startOfParagraph(createVisiblePosition(selectionEnd));
while (start.isNotNull() && start.deepEquivalent() != end.deepEquivalent()) {
HTMLElement* listElement =
enclosingList(start.deepEquivalent().anchorNode());
@@ -200,7 +202,8 @@ void InsertListCommand::doApply(EditingState* editingState) {
if (startOfParagraph(visibleStartOfSelection, CanSkipOverEditingBoundary)
.deepEquivalent() != startOfLastParagraph) {
- forceListCreation = !selectionHasListOfType(selection, listTag);
+ forceListCreation =
+ !selectionHasListOfType(selection.start(), selection.end(), listTag);
VisiblePosition startOfCurrentParagraph = visibleStartOfSelection;
while (inSameTreeAndOrdered(startOfCurrentParagraph.deepEquivalent(),
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/InsertListCommand.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698