| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 // m_downstreamEnd's block has been emptied out by deletion. There is no co
ntent inside of it to | 618 // m_downstreamEnd's block has been emptied out by deletion. There is no co
ntent inside of it to |
| 619 // move, so just remove it. | 619 // move, so just remove it. |
| 620 Element* endBlock = enclosingBlock(m_downstreamEnd.deprecatedNode()); | 620 Element* endBlock = enclosingBlock(m_downstreamEnd.deprecatedNode()); |
| 621 if (!endBlock || !endBlock->contains(startOfParagraphToMove.deepEquivalent()
.deprecatedNode()) || !startOfParagraphToMove.deepEquivalent().deprecatedNode())
{ | 621 if (!endBlock || !endBlock->contains(startOfParagraphToMove.deepEquivalent()
.deprecatedNode()) || !startOfParagraphToMove.deepEquivalent().deprecatedNode())
{ |
| 622 removeNode(enclosingBlock(m_downstreamEnd.deprecatedNode())); | 622 removeNode(enclosingBlock(m_downstreamEnd.deprecatedNode())); |
| 623 return; | 623 return; |
| 624 } | 624 } |
| 625 | 625 |
| 626 // We need to merge into m_upstreamStart's block, but it's been emptied out
and collapsed by deletion. | 626 // We need to merge into m_upstreamStart's block, but it's been emptied out
and collapsed by deletion. |
| 627 if (!mergeDestination.deepEquivalent().deprecatedNode() || !mergeDestination
.deepEquivalent().deprecatedNode()->isDescendantOf(enclosingBlock(m_upstreamStar
t.containerNode())) || m_startsAtEmptyLine) { | 627 if (!mergeDestination.deepEquivalent().deprecatedNode() || !mergeDestination
.deepEquivalent().deprecatedNode()->isDescendantOf(enclosingBlock(m_upstreamStar
t.containerNode())) || m_startsAtEmptyLine) { |
| 628 insertNodeAt(createBreakElement(&document()).get(), m_upstreamStart); | 628 insertNodeAt(createBreakElement(document()).get(), m_upstreamStart); |
| 629 mergeDestination = VisiblePosition(m_upstreamStart); | 629 mergeDestination = VisiblePosition(m_upstreamStart); |
| 630 } | 630 } |
| 631 | 631 |
| 632 if (mergeDestination == startOfParagraphToMove) | 632 if (mergeDestination == startOfParagraphToMove) |
| 633 return; | 633 return; |
| 634 | 634 |
| 635 VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove
); | 635 VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove
); |
| 636 | 636 |
| 637 if (mergeDestination == endOfParagraphToMove) | 637 if (mergeDestination == endOfParagraphToMove) |
| 638 return; | 638 return; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 | 818 |
| 819 if (!m_needPlaceholder && rootWillStayOpenWithoutPlaceholder) { | 819 if (!m_needPlaceholder && rootWillStayOpenWithoutPlaceholder) { |
| 820 VisiblePosition visualEnding(m_endingPosition); | 820 VisiblePosition visualEnding(m_endingPosition); |
| 821 m_needPlaceholder = !isStartOfParagraph(visualEnding, CanCrossEditingBou
ndary) | 821 m_needPlaceholder = !isStartOfParagraph(visualEnding, CanCrossEditingBou
ndary) |
| 822 && isEndOfParagraph(visualEnding, CanCrossEditingBoundary) | 822 && isEndOfParagraph(visualEnding, CanCrossEditingBoundary) |
| 823 && lineBreakExistsAtVisiblePosition(visualEnding) | 823 && lineBreakExistsAtVisiblePosition(visualEnding) |
| 824 && visualEnding.next(CannotCrossEditingBoundary).isNull() | 824 && visualEnding.next(CannotCrossEditingBoundary).isNull() |
| 825 && lineBreakBeforeStart; | 825 && lineBreakBeforeStart; |
| 826 } | 826 } |
| 827 | 827 |
| 828 RefPtr<Node> placeholder = m_needPlaceholder ? createBreakElement(&document(
)).get() : 0; | 828 RefPtr<Node> placeholder = m_needPlaceholder ? createBreakElement(document()
).get() : 0; |
| 829 | 829 |
| 830 if (placeholder) { | 830 if (placeholder) { |
| 831 if (m_sanitizeMarkup) | 831 if (m_sanitizeMarkup) |
| 832 removeRedundantBlocks(); | 832 removeRedundantBlocks(); |
| 833 insertNodeAt(placeholder.get(), m_endingPosition); | 833 insertNodeAt(placeholder.get(), m_endingPosition); |
| 834 } | 834 } |
| 835 | 835 |
| 836 rebalanceWhitespaceAt(m_endingPosition); | 836 rebalanceWhitespaceAt(m_endingPosition); |
| 837 | 837 |
| 838 calculateTypingStyleAfterDelete(); | 838 calculateTypingStyleAfterDelete(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 851 | 851 |
| 852 // Normally deletion doesn't preserve the typing style that was present before i
t. For example, | 852 // Normally deletion doesn't preserve the typing style that was present before i
t. For example, |
| 853 // type a character, Bold, then delete the character and start typing. The Bold
typing style shouldn't | 853 // type a character, Bold, then delete the character and start typing. The Bold
typing style shouldn't |
| 854 // stick around. Deletion should preserve a typing style that *it* sets, howeve
r. | 854 // stick around. Deletion should preserve a typing style that *it* sets, howeve
r. |
| 855 bool DeleteSelectionCommand::preservesTypingStyle() const | 855 bool DeleteSelectionCommand::preservesTypingStyle() const |
| 856 { | 856 { |
| 857 return m_typingStyle; | 857 return m_typingStyle; |
| 858 } | 858 } |
| 859 | 859 |
| 860 } // namespace WebCore | 860 } // namespace WebCore |
| OLD | NEW |