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 19 matching lines...) Expand all Loading... | |
30 #include "DocumentFragment.h" | 30 #include "DocumentFragment.h" |
31 #include "DocumentMarkerController.h" | 31 #include "DocumentMarkerController.h" |
32 #include "EditingBoundary.h" | 32 #include "EditingBoundary.h" |
33 #include "Editor.h" | 33 #include "Editor.h" |
34 #include "EditorClient.h" | 34 #include "EditorClient.h" |
35 #include "Element.h" | 35 #include "Element.h" |
36 #include "Frame.h" | 36 #include "Frame.h" |
37 #include "htmlediting.h" | 37 #include "htmlediting.h" |
38 #include "HTMLInputElement.h" | 38 #include "HTMLInputElement.h" |
39 #include "HTMLNames.h" | 39 #include "HTMLNames.h" |
40 #include "HTMLTextAreaElement.h" | |
40 #include "NodeTraversal.h" | 41 #include "NodeTraversal.h" |
41 #include "RenderTableCell.h" | 42 #include "RenderTableCell.h" |
42 #include "Text.h" | 43 #include "Text.h" |
43 #include "VisibleUnits.h" | 44 #include "VisibleUnits.h" |
44 | 45 |
45 namespace WebCore { | 46 namespace WebCore { |
46 | 47 |
47 using namespace HTMLNames; | 48 using namespace HTMLNames; |
48 | 49 |
49 static bool isTableRow(const Node* node) | 50 static bool isTableRow(const Node* node) |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
784 // use the current ending selection. | 785 // use the current ending selection. |
785 if (!m_hasSelectionToDelete) | 786 if (!m_hasSelectionToDelete) |
786 m_selectionToDelete = endingSelection(); | 787 m_selectionToDelete = endingSelection(); |
787 | 788 |
788 if (!m_selectionToDelete.isNonOrphanedRange()) | 789 if (!m_selectionToDelete.isNonOrphanedRange()) |
789 return; | 790 return; |
790 | 791 |
791 String originalString = originalStringForAutocorrectionAtBeginningOfSelectio n(); | 792 String originalString = originalStringForAutocorrectionAtBeginningOfSelectio n(); |
792 | 793 |
793 // If the deletion is occurring in a text field, and we're not deleting to r eplace the selection, then let the frame call across the bridge to notify the fo rm delegate. | 794 // If the deletion is occurring in a text field, and we're not deleting to r eplace the selection, then let the frame call across the bridge to notify the fo rm delegate. |
795 Element* textControl = enclosingTextFormControl(m_selectionToDelete.start()) ; | |
794 if (!m_replace) { | 796 if (!m_replace) { |
795 Element* textControl = enclosingTextFormControl(m_selectionToDelete.star t()); | |
796 if (textControl && textControl->focused()) | 797 if (textControl && textControl->focused()) |
797 document()->frame()->editor()->textWillBeDeletedInTextField(textCont rol); | 798 document()->frame()->editor()->textWillBeDeletedInTextField(textCont rol); |
798 } | 799 } |
799 | 800 |
800 // save this to later make the selection with | 801 // save this to later make the selection with |
801 EAffinity affinity = m_selectionToDelete.affinity(); | 802 EAffinity affinity = m_selectionToDelete.affinity(); |
802 | 803 |
803 Position downstreamEnd = m_selectionToDelete.end().downstream(); | 804 Position downstreamEnd = m_selectionToDelete.end().downstream(); |
804 m_needPlaceholder = isStartOfParagraph(m_selectionToDelete.visibleStart(), C anCrossEditingBoundary) | 805 m_needPlaceholder = isStartOfParagraph(m_selectionToDelete.visibleStart(), C anCrossEditingBoundary) |
805 && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditin gBoundary) | 806 && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditin gBoundary) |
806 && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd( )); | 807 && !lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd( )) |
808 && !isHTMLTextAreaElement(textControl) && !textControl->toInputEleme nt(); | |
ojan
2013/04/08 19:23:36
If you're willing to try it out, I had a more gene
aurimas (slooooooooow)
2013/04/09 21:54:21
I tried adding !m_endingPosition.containerNode()->
leviw_travelin_and_unemployed
2013/04/09 23:54:29
Ojan, I think your change is correct, but simply v
| |
807 if (m_needPlaceholder) { | 809 if (m_needPlaceholder) { |
808 // Don't need a placeholder when deleting a selection that starts just b efore a table | 810 // Don't need a placeholder when deleting a selection that starts just b efore a table |
809 // and ends inside it (we do need placeholders to hold open empty cells, but that's | 811 // and ends inside it (we do need placeholders to hold open empty cells, but that's |
810 // handled elsewhere). | 812 // handled elsewhere). |
811 if (Node* table = isLastPositionBeforeTable(m_selectionToDelete.visibleS tart())) | 813 if (Node* table = isLastPositionBeforeTable(m_selectionToDelete.visibleS tart())) |
812 if (m_selectionToDelete.end().deprecatedNode()->isDescendantOf(table )) | 814 if (m_selectionToDelete.end().deprecatedNode()->isDescendantOf(table )) |
813 m_needPlaceholder = false; | 815 m_needPlaceholder = false; |
814 } | 816 } |
815 | 817 |
816 | 818 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
871 | 873 |
872 // Normally deletion doesn't preserve the typing style that was present before i t. For example, | 874 // Normally deletion doesn't preserve the typing style that was present before i t. For example, |
873 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't | 875 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't |
874 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. | 876 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. |
875 bool DeleteSelectionCommand::preservesTypingStyle() const | 877 bool DeleteSelectionCommand::preservesTypingStyle() const |
876 { | 878 { |
877 return m_typingStyle; | 879 return m_typingStyle; |
878 } | 880 } |
879 | 881 |
880 } // namespace WebCore | 882 } // namespace WebCore |
OLD | NEW |