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

Side by Side Diff: Source/core/editing/DeleteSelectionCommand.cpp

Issue 242733004: canMergeLists() should make sure that the list items do not belong to the same list (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments incorporated Created 6 years, 7 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/editing/deleting/merge-list-items-in-same-list-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 628
629 VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove , CanSkipOverEditingBoundary); 629 VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove , CanSkipOverEditingBoundary);
630 630
631 if (mergeDestination == endOfParagraphToMove) 631 if (mergeDestination == endOfParagraphToMove)
632 return; 632 return;
633 633
634 // If the merge destination and source to be moved are both list items of di fferent lists, merge them into single list. 634 // If the merge destination and source to be moved are both list items of di fferent lists, merge them into single list.
635 Node* listItemInFirstParagraph = enclosingNodeOfType(m_upstreamStart, isList Item); 635 Node* listItemInFirstParagraph = enclosingNodeOfType(m_upstreamStart, isList Item);
636 Node* listItemInSecondParagraph = enclosingNodeOfType(m_downstreamEnd, isLis tItem); 636 Node* listItemInSecondParagraph = enclosingNodeOfType(m_downstreamEnd, isLis tItem);
637 if (listItemInFirstParagraph && listItemInSecondParagraph 637 if (listItemInFirstParagraph && listItemInSecondParagraph
638 && listItemInFirstParagraph->parentElement() != listItemInSecondParagrap h->parentElement()
638 && canMergeLists(listItemInFirstParagraph->parentElement(), listItemInSe condParagraph->parentElement())) { 639 && canMergeLists(listItemInFirstParagraph->parentElement(), listItemInSe condParagraph->parentElement())) {
639 mergeIdenticalElements(listItemInFirstParagraph->parentElement(), listIt emInSecondParagraph->parentElement()); 640 mergeIdenticalElements(listItemInFirstParagraph->parentElement(), listIt emInSecondParagraph->parentElement());
640 m_endingPosition = mergeDestination.deepEquivalent(); 641 m_endingPosition = mergeDestination.deepEquivalent();
641 return; 642 return;
642 } 643 }
643 644
644 // The rule for merging into an empty block is: only do so if its farther to the right. 645 // The rule for merging into an empty block is: only do so if its farther to the right.
645 // FIXME: Consider RTL. 646 // FIXME: Consider RTL.
646 if (!m_startsAtEmptyLine && isStartOfParagraph(mergeDestination) && startOfP aragraphToMove.absoluteCaretBounds().x() > mergeDestination.absoluteCaretBounds( ).x()) { 647 if (!m_startsAtEmptyLine && isStartOfParagraph(mergeDestination) && startOfP aragraphToMove.absoluteCaretBounds().x() > mergeDestination.absoluteCaretBounds( ).x()) {
647 if (isHTMLBRElement(*mergeDestination.deepEquivalent().downstream().depr ecatedNode())) { 648 if (isHTMLBRElement(*mergeDestination.deepEquivalent().downstream().depr ecatedNode())) {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 858
858 // Normally deletion doesn't preserve the typing style that was present before i t. For example, 859 // Normally deletion doesn't preserve the typing style that was present before i t. For example,
859 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't 860 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't
860 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. 861 // stick around. Deletion should preserve a typing style that *it* sets, howeve r.
861 bool DeleteSelectionCommand::preservesTypingStyle() const 862 bool DeleteSelectionCommand::preservesTypingStyle() const
862 { 863 {
863 return m_typingStyle; 864 return m_typingStyle;
864 } 865 }
865 866
866 } // namespace WebCore 867 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/deleting/merge-list-items-in-same-list-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698