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

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: Split off InputMethodControllerTest changes, make other requested changes 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..fadc5589c455c3d52914c97327959907893f469d 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,8 @@ static void AddMarker(Document* document,
int location,
int length,
const String& description) {
+ DCHECK(type == DocumentMarker::kSpelling || type == DocumentMarker::kGrammar)
+ << type;
DCHECK_GT(length, 0);
DCHECK_GE(location, 0);
const EphemeralRange& range_to_mark =
@@ -547,8 +548,17 @@ 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);
+ return;
+ }
+
+ DCHECK_EQ(type, DocumentMarker::kGrammar);
+ document->Markers().AddGrammarMarker(
+ range_to_mark.StartPosition(), range_to_mark.EndPosition(), description);
}
void SpellChecker::MarkAndReplaceFor(

Powered by Google App Engine
This is Rietveld 408576698