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

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

Issue 2765133002: [WIP] Add DocumentMarkerController::addGrammarMarker() and addSpellingMarker() (Closed)
Patch Set: Respond to comments 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/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 9c58d8f68325e7940349f484924c3df399a00396..c4ac4a97857c7bbaf3599d5e99d55040bf1bce74 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -62,10 +62,14 @@ void DocumentMarkerController::clear() {
}
}
-void DocumentMarkerController::addMarker(const Position& start,
- const Position& end,
- DocumentMarker::MarkerType type,
- const String& description) {
+void DocumentMarkerController::addGrammarOrSpellingMarker(
+ const Position& start,
+ const Position& end,
+ DocumentMarker::MarkerType type,
+ const String& description) {
+ DCHECK(!m_document->needsLayoutTreeUpdate());
+ DCHECK(type == DocumentMarker::Grammar || type == DocumentMarker::Spelling)
+ << type;
// Use a TextIterator to visit the potentially multiple nodes the range
// covers.
for (TextIterator markedText(start, end); !markedText.atEnd();
@@ -77,6 +81,18 @@ void DocumentMarkerController::addMarker(const Position& start,
}
}
+void DocumentMarkerController::addSpellingMarker(const Position& start,
+ const Position& end,
+ const String& description) {
+ addGrammarOrSpellingMarker(start, end, DocumentMarker::Spelling, description);
+}
+
+void DocumentMarkerController::addGrammarMarker(const Position& start,
+ const Position& end,
+ const String& description) {
+ addGrammarOrSpellingMarker(start, end, DocumentMarker::Grammar, description);
+}
+
void DocumentMarkerController::addTextMatchMarker(const EphemeralRange& range,
bool activeMatch) {
DCHECK(!m_document->needsLayoutTreeUpdate());

Powered by Google App Engine
This is Rietveld 408576698