| 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 bool rootWillStayOpenWithoutPlaceholder = downstreamEnd.containerNode() == d
ownstreamEnd.containerNode()->rootEditableElement() | 769 m_needPlaceholder = isStartOfParagraph(m_selectionToDelete.visibleStart(), C
anCrossEditingBoundary) |
| 770 || (downstreamEnd.containerNode()->isTextNode() && downstreamEnd.contain
erNode()->parentNode() == downstreamEnd.containerNode()->rootEditableElement()); | 770 && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditin
gBoundary) |
| 771 m_needPlaceholder = !rootWillStayOpenWithoutPlaceholder | 771 && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd(
)); |
| 772 && isStartOfParagraph(m_selectionToDelete.visibleStart(), CanCrossEditin
gBoundary) | |
| 773 && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditingBou
ndary) | |
| 774 && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd()); | |
| 775 if (m_needPlaceholder) { | 772 if (m_needPlaceholder) { |
| 776 // 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 |
| 777 // 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 |
| 778 // handled elsewhere). | 775 // handled elsewhere). |
| 779 if (Node* table = isLastPositionBeforeTable(m_selectionToDelete.visibleS
tart())) | 776 if (Node* table = isLastPositionBeforeTable(m_selectionToDelete.visibleS
tart())) |
| 780 if (m_selectionToDelete.end().deprecatedNode()->isDescendantOf(table
)) | 777 if (m_selectionToDelete.end().deprecatedNode()->isDescendantOf(table
)) |
| 781 m_needPlaceholder = false; | 778 m_needPlaceholder = false; |
| 782 } | 779 } |
| 783 | 780 |
| 784 | 781 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 | 831 |
| 835 // 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, |
| 836 // 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 |
| 837 // 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. |
| 838 bool DeleteSelectionCommand::preservesTypingStyle() const | 835 bool DeleteSelectionCommand::preservesTypingStyle() const |
| 839 { | 836 { |
| 840 return m_typingStyle; | 837 return m_typingStyle; |
| 841 } | 838 } |
| 842 | 839 |
| 843 } // namespace WebCore | 840 } // namespace WebCore |
| OLD | NEW |