| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 end = e; | 153 end = e; |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 void DeleteSelectionCommand::setStartingSelectionOnSmartDelete(const Position& s
tart, const Position& end) | 158 void DeleteSelectionCommand::setStartingSelectionOnSmartDelete(const Position& s
tart, const Position& end) |
| 159 { | 159 { |
| 160 bool isBaseFirst = startingSelection().isBaseFirst(); | 160 bool isBaseFirst = startingSelection().isBaseFirst(); |
| 161 VisiblePosition newBase = createVisiblePositionDeprecated(isBaseFirst ? star
t : end); | 161 VisiblePosition newBase = createVisiblePositionDeprecated(isBaseFirst ? star
t : end); |
| 162 VisiblePosition newExtent = createVisiblePositionDeprecated(isBaseFirst ? en
d : start); | 162 VisiblePosition newExtent = createVisiblePositionDeprecated(isBaseFirst ? en
d : start); |
| 163 setStartingSelection(VisibleSelection(newBase, newExtent, startingSelection(
).isDirectional())); | 163 setStartingSelection(createVisibleSelectionDeprecated(newBase, newExtent, st
artingSelection().isDirectional())); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void DeleteSelectionCommand::initializePositionData(EditingState* editingState) | 166 void DeleteSelectionCommand::initializePositionData(EditingState* editingState) |
| 167 { | 167 { |
| 168 Position start, end; | 168 Position start, end; |
| 169 initializeStartEnd(start, end); | 169 initializeStartEnd(start, end); |
| 170 DCHECK(start.isNotNull()); | 170 DCHECK(start.isNotNull()); |
| 171 DCHECK(end.isNotNull()); | 171 DCHECK(end.isNotNull()); |
| 172 if (!isEditablePosition(start)) { | 172 if (!isEditablePosition(start)) { |
| 173 editingState->abort(); | 173 editingState->abort(); |
| (...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 | 875 |
| 876 saveTypingStyleState(); | 876 saveTypingStyleState(); |
| 877 | 877 |
| 878 // deleting just a BR is handled specially, at least because we do not | 878 // deleting just a BR is handled specially, at least because we do not |
| 879 // want to replace it with a placeholder BR! | 879 // want to replace it with a placeholder BR! |
| 880 bool brResult = handleSpecialCaseBRDelete(editingState); | 880 bool brResult = handleSpecialCaseBRDelete(editingState); |
| 881 if (editingState->isAborted()) | 881 if (editingState->isAborted()) |
| 882 return; | 882 return; |
| 883 if (brResult) { | 883 if (brResult) { |
| 884 calculateTypingStyleAfterDelete(); | 884 calculateTypingStyleAfterDelete(); |
| 885 setEndingSelection(VisibleSelection(m_endingPosition, affinity, endingSe
lection().isDirectional())); | 885 setEndingSelection(createVisibleSelectionDeprecated(m_endingPosition, af
finity, endingSelection().isDirectional())); |
| 886 clearTransientState(); | 886 clearTransientState(); |
| 887 rebalanceWhitespace(); | 887 rebalanceWhitespace(); |
| 888 return; | 888 return; |
| 889 } | 889 } |
| 890 | 890 |
| 891 handleGeneralDelete(editingState); | 891 handleGeneralDelete(editingState); |
| 892 if (editingState->isAborted()) | 892 if (editingState->isAborted()) |
| 893 return; | 893 return; |
| 894 | 894 |
| 895 fixupWhitespace(); | 895 fixupWhitespace(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 923 insertNodeAt(placeholder, m_endingPosition, editingState); | 923 insertNodeAt(placeholder, m_endingPosition, editingState); |
| 924 if (editingState->isAborted()) | 924 if (editingState->isAborted()) |
| 925 return; | 925 return; |
| 926 } | 926 } |
| 927 } | 927 } |
| 928 | 928 |
| 929 rebalanceWhitespaceAt(m_endingPosition); | 929 rebalanceWhitespaceAt(m_endingPosition); |
| 930 | 930 |
| 931 calculateTypingStyleAfterDelete(); | 931 calculateTypingStyleAfterDelete(); |
| 932 | 932 |
| 933 setEndingSelection(VisibleSelection(m_endingPosition, affinity, endingSelect
ion().isDirectional())); | 933 setEndingSelection(createVisibleSelectionDeprecated(m_endingPosition, affini
ty, endingSelection().isDirectional())); |
| 934 clearTransientState(); | 934 clearTransientState(); |
| 935 } | 935 } |
| 936 | 936 |
| 937 InputEvent::InputType DeleteSelectionCommand::inputType() const | 937 InputEvent::InputType DeleteSelectionCommand::inputType() const |
| 938 { | 938 { |
| 939 // |DeleteSelectionCommand| could be used with Cut, Menu Bar deletion and |T
ypingCommand|. | 939 // |DeleteSelectionCommand| could be used with Cut, Menu Bar deletion and |T
ypingCommand|. |
| 940 // 1. Cut and Menu Bar deletion should rely on correct |m_inputType|. | 940 // 1. Cut and Menu Bar deletion should rely on correct |m_inputType|. |
| 941 // 2. |TypingCommand| will supply the |inputType()|, so |m_inputType| could
default to |InputType::None|. | 941 // 2. |TypingCommand| will supply the |inputType()|, so |m_inputType| could
default to |InputType::None|. |
| 942 return m_inputType; | 942 return m_inputType; |
| 943 } | 943 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 966 visitor->trace(m_deleteIntoBlockquoteStyle); | 966 visitor->trace(m_deleteIntoBlockquoteStyle); |
| 967 visitor->trace(m_startRoot); | 967 visitor->trace(m_startRoot); |
| 968 visitor->trace(m_endRoot); | 968 visitor->trace(m_endRoot); |
| 969 visitor->trace(m_startTableRow); | 969 visitor->trace(m_startTableRow); |
| 970 visitor->trace(m_endTableRow); | 970 visitor->trace(m_endTableRow); |
| 971 visitor->trace(m_temporaryPlaceholder); | 971 visitor->trace(m_temporaryPlaceholder); |
| 972 CompositeEditCommand::trace(visitor); | 972 CompositeEditCommand::trace(visitor); |
| 973 } | 973 } |
| 974 | 974 |
| 975 } // namespace blink | 975 } // namespace blink |
| OLD | NEW |