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

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

Issue 112633003: Handle special case of merging lists in mergeParagraphs() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Got rid of redundant check Created 7 years 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/DeleteSelectionCommand.cpp
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index ce27bb711cf0898ce1eb7760c9b3a2d8e635bdc6..9e2ef6d1581c399565109a2e69d52868770ea18c 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -639,6 +639,15 @@ void DeleteSelectionCommand::mergeParagraphs()
if (mergeDestination == endOfParagraphToMove)
return;
+ // If the merge destination and source to be moved are both list items of different lists, merge them into single list.
+ Node* listItemInFirstParagraph = enclosingNodeOfType(m_upstreamStart, isListItem);
+ Node* listItemInSecondParagraph = enclosingNodeOfType(m_downstreamEnd, isListItem);
+ if (listItemInFirstParagraph && listItemInSecondParagraph
+ && canMergeLists(listItemInFirstParagraph->parentElement(), listItemInSecondParagraph->parentElement())) {
+ mergeIdenticalElements(listItemInFirstParagraph->parentElement(), listItemInSecondParagraph->parentElement());
+ return;
+ }
+
// The rule for merging into an empty block is: only do so if its farther to the right.
// FIXME: Consider RTL.
if (!m_startsAtEmptyLine && isStartOfParagraph(mergeDestination) && startOfParagraphToMove.absoluteCaretBounds().x() > mergeDestination.absoluteCaretBounds().x()) {

Powered by Google App Engine
This is Rietveld 408576698