Chromium Code Reviews

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: Attempt to address the review comment Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « LayoutTests/editing/deleting/merge-lists-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/DeleteSelectionCommand.cpp
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index 745561a3c7e6f2be9a0b55c517c44c5751c7157e..dae79ea1d3d96d733f36eae0aba2136bbf890dd0 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -636,6 +636,16 @@ 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());
+ m_endingPosition = mergeDestination.deepEquivalent();
+ 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()) {
« no previous file with comments | « LayoutTests/editing/deleting/merge-lists-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine