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