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

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: 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
« 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 ce27bb711cf0898ce1eb7760c9b3a2d8e635bdc6..0630c426309a9c1f03d1dc46cdcdcbf0c45e9e74 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -639,6 +639,17 @@ 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);
yosin_UTC9 2013/12/12 04:20:45 nit: You don't need to have "&" for isListItem.
+ Node* listItemInSecondParagraph = enclosingNodeOfType(m_downstreamEnd, &isListItem);
yosin_UTC9 2013/12/12 04:20:45 nit: You don't need to have "&" for isListItem.
+ if (listItemInFirstParagraph && listItemInSecondParagraph
yosin_UTC9 2013/12/12 04:20:45 ni: Can we merge if-conditions of L645 and L647?
+ && listItemInFirstParagraph->parentElement() != listItemInSecondParagraph->parentElement()) {
+ if (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()) {
« 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
This is Rietveld 408576698