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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 if (!m_hasSelectionToDelete) | 756 if (!m_hasSelectionToDelete) |
757 m_selectionToDelete = endingSelection(); | 757 m_selectionToDelete = endingSelection(); |
758 | 758 |
759 if (!m_selectionToDelete.isNonOrphanedRange()) | 759 if (!m_selectionToDelete.isNonOrphanedRange()) |
760 return; | 760 return; |
761 | 761 |
762 // save this to later make the selection with | 762 // save this to later make the selection with |
763 EAffinity affinity = m_selectionToDelete.affinity(); | 763 EAffinity affinity = m_selectionToDelete.affinity(); |
764 | 764 |
765 Position downstreamEnd = m_selectionToDelete.end().downstream(); | 765 Position downstreamEnd = m_selectionToDelete.end().downstream(); |
766 m_needPlaceholder = isStartOfParagraph(m_selectionToDelete.visibleStart(), C
anCrossEditingBoundary) | 766 bool rootWillStayOpenWithoutPlaceholder = downstreamEnd.containerNode() == d
ownstreamEnd.containerNode()->rootEditableElement() |
767 && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditin
gBoundary) | 767 || (downstreamEnd.containerNode()->isTextNode() && downstreamEnd.contain
erNode()->parentNode() == downstreamEnd.containerNode()->rootEditableElement()); |
768 && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd(
)); | 768 m_needPlaceholder = !rootWillStayOpenWithoutPlaceholder |
| 769 && isStartOfParagraph(m_selectionToDelete.visibleStart(), CanCrossEditin
gBoundary) |
| 770 && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditingBou
ndary) |
| 771 && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd()); |
769 if (m_needPlaceholder) { | 772 if (m_needPlaceholder) { |
770 // Don't need a placeholder when deleting a selection that starts just b
efore a table | 773 // Don't need a placeholder when deleting a selection that starts just b
efore a table |
771 // and ends inside it (we do need placeholders to hold open empty cells,
but that's | 774 // and ends inside it (we do need placeholders to hold open empty cells,
but that's |
772 // handled elsewhere). | 775 // handled elsewhere). |
773 if (Node* table = isLastPositionBeforeTable(m_selectionToDelete.visibleS
tart())) | 776 if (Node* table = isLastPositionBeforeTable(m_selectionToDelete.visibleS
tart())) |
774 if (m_selectionToDelete.end().deprecatedNode()->isDescendantOf(table
)) | 777 if (m_selectionToDelete.end().deprecatedNode()->isDescendantOf(table
)) |
775 m_needPlaceholder = false; | 778 m_needPlaceholder = false; |
776 } | 779 } |
777 | 780 |
778 | 781 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 | 831 |
829 // Normally deletion doesn't preserve the typing style that was present before i
t. For example, | 832 // Normally deletion doesn't preserve the typing style that was present before i
t. For example, |
830 // type a character, Bold, then delete the character and start typing. The Bold
typing style shouldn't | 833 // type a character, Bold, then delete the character and start typing. The Bold
typing style shouldn't |
831 // stick around. Deletion should preserve a typing style that *it* sets, howeve
r. | 834 // stick around. Deletion should preserve a typing style that *it* sets, howeve
r. |
832 bool DeleteSelectionCommand::preservesTypingStyle() const | 835 bool DeleteSelectionCommand::preservesTypingStyle() const |
833 { | 836 { |
834 return m_typingStyle; | 837 return m_typingStyle; |
835 } | 838 } |
836 | 839 |
837 } // namespace WebCore | 840 } // namespace WebCore |
OLD | NEW |