Chromium Code Reviews| 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..6ccfc11bca8c7006a8618ef7ac4cd5932f971562 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 (!this->isContinuousSpellCheckingEnabled()) { |
|
yosin_UTC9
2016/07/01 08:57:09
nit: s/this->// since we don't have local variable
yoichio
2016/07/04 02:23:20
What do you mean?
yosin_UTC9
2016/07/04 04:29:30
Before your patch, L800 has |bool isContinuousSpel
yoichio
2016/07/04 05:00:44
I see. Done.
|
| 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() |