OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 if (editingState->isAborted()) | 59 if (editingState->isAborted()) |
60 return; | 60 return; |
61 | 61 |
62 // If the node for the destination has been removed as a result of the delet
ion, | 62 // If the node for the destination has been removed as a result of the delet
ion, |
63 // set the destination to the ending point after the deletion. | 63 // set the destination to the ending point after the deletion. |
64 // Fixes: <rdar://problem/3910425> REGRESSION (Mail): Crash in ReplaceSelect
ionCommand; | 64 // Fixes: <rdar://problem/3910425> REGRESSION (Mail): Crash in ReplaceSelect
ionCommand; |
65 // selection is empty, leading to null deref | 65 // selection is empty, leading to null deref |
66 if (!pos.isConnected()) | 66 if (!pos.isConnected()) |
67 pos = endingSelection().start(); | 67 pos = endingSelection().start(); |
68 | 68 |
69 cleanupAfterDeletion(editingState, createVisiblePosition(pos)); | 69 cleanupAfterDeletion(editingState, createVisiblePositionDeprecated(pos)); |
70 if (editingState->isAborted()) | 70 if (editingState->isAborted()) |
71 return; | 71 return; |
72 | 72 |
73 setEndingSelection(VisibleSelection(pos, endingSelection().affinity(), endin
gSelection().isDirectional())); | 73 setEndingSelection(VisibleSelection(pos, endingSelection().affinity(), endin
gSelection().isDirectional())); |
74 if (!pos.isConnected()) { | 74 if (!pos.isConnected()) { |
75 // Document was modified out from under us. | 75 // Document was modified out from under us. |
76 return; | 76 return; |
77 } | 77 } |
78 ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::S
electReplacement | ReplaceSelectionCommand::PreventNesting; | 78 ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::S
electReplacement | ReplaceSelectionCommand::PreventNesting; |
79 if (m_smartInsert) | 79 if (m_smartInsert) |
80 options |= ReplaceSelectionCommand::SmartReplace; | 80 options |= ReplaceSelectionCommand::SmartReplace; |
81 applyCommandToComposite(ReplaceSelectionCommand::create(document(), m_fragme
nt, options), editingState); | 81 applyCommandToComposite(ReplaceSelectionCommand::create(document(), m_fragme
nt, options), editingState); |
82 } | 82 } |
83 | 83 |
84 InputEvent::InputType MoveSelectionCommand::inputType() const | 84 InputEvent::InputType MoveSelectionCommand::inputType() const |
85 { | 85 { |
86 return InputEvent::InputType::Drag; | 86 return InputEvent::InputType::Drag; |
87 } | 87 } |
88 | 88 |
89 DEFINE_TRACE(MoveSelectionCommand) | 89 DEFINE_TRACE(MoveSelectionCommand) |
90 { | 90 { |
91 visitor->trace(m_fragment); | 91 visitor->trace(m_fragment); |
92 visitor->trace(m_position); | 92 visitor->trace(m_position); |
93 CompositeEditCommand::trace(visitor); | 93 CompositeEditCommand::trace(visitor); |
94 } | 94 } |
95 | 95 |
96 } // namespace blink | 96 } // namespace blink |
OLD | NEW |