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