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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
795 if (!m_replace) { | 795 if (!m_replace) { |
796 Element* textControl = enclosingTextFormControl(m_selectionToDelete.star t()); | 796 Element* textControl = enclosingTextFormControl(m_selectionToDelete.star t()); |
797 if (textControl && textControl->focused()) | 797 if (textControl && textControl->focused()) |
798 document()->frame()->editor()->textWillBeDeletedInTextField(textCont rol); | 798 document()->frame()->editor()->textWillBeDeletedInTextField(textCont rol); |
799 } | 799 } |
800 | 800 |
801 // save this to later make the selection with | 801 // save this to later make the selection with |
802 EAffinity affinity = m_selectionToDelete.affinity(); | 802 EAffinity affinity = m_selectionToDelete.affinity(); |
803 | 803 |
804 Position downstreamEnd = m_selectionToDelete.end().downstream(); | 804 Position downstreamEnd = m_selectionToDelete.end().downstream(); |
805 m_needPlaceholder = isStartOfParagraph(m_selectionToDelete.visibleStart(), C anCrossEditingBoundary) | 805 bool rootWillStayOpenWithoutPlaceholder = downstreamEnd.containerNode()->isT extNode() |
ojan
2013/05/10 23:38:21
Actually, now that I look at this more closely, wh
| |
806 && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditin gBoundary) | 806 && downstreamEnd.containerNode()->parentNode() == downstreamEnd.containe rNode()->rootEditableElement(); |
807 && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd( )); | 807 m_needPlaceholder = !rootWillStayOpenWithoutPlaceholder |
808 && isStartOfParagraph(m_selectionToDelete.visibleStart(), CanCrossEditin gBoundary) | |
809 && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditingBou ndary) | |
810 && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd()); | |
808 if (m_needPlaceholder) { | 811 if (m_needPlaceholder) { |
809 // Don't need a placeholder when deleting a selection that starts just b efore a table | 812 // Don't need a placeholder when deleting a selection that starts just b efore a table |
810 // and ends inside it (we do need placeholders to hold open empty cells, but that's | 813 // and ends inside it (we do need placeholders to hold open empty cells, but that's |
811 // handled elsewhere). | 814 // handled elsewhere). |
812 if (Node* table = isLastPositionBeforeTable(m_selectionToDelete.visibleS tart())) | 815 if (Node* table = isLastPositionBeforeTable(m_selectionToDelete.visibleS tart())) |
813 if (m_selectionToDelete.end().deprecatedNode()->isDescendantOf(table )) | 816 if (m_selectionToDelete.end().deprecatedNode()->isDescendantOf(table )) |
814 m_needPlaceholder = false; | 817 m_needPlaceholder = false; |
815 } | 818 } |
816 | 819 |
817 | 820 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
872 | 875 |
873 // Normally deletion doesn't preserve the typing style that was present before i t. For example, | 876 // Normally deletion doesn't preserve the typing style that was present before i t. For example, |
874 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't | 877 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't |
875 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. | 878 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. |
876 bool DeleteSelectionCommand::preservesTypingStyle() const | 879 bool DeleteSelectionCommand::preservesTypingStyle() const |
877 { | 880 { |
878 return m_typingStyle; | 881 return m_typingStyle; |
879 } | 882 } |
880 | 883 |
881 } // namespace WebCore | 884 } // namespace WebCore |
OLD | NEW |