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

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

Issue 2895253003: Split general DocumentMarkerController::AddMarker() method into spelling/grammar versions (Closed)
Patch Set: Created 3 years, 7 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
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 bd6fad960936c59028da2e15856885b717236563..ffb5cbd56bd6760f2c895f7adddfcfa2a944490f 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -305,9 +305,8 @@ void SpellChecker::AdvanceToNextMisspelling(bool start_before_selection) {
.Build());
GetFrame().Selection().RevealSelection();
GetSpellCheckerClient().UpdateSpellingUIWithMisspelledWord(misspelled_word);
- GetFrame().GetDocument()->Markers().AddMarker(
- misspelling_range.StartPosition(), misspelling_range.EndPosition(),
- DocumentMarker::kSpelling);
+ GetFrame().GetDocument()->Markers().AddSpellingMarker(
+ misspelling_range.StartPosition(), misspelling_range.EndPosition());
}
}
@@ -539,6 +538,7 @@ static void AddMarker(Document* document,
int location,
int length,
const String& description) {
+ DCHECK(type == DocumentMarker::kSpelling || type == DocumentMarker::kGrammar);
yosin_UTC9 2017/05/23 09:35:04 nit: s/);/) << type;/
DCHECK_GT(length, 0);
DCHECK_GE(location, 0);
const EphemeralRange& range_to_mark =
@@ -547,8 +547,16 @@ static void AddMarker(Document* document,
return;
if (!SpellChecker::IsSpellCheckingEnabledAt(range_to_mark.EndPosition()))
return;
- document->Markers().AddMarker(range_to_mark.StartPosition(),
- range_to_mark.EndPosition(), type, description);
+
+ if (type == DocumentMarker::kSpelling) {
+ document->Markers().AddSpellingMarker(range_to_mark.StartPosition(),
+ range_to_mark.EndPosition(),
+ description);
yosin_UTC9 2017/05/23 09:35:04 Please add |return| for early-return style.
+ } else {
+ document->Markers().AddGrammarMarker(range_to_mark.StartPosition(),
yosin_UTC9 2017/05/23 09:35:04 Please add DCHECK_EQ(type, DM::kGrammar);
+ range_to_mark.EndPosition(),
+ description);
+ }
}
void SpellChecker::MarkAndReplaceFor(

Powered by Google App Engine
This is Rietveld 408576698