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 0c89d47e76816c3c67a2a0e6d7c469ff7da1069c..69bccadffa08d284b946c429cff24dc30d232d09 100644 |
| --- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp |
| +++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp |
| @@ -392,45 +392,7 @@ void SpellChecker::markMisspellingsAfterTypingToWord(const VisiblePosition &word |
| return; |
| // Check spelling of one word |
| - bool result = markMisspellings(VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary))); |
| - |
| - if (!result) |
| - return; |
| - |
| - // Check grammar of entire sentence |
| - markBadGrammar(VisibleSelection(startOfSentence(wordStart), endOfSentence(wordStart))); |
| -} |
| - |
| -bool SpellChecker::markMisspellingsOrBadGrammar(const VisibleSelection& selection, bool checkSpelling) |
| -{ |
| - // This function is called with a selection already expanded to word boundaries. |
| - // Might be nice to assert that here. |
| - |
| - // This function is used only for as-you-type checking, so if that's off we do nothing. Note that |
| - // grammar checking can only be on if spell checking is also on. |
| - if (!isContinuousSpellCheckingEnabled()) |
| - return false; |
| - |
| - TRACE_EVENT0("blink", "SpellChecker::markMisspellingsOrBadGrammar"); |
| - |
| - const EphemeralRange range = selection.toNormalizedEphemeralRange(); |
| - if (range.isNull()) |
| - return false; |
| - |
| - // If we're not in an editable node, bail. |
| - Node* editableNode = range.startPosition().computeContainerNode(); |
| - if (!editableNode || !hasEditableStyle(*editableNode)) |
| - return false; |
| - |
| - if (!isSpellCheckingEnabledFor(editableNode)) |
| - return false; |
| - |
| - TextCheckingHelper checker(spellCheckerClient(), range.startPosition(), range.endPosition()); |
| - if (checkSpelling) |
| - return checker.markAllMisspellings(); |
| - |
| - checker.markAllBadGrammar(); |
| - return false; |
| + markMisspellings(VisibleSelection(startOfWord(wordStart, LeftWordIfOnBoundary), endOfWord(wordStart, RightWordIfOnBoundary))); |
| } |
| bool SpellChecker::isSpellCheckingEnabledFor(Node* node) const |
| @@ -467,12 +429,30 @@ bool SpellChecker::isSpellCheckingEnabledFor(const VisibleSelection& selection) |
| bool SpellChecker::markMisspellings(const VisibleSelection& selection) |
|
yosin_UTC9
2016/08/02 01:36:37
OPTIONAL: What return |bool| is? Could you add a c
Xiaocheng
2016/08/02 02:50:38
The return value indicates whether the spelling is
|
| { |
| - return markMisspellingsOrBadGrammar(selection, true); |
| -} |
| + // This function is called with a selection already expanded to word boundaries. |
|
yosin_UTC9
2016/08/02 01:36:37
nit: Please use |TODO(email): ...| format.
Xiaocheng
2016/08/02 02:50:38
Done.
|
| + // Might be nice to assert that here. |
| -void SpellChecker::markBadGrammar(const VisibleSelection& selection) |
| -{ |
| - markMisspellingsOrBadGrammar(selection, false); |
| + // This function is used only for as-you-type checking, so if that's off we do nothing. Note that |
| + // grammar checking can only be on if spell checking is also on. |
| + if (!isContinuousSpellCheckingEnabled()) |
| + return false; |
| + |
| + TRACE_EVENT0("blink", "SpellChecker::markMisspellingsOrBadGrammar"); |
| + |
| + const EphemeralRange range = selection.toNormalizedEphemeralRange(); |
|
yosin_UTC9
2016/08/02 01:36:37
s/const EphemeralRange/const EphemeralRange&/ to a
Xiaocheng
2016/08/02 02:50:38
Done.
|
| + if (range.isNull()) |
| + return false; |
| + |
| + // If we're not in an editable node, bail. |
| + Node* editableNode = range.startPosition().computeContainerNode(); |
| + if (!editableNode || !hasEditableStyle(*editableNode)) |
| + return false; |
| + |
| + if (!isSpellCheckingEnabledFor(editableNode)) |
| + return false; |
| + |
| + TextCheckingHelper checker(spellCheckerClient(), range.startPosition(), range.endPosition()); |
| + return checker.markAllMisspellings(); |
| } |
| void SpellChecker::markAllMisspellingsAndBadGrammarInRanges(TextCheckingTypeMask textCheckingOptions, const EphemeralRange& spellingRange, const EphemeralRange& grammarRange) |
| @@ -681,8 +661,6 @@ void SpellChecker::markMisspellingsAndBadGrammar(const VisibleSelection& spellin |
| } |
| markMisspellings(spellingSelection); |
| - if (markGrammar) |
| - markBadGrammar(grammarSelection); |
| } |
| void SpellChecker::updateMarkersForWordsAffectedByEditing(bool doNotRemoveIfSelectionAtWordBoundary) |