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, &isLis tItem); | |
yosin_UTC9
2013/12/12 04:20:45
nit: You don't need to have "&" for isListItem.
| |
644 Node* listItemInSecondParagraph = enclosingNodeOfType(m_downstreamEnd, &isLi stItem); | |
yosin_UTC9
2013/12/12 04:20:45
nit: You don't need to have "&" for isListItem.
| |
645 if (listItemInFirstParagraph && listItemInSecondParagraph | |
yosin_UTC9
2013/12/12 04:20:45
ni: Can we merge if-conditions of L645 and L647?
| |
646 && listItemInFirstParagraph->parentElement() != listItemInSecondParagrap h->parentElement()) { | |
647 if (canMergeLists(listItemInFirstParagraph->parentElement(), listItemInS econdParagraph->parentElement())) { | |
648 mergeIdenticalElements(listItemInFirstParagraph->parentElement(), li stItemInSecondParagraph->parentElement()); | |
649 return; | |
650 } | |
651 } | |
652 | |
642 // The rule for merging into an empty block is: only do so if its farther to the right. | 653 // The rule for merging into an empty block is: only do so if its farther to the right. |
643 // FIXME: Consider RTL. | 654 // FIXME: Consider RTL. |
644 if (!m_startsAtEmptyLine && isStartOfParagraph(mergeDestination) && startOfP aragraphToMove.absoluteCaretBounds().x() > mergeDestination.absoluteCaretBounds( ).x()) { | 655 if (!m_startsAtEmptyLine && isStartOfParagraph(mergeDestination) && startOfP aragraphToMove.absoluteCaretBounds().x() > mergeDestination.absoluteCaretBounds( ).x()) { |
645 if (mergeDestination.deepEquivalent().downstream().deprecatedNode()->has TagName(brTag)) { | 656 if (mergeDestination.deepEquivalent().downstream().deprecatedNode()->has TagName(brTag)) { |
646 removeNodeAndPruneAncestors(mergeDestination.deepEquivalent().downst ream().deprecatedNode()); | 657 removeNodeAndPruneAncestors(mergeDestination.deepEquivalent().downst ream().deprecatedNode()); |
647 m_endingPosition = startOfParagraphToMove.deepEquivalent(); | 658 m_endingPosition = startOfParagraphToMove.deepEquivalent(); |
648 return; | 659 return; |
649 } | 660 } |
650 } | 661 } |
651 | 662 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
855 | 866 |
856 // Normally deletion doesn't preserve the typing style that was present before i t. For example, | 867 // 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 | 868 // 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. | 869 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. |
859 bool DeleteSelectionCommand::preservesTypingStyle() const | 870 bool DeleteSelectionCommand::preservesTypingStyle() const |
860 { | 871 { |
861 return m_typingStyle; | 872 return m_typingStyle; |
862 } | 873 } |
863 | 874 |
864 } // namespace WebCore | 875 } // namespace WebCore |
OLD | NEW |