Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/Editor.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp |
| index 6ac01cdf4159227f26899b2694297968b60a8101..a483bf39cf97484cbd15a9c4838b35e3d682a4ee 100644 |
| --- a/third_party/WebKit/Source/core/editing/Editor.cpp |
| +++ b/third_party/WebKit/Source/core/editing/Editor.cpp |
| @@ -509,14 +509,6 @@ void Editor::replaceSelectionWithFragment(PassRefPtrWillBeRawPtr<DocumentFragmen |
| ASSERT(frame().document()); |
| ReplaceSelectionCommand::create(*frame().document(), fragment, options, EditActionPaste)->apply(); |
| revealSelectionAfterEditingOperation(); |
| - |
| - if (frame().selection().isInPasswordField() || !spellChecker().isContinuousSpellCheckingEnabled()) |
| - return; |
| - ASSERT(lastEditCommand()->isReplaceSelectionCommand()); |
| - const EphemeralRange& insertedRange = toReplaceSelectionCommand(lastEditCommand())->insertedRange(); |
| - if (insertedRange.isNull()) |
| - return; |
| - spellChecker().chunkAndMarkAllMisspellingsAndBadGrammar(frame().selection().rootEditableElement(), insertedRange); |
| } |
| void Editor::replaceSelectionWithText(const String& text, bool selectReplacement, bool smartReplace) |
| @@ -658,6 +650,19 @@ void Editor::appliedEditing(PassRefPtrWillBeRawPtr<CompositeEditCommand> cmd) |
| EventQueueScope scope; |
| frame().document()->updateLayout(); |
| + // Need to request spell checking after pasting, which must be done before |
| + // any further DOM change. |
| + // Note: We enter this branch for and only for |ReplaceSelectionCommand|s |
| + // created in |Editor::replaceSelectionWithFragment()|. |
| + if (cmd->editingAction() == EditActionPaste) { |
|
yosin_UTC9
2016/01/27 02:06:43
Can we have a function |Editor::requestSpellChecki
Xiaocheng
2016/01/27 02:49:10
Good point, I'll move them to a separate function.
|
| + ASSERT(cmd->isReplaceSelectionCommand()); |
| + if (!frame().selection().isInPasswordField() && spellChecker().isContinuousSpellCheckingEnabled()) { |
| + const EphemeralRange& insertedRange = toReplaceSelectionCommand(cmd.get())->insertedRange(); |
| + if (insertedRange.isNotNull()) |
| + spellChecker().chunkAndMarkAllMisspellingsAndBadGrammar(cmd->endingSelection().rootEditableElement(), insertedRange); |
| + } |
| + } |
| + |
| EditCommandComposition* composition = cmd->composition(); |
| ASSERT(composition); |
| dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement()); |