| 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 0c89d47e76816c3c67a2a0e6d7c469ff7da1069c..9906bd5db4b89f495e1e12138ddf523db88b1f92 100644
|
| --- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
|
| @@ -349,18 +349,8 @@ void SpellChecker::markMisspellingsAfterLineBreak(const VisibleSelection& wordSe
|
| return;
|
| }
|
|
|
| - TextCheckingTypeMask textCheckingOptions = TextCheckingTypeGrammar;
|
| -
|
| if (isContinuousSpellCheckingEnabled())
|
| - textCheckingOptions |= TextCheckingTypeSpelling;
|
| -
|
| - VisibleSelection wholeParagraph(
|
| - startOfParagraph(wordSelection.visibleStart()),
|
| - endOfParagraph(wordSelection.visibleEnd()));
|
| -
|
| - markAllMisspellingsAndBadGrammarInRanges(
|
| - textCheckingOptions, wordSelection.toNormalizedEphemeralRange(),
|
| - wholeParagraph.toNormalizedEphemeralRange());
|
| + markAllMisspellingsInRange(wordSelection.toNormalizedEphemeralRange());
|
| }
|
|
|
| void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping)
|
| @@ -376,15 +366,8 @@ void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &word
|
| if (!(textCheckingOptions & TextCheckingTypeSpelling))
|
| return;
|
|
|
| - textCheckingOptions |= TextCheckingTypeGrammar;
|
| -
|
| VisibleSelection adjacentWords = VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary));
|
| - if (textCheckingOptions & TextCheckingTypeGrammar) {
|
| - VisibleSelection selectedSentence = VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart));
|
| - markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedEphemeralRange(), selectedSentence.toNormalizedEphemeralRange());
|
| - } else {
|
| - markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, adjacentWords.toNormalizedEphemeralRange(), adjacentWords.toNormalizedEphemeralRange());
|
| - }
|
| + markAllMisspellingsInRange(adjacentWords.toNormalizedEphemeralRange());
|
| return;
|
| }
|
|
|
| @@ -475,14 +458,12 @@ void SpellChecker::markBadGrammar(const VisibleSelection& selection)
|
| markMisspellingsOrBadGrammar(selection, false);
|
| }
|
|
|
| -void SpellChecker::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, const EphemeralRange& spellingRange, const EphemeralRange& grammarRange)
|
| +void SpellChecker::markAllMisspellingsInRange(const EphemeralRange& spellingRange)
|
| {
|
| DCHECK(unifiedTextCheckerEnabled());
|
|
|
| - bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar;
|
| -
|
| // This function is called with selections already expanded to word boundaries.
|
| - if (spellingRange.isNull() || (shouldMarkGrammar && grammarRange.isNull()))
|
| + if (spellingRange.isNull())
|
| return;
|
|
|
| // If we're not in an editable node, bail.
|
| @@ -493,8 +474,8 @@ void SpellChecker::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask
|
| if (!isSpellCheckingEnabledFor(editableNode))
|
| return;
|
|
|
| - TextCheckingParagraph fullParagraphToCheck(shouldMarkGrammar ? grammarRange : spellingRange);
|
| - chunkAndMarkAllMisspellingsAndBadGrammar(textCheckingOptions, fullParagraphToCheck);
|
| + TextCheckingParagraph fullParagraphToCheck(spellingRange);
|
| + chunkAndMarkAllMisspellingsAndBadGrammar(TextCheckingTypeSpelling, fullParagraphToCheck);
|
| }
|
|
|
| static EphemeralRange expandEndToSentenceBoundary(const EphemeralRange& range)
|
| @@ -673,10 +654,7 @@ void SpellChecker::markMisspellingsAndBadGrammar(const VisibleSelection& spellin
|
| return;
|
|
|
| // markMisspellingsAndBadGrammar() is triggered by selection change, in which case we check spelling and grammar, but don't autocorrect misspellings.
|
| - TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling;
|
| - if (markGrammar)
|
| - textCheckingOptions |= TextCheckingTypeGrammar;
|
| - markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, spellingSelection.toNormalizedEphemeralRange(), grammarSelection.toNormalizedEphemeralRange());
|
| + markAllMisspellingsInRange(spellingSelection.toNormalizedEphemeralRange());
|
| return;
|
| }
|
|
|
|
|