Chromium Code Reviews| Index: Source/core/editing/TypingCommand.cpp |
| diff --git a/Source/core/editing/TypingCommand.cpp b/Source/core/editing/TypingCommand.cpp |
| index 042d0a84c85b449a456b70578e4d3690aceb92fc..ec9d0b2bfffa78449a6347343f033e9924af4cb1 100644 |
| --- a/Source/core/editing/TypingCommand.cpp |
| +++ b/Source/core/editing/TypingCommand.cpp |
| @@ -110,11 +110,16 @@ void TypingCommand::deleteSelection(Document& document, Options options) |
| void TypingCommand::deleteKeyPressed(Document& document, Options options, TextGranularity granularity) |
| { |
| if (granularity == CharacterGranularity) { |
| - if (RefPtr<TypingCommand> lastTypingCommand = lastTypingCommandIfStillOpenForTyping(document.frame())) { |
| - updateSelectionIfDifferentFromCurrentSelection(lastTypingCommand.get(), document.frame()); |
| - lastTypingCommand->setShouldPreventSpellChecking(options & PreventSpellChecking); |
| - lastTypingCommand->deleteKeyPressed(granularity, options & KillRing); |
| - return; |
| + Frame* frame = document.frame(); |
| + if (RefPtr<TypingCommand> lastTypingCommand = lastTypingCommandIfStillOpenForTyping(frame)) { |
|
yosin_UTC9
2013/11/15 10:22:22
lastTypingCommandIfStillOpenForTyping() should che
yosin_UTC9
2013/11/15 10:55:12
I'm wrong. Please ignore this comment.
|
| + // If the last typing command is not Delete, open a new typing command. |
| + // We need to group continuous delete commands alone in a single typing command. |
| + if (lastTypingCommand->commandTypeOfOpenCommand() == DeleteKey) { |
| + updateSelectionIfDifferentFromCurrentSelection(lastTypingCommand.get(), frame); |
| + lastTypingCommand->setShouldPreventSpellChecking(options & PreventSpellChecking); |
| + lastTypingCommand->deleteKeyPressed(granularity, options & KillRing); |
| + return; |
| + } |
| } |
| } |
| @@ -124,8 +129,8 @@ void TypingCommand::deleteKeyPressed(Document& document, Options options, TextGr |
| void TypingCommand::forwardDeleteKeyPressed(Document& document, Options options, TextGranularity granularity) |
| { |
| // FIXME: Forward delete in TextEdit appears to open and close a new typing command. |
| - Frame* frame = document.frame(); |
| if (granularity == CharacterGranularity) { |
| + Frame* frame = document.frame(); |
| if (RefPtr<TypingCommand> lastTypingCommand = lastTypingCommandIfStillOpenForTyping(frame)) { |
| updateSelectionIfDifferentFromCurrentSelection(lastTypingCommand.get(), frame); |
| lastTypingCommand->setShouldPreventSpellChecking(options & PreventSpellChecking); |
| @@ -311,6 +316,7 @@ void TypingCommand::typingAddedToOpenCommand(ETypingCommand commandTypeForAddedT |
| return; |
| updatePreservesTypingStyle(commandTypeForAddedTyping); |
| + updateCommandTypeOfOpenCommand(commandTypeForAddedTyping); |
| // The old spellchecking code requires that checking be done first, to prevent issues like that in 6864072, where <doesn't> is marked as misspelled. |
| markMisspellingsAfterTyping(commandTypeForAddedTyping); |