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)); |
} |
} |