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()) { |