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

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp

Issue 2911723002: [DMC #24] Add SpellingMarker and GrammarMarker (subclasses of DocumentMarker) (Closed)
Patch Set: Add IsSpellCheckMarker() tests 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/markers/DocumentMarkerController.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
index 0064a7f4c21f0ce6fef7e6cac1c1b8d8ad02e76b..55800d2253b6131242523bc4b2cea66922843441 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -37,7 +37,9 @@
#include "core/editing/markers/CompositionMarker.h"
#include "core/editing/markers/CompositionMarkerListImpl.h"
#include "core/editing/markers/DocumentMarkerListEditor.h"
+#include "core/editing/markers/GrammarMarker.h"
#include "core/editing/markers/GrammarMarkerListImpl.h"
+#include "core/editing/markers/SpellingMarker.h"
#include "core/editing/markers/SpellingMarkerListImpl.h"
#include "core/editing/markers/TextMatchMarker.h"
#include "core/editing/markers/TextMatchMarkerListImpl.h"
@@ -125,24 +127,16 @@ void DocumentMarkerController::Clear() {
void DocumentMarkerController::AddSpellingMarker(const EphemeralRange& range,
const String& description) {
- AddSpellCheckMarker(range, DocumentMarker::kSpelling, description);
+ AddMarkerInternal(range, [&description](int start_offset, int end_offset) {
+ return new SpellingMarker(start_offset, end_offset, description);
+ });
}
void DocumentMarkerController::AddGrammarMarker(const EphemeralRange& range,
const String& description) {
- AddSpellCheckMarker(range, DocumentMarker::kGrammar, description);
-}
-
-void DocumentMarkerController::AddSpellCheckMarker(
- const EphemeralRange& range,
- DocumentMarker::MarkerType type,
- const String& description) {
- DCHECK(type == DocumentMarker::kSpelling || type == DocumentMarker::kGrammar)
- << type;
- AddMarkerInternal(
- range, [type, &description](int start_offset, int end_offset) {
- return new DocumentMarker(type, start_offset, end_offset, description);
- });
+ AddMarkerInternal(range, [&description](int start_offset, int end_offset) {
+ return new GrammarMarker(start_offset, end_offset, description);
+ });
}
void DocumentMarkerController::AddTextMatchMarker(

Powered by Google App Engine
This is Rietveld 408576698