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

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

Issue 2763893002: [WIP] Clean up DocumentMarkerController API (Closed)
Patch Set: Created 3 years, 9 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 27ae01b469ee1bcd7552b7758d107ab3ae2a253d..120d0f244ac4df080224f38d0047cad9ffc10689 100644
--- a/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
+++ b/third_party/WebKit/Source/core/editing/spellcheck/SpellChecker.cpp
@@ -302,9 +302,8 @@ void SpellChecker::advanceToNextMisspelling(bool startBeforeSelection) {
.build());
frame().selection().revealSelection();
spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord);
- frame().document()->markers().addMarker(misspellingRange.startPosition(),
- misspellingRange.endPosition(),
- DocumentMarker::Spelling);
+ frame().document()->markers().addSpellingMarker(
+ misspellingRange.startPosition(), misspellingRange.endPosition());
}
}
@@ -548,8 +547,15 @@ static void addMarker(Document* document,
return;
if (!SpellChecker::isSpellCheckingEnabledAt(rangeToMark.endPosition()))
return;
- document->markers().addMarker(rangeToMark.startPosition(),
- rangeToMark.endPosition(), type, description);
+
+ DCHECK(type == DocumentMarker::Grammar || type == DocumentMarker::Spelling);
+ if (type == DocumentMarker::Grammar) {
+ document->markers().addGrammarMarker(
+ rangeToMark.startPosition(), rangeToMark.endPosition(), description);
+ } else {
+ document->markers().addSpellingMarker(
+ rangeToMark.startPosition(), rangeToMark.endPosition(), description);
+ }
}
void SpellChecker::markAndReplaceFor(
@@ -917,10 +923,8 @@ void SpellChecker::removeSpellingMarkers() {
void SpellChecker::removeSpellingMarkersUnderWords(
const Vector<String>& words) {
- MarkerRemoverPredicate removerPredicate(words);
-
DocumentMarkerController& markerController = frame().document()->markers();
- markerController.removeMarkers(removerPredicate);
+ markerController.removeSpellingMarkersForWords(words);
markerController.repaintMarkers();
}

Powered by Google App Engine
This is Rietveld 408576698