| 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..c609408dc787c2bbba5441a3e7a175ab84599b3c 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)
|
| @@ -653,11 +645,29 @@ static void dispatchEditableContentChangedEvents(PassRefPtrWillBeRawPtr<Element>
|
| endRoot->dispatchEvent(Event::create(EventTypeNames::webkitEditableContentChanged));
|
| }
|
|
|
| +void Editor::requestSpellcheckingAfterApplyingCommand(CompositeEditCommand* cmd)
|
| +{
|
| + // Note: Request spell checking for and only for |ReplaceSelectionCommand|s
|
| + // created in |Editor::replaceSelectionWithFragment()|.
|
| + // TODO(xiaochengh): May also need to do this after dragging crbug.com/298046.
|
| + if (cmd->editingAction() != EditActionPaste)
|
| + return;
|
| + if (!frame().selection().isInPasswordField() && spellChecker().isContinuousSpellCheckingEnabled())
|
| + return;
|
| + ASSERT(cmd->isReplaceSelectionCommand());
|
| + const EphemeralRange& insertedRange = toReplaceSelectionCommand(cmd)->insertedRange();
|
| + if (insertedRange.isNotNull())
|
| + spellChecker().chunkAndMarkAllMisspellingsAndBadGrammar(cmd->endingSelection().rootEditableElement(), insertedRange);
|
| +}
|
| +
|
| void Editor::appliedEditing(PassRefPtrWillBeRawPtr<CompositeEditCommand> cmd)
|
| {
|
| EventQueueScope scope;
|
| frame().document()->updateLayout();
|
|
|
| + // Request spell checking after pasting before any further DOM change.
|
| + requestSpellcheckingAfterApplyingCommand(cmd.get());
|
| +
|
| EditCommandComposition* composition = cmd->composition();
|
| ASSERT(composition);
|
| dispatchEditableContentChangedEvents(composition->startingRootEditableElement(), composition->endingRootEditableElement());
|
|
|