| Index: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
|
| index 07c4c9611ec3ad3495929e7c0048a1b8d5ead985..12cd1930c72d066d8636af8e67e6258ea0fe2636 100644
|
| --- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
|
| @@ -796,37 +796,38 @@ void SpellChecker::respondToChangedSelection(const VisibleSelection& oldSelectio
|
| if (!isSpellCheckingEnabledFor(oldSelection))
|
| return;
|
|
|
| - bool closeTyping = options & FrameSelection::CloseTyping;
|
| - bool isContinuousSpellCheckingEnabled = this->isContinuousSpellCheckingEnabled();
|
| - bool isContinuousGrammarCheckingEnabled = isContinuousSpellCheckingEnabled;
|
| - if (isContinuousSpellCheckingEnabled && closeTyping && shouldCheckOldSelection(oldSelection)) {
|
| - VisibleSelection newAdjacentWords;
|
| - bool caretBrowsing = frame().settings() && frame().settings()->caretBrowsingEnabled();
|
| - const VisibleSelection newSelection = frame().selection().selection();
|
| - if (isSelectionInTextFormControl(newSelection)) {
|
| - Position newStart = newSelection.start();
|
| - newAdjacentWords.setWithoutValidation(HTMLTextFormControlElement::startOfWord(newStart), HTMLTextFormControlElement::endOfWord(newStart));
|
| - } else {
|
| - frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
|
| - if (newSelection.isContentEditable() || caretBrowsing) {
|
| - VisiblePosition newStart(newSelection.visibleStart());
|
| - newAdjacentWords = VisibleSelection(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary));
|
| - }
|
| - }
|
| -
|
| - // When typing we check spelling elsewhere, so don't redo it here.
|
| - // If this is a change in selection resulting from a delete operation,
|
| - // oldSelection may no longer be in the document.
|
| - // FIXME(http://crbug.com/382809): if oldSelection is on a textarea
|
| - // element, we cause synchronous layout.
|
| - spellCheckOldSelection(oldSelection, newAdjacentWords);
|
| - }
|
| -
|
| // When continuous spell checking is off, existing markers disappear after the selection changes.
|
| - if (!isContinuousSpellCheckingEnabled)
|
| + if (!isContinuousSpellCheckingEnabled()) {
|
| frame().document()->markers().removeMarkers(DocumentMarker::Spelling);
|
| - if (!isContinuousGrammarCheckingEnabled)
|
| frame().document()->markers().removeMarkers(DocumentMarker::Grammar);
|
| + return;
|
| + }
|
| +
|
| + if (!(options & FrameSelection::CloseTyping))
|
| + return;
|
| + if (!shouldCheckOldSelection(oldSelection))
|
| + return;
|
| +
|
| + VisibleSelection newAdjacentWords;
|
| + const VisibleSelection newSelection = frame().selection().selection();
|
| + if (isSelectionInTextFormControl(newSelection)) {
|
| + const Position newStart = newSelection.start();
|
| + newAdjacentWords.setWithoutValidation(HTMLTextFormControlElement::startOfWord(newStart), HTMLTextFormControlElement::endOfWord(newStart));
|
| + } else {
|
| + frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
|
| + const bool caretBrowsing = frame().settings() && frame().settings()->caretBrowsingEnabled();
|
| + if (newSelection.isContentEditable() || caretBrowsing) {
|
| + const VisiblePosition newStart(newSelection.visibleStart());
|
| + newAdjacentWords = VisibleSelection(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary));
|
| + }
|
| + }
|
| +
|
| + // When typing we check spelling elsewhere, so don't redo it here.
|
| + // If this is a change in selection resulting from a delete operation,
|
| + // oldSelection may no longer be in the document.
|
| + // FIXME(http://crbug.com/382809): if oldSelection is on a textarea
|
| + // element, we cause synchronous layout.
|
| + spellCheckOldSelection(oldSelection, newAdjacentWords);
|
| }
|
|
|
| void SpellChecker::removeSpellingMarkers()
|
|
|