OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 CompositeEditCommand::CompositeEditCommand(Document& document) | 149 CompositeEditCommand::CompositeEditCommand(Document& document) |
150 : EditCommand(document) | 150 : EditCommand(document) |
151 { | 151 { |
152 } | 152 } |
153 | 153 |
154 CompositeEditCommand::~CompositeEditCommand() | 154 CompositeEditCommand::~CompositeEditCommand() |
155 { | 155 { |
156 ASSERT(isTopLevelCommand() || !m_composition); | 156 ASSERT(isTopLevelCommand() || !m_composition); |
157 } | 157 } |
158 | 158 |
159 static int applyNestingCounter; | |
160 | |
159 void CompositeEditCommand::apply() | 161 void CompositeEditCommand::apply() |
160 { | 162 { |
163 if (applyNestingCounter) | |
164 return; | |
165 | |
161 if (!endingSelection().isContentRichlyEditable()) { | 166 if (!endingSelection().isContentRichlyEditable()) { |
162 switch (editingAction()) { | 167 switch (editingAction()) { |
163 case EditActionTyping: | 168 case EditActionTyping: |
164 case EditActionPaste: | 169 case EditActionPaste: |
165 case EditActionDrag: | 170 case EditActionDrag: |
166 case EditActionSetWritingDirection: | 171 case EditActionSetWritingDirection: |
167 case EditActionCut: | 172 case EditActionCut: |
168 case EditActionUnspecified: | 173 case EditActionUnspecified: |
169 break; | 174 break; |
170 default: | 175 default: |
171 ASSERT_NOT_REACHED(); | 176 ASSERT_NOT_REACHED(); |
172 return; | 177 return; |
173 } | 178 } |
174 } | 179 } |
175 ensureComposition(); | 180 ensureComposition(); |
176 | 181 |
177 // Changes to the document may have been made since the last editing operati on that require a layout, as in <rdar://problem/5658603>. | 182 // Changes to the document may have been made since the last editing operati on that require a layout, as in <rdar://problem/5658603>. |
178 // Low level operations, like RemoveNodeCommand, don't require a layout beca use the high level operations that use them perform one | 183 // Low level operations, like RemoveNodeCommand, don't require a layout beca use the high level operations that use them perform one |
179 // if one is necessary (like for the creation of VisiblePositions). | 184 // if one is necessary (like for the creation of VisiblePositions). |
180 document().updateLayoutIgnorePendingStylesheets(); | 185 document().updateLayoutIgnorePendingStylesheets(); |
181 | 186 |
182 Frame* frame = document().frame(); | 187 Frame* frame = document().frame(); |
183 ASSERT(frame); | 188 ASSERT(frame); |
184 { | 189 { |
185 EventQueueScope scope; | 190 EventQueueScope scope; |
191 ++applyNestingCounter; | |
leviw_travelin_and_unemployed
2013/11/13 21:16:18
I like the idea... Can we make this RAII instead?
| |
186 doApply(); | 192 doApply(); |
193 --applyNestingCounter; | |
187 } | 194 } |
188 | 195 |
189 // Only need to call appliedEditing for top-level commands, | 196 // Only need to call appliedEditing for top-level commands, |
190 // and TypingCommands do it on their own (see TypingCommand::typingAddedToOp enCommand). | 197 // and TypingCommands do it on their own (see TypingCommand::typingAddedToOp enCommand). |
191 if (!isTypingCommand()) | 198 if (!isTypingCommand()) |
192 frame->editor().appliedEditing(this); | 199 frame->editor().appliedEditing(this); |
193 setShouldRetainAutocorrectionIndicator(false); | 200 setShouldRetainAutocorrectionIndicator(false); |
194 } | 201 } |
195 | 202 |
196 EditCommandComposition* CompositeEditCommand::ensureComposition() | 203 EditCommandComposition* CompositeEditCommand::ensureComposition() |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1463 return node.release(); | 1470 return node.release(); |
1464 } | 1471 } |
1465 | 1472 |
1466 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) | 1473 PassRefPtr<Element> createBlockPlaceholderElement(Document& document) |
1467 { | 1474 { |
1468 RefPtr<Element> breakNode = document.createElement(brTag, false); | 1475 RefPtr<Element> breakNode = document.createElement(brTag, false); |
1469 return breakNode.release(); | 1476 return breakNode.release(); |
1470 } | 1477 } |
1471 | 1478 |
1472 } // namespace WebCore | 1479 } // namespace WebCore |
OLD | NEW |