OLD | NEW |
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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 } | 632 } |
633 | 633 |
634 if (mergeDestination == startOfParagraphToMove) | 634 if (mergeDestination == startOfParagraphToMove) |
635 return; | 635 return; |
636 | 636 |
637 VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove
); | 637 VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove
); |
638 | 638 |
639 if (mergeDestination == endOfParagraphToMove) | 639 if (mergeDestination == endOfParagraphToMove) |
640 return; | 640 return; |
641 | 641 |
| 642 // If the merge destination and source to be moved are both list items of di
fferent lists, merge them into single list. |
| 643 Node* listItemInFirstParagraph = enclosingNodeOfType(m_upstreamStart, isList
Item); |
| 644 Node* listItemInSecondParagraph = enclosingNodeOfType(m_downstreamEnd, isLis
tItem); |
| 645 if (listItemInFirstParagraph && listItemInSecondParagraph |
| 646 && canMergeLists(listItemInFirstParagraph->parentElement(), listItemInSe
condParagraph->parentElement())) { |
| 647 mergeIdenticalElements(listItemInFirstParagraph->parentElement(), listIt
emInSecondParagraph->parentElement()); |
| 648 return; |
| 649 } |
| 650 |
642 // The rule for merging into an empty block is: only do so if its farther to
the right. | 651 // The rule for merging into an empty block is: only do so if its farther to
the right. |
643 // FIXME: Consider RTL. | 652 // FIXME: Consider RTL. |
644 if (!m_startsAtEmptyLine && isStartOfParagraph(mergeDestination) && startOfP
aragraphToMove.absoluteCaretBounds().x() > mergeDestination.absoluteCaretBounds(
).x()) { | 653 if (!m_startsAtEmptyLine && isStartOfParagraph(mergeDestination) && startOfP
aragraphToMove.absoluteCaretBounds().x() > mergeDestination.absoluteCaretBounds(
).x()) { |
645 if (mergeDestination.deepEquivalent().downstream().deprecatedNode()->has
TagName(brTag)) { | 654 if (mergeDestination.deepEquivalent().downstream().deprecatedNode()->has
TagName(brTag)) { |
646 removeNodeAndPruneAncestors(mergeDestination.deepEquivalent().downst
ream().deprecatedNode()); | 655 removeNodeAndPruneAncestors(mergeDestination.deepEquivalent().downst
ream().deprecatedNode()); |
647 m_endingPosition = startOfParagraphToMove.deepEquivalent(); | 656 m_endingPosition = startOfParagraphToMove.deepEquivalent(); |
648 return; | 657 return; |
649 } | 658 } |
650 } | 659 } |
651 | 660 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 | 864 |
856 // Normally deletion doesn't preserve the typing style that was present before i
t. For example, | 865 // Normally deletion doesn't preserve the typing style that was present before i
t. For example, |
857 // type a character, Bold, then delete the character and start typing. The Bold
typing style shouldn't | 866 // type a character, Bold, then delete the character and start typing. The Bold
typing style shouldn't |
858 // stick around. Deletion should preserve a typing style that *it* sets, howeve
r. | 867 // stick around. Deletion should preserve a typing style that *it* sets, howeve
r. |
859 bool DeleteSelectionCommand::preservesTypingStyle() const | 868 bool DeleteSelectionCommand::preservesTypingStyle() const |
860 { | 869 { |
861 return m_typingStyle; | 870 return m_typingStyle; |
862 } | 871 } |
863 | 872 |
864 } // namespace WebCore | 873 } // namespace WebCore |
OLD | NEW |