Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp

Issue 2199203002: Remove grammar checking from markAllMisspellingsAndBadGrammarInRanges (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698