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

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: Remove declaration for DocumentMarker constructor being removed 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 c8f0d962b07b9a1e2408e4aab00afc5f2b6efd16..623ef0d5873c054f0dc9e0904dcaf305719a90ec 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"
@@ -126,30 +128,28 @@ void DocumentMarkerController::Clear() {
void DocumentMarkerController::AddSpellingMarker(const Position& start,
const Position& end,
const String& description) {
- AddSpellCheckMarker(start, end, DocumentMarker::kSpelling, description);
+ // Use a TextIterator to visit the potentially multiple nodes the range
+ // covers.
+ for (TextIterator marked_text(start, end); !marked_text.AtEnd();
+ marked_text.Advance()) {
+ AddMarker(marked_text.CurrentContainer(),
+ new SpellingMarker(marked_text.StartOffsetInCurrentContainer(),
+ marked_text.EndOffsetInCurrentContainer(),
+ description));
+ }
}
void DocumentMarkerController::AddGrammarMarker(const Position& start,
const Position& end,
const String& description) {
- AddSpellCheckMarker(start, end, DocumentMarker::kGrammar, description);
-}
-
-void DocumentMarkerController::AddSpellCheckMarker(
- const Position& start,
- const Position& end,
- DocumentMarker::MarkerType type,
- const String& description) {
- DCHECK(type == DocumentMarker::kSpelling || type == DocumentMarker::kGrammar)
- << type;
// Use a TextIterator to visit the potentially multiple nodes the range
// covers.
for (TextIterator marked_text(start, end); !marked_text.AtEnd();
marked_text.Advance()) {
AddMarker(marked_text.CurrentContainer(),
- new DocumentMarker(
- type, marked_text.StartOffsetInCurrentContainer(),
- marked_text.EndOffsetInCurrentContainer(), description));
+ new GrammarMarker(marked_text.StartOffsetInCurrentContainer(),
+ marked_text.EndOffsetInCurrentContainer(),
+ description));
}
}

Powered by Google App Engine
This is Rietveld 408576698