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 0a18e679a2ef9dec68c4df711731bc60ec60f60a..3e7bcac2f401f353645d2d42515d1ecdc3ee9d81 100644 |
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp |
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp |
@@ -60,10 +60,29 @@ void DocumentMarkerController::clear() { |
m_compositions.clear(); |
} |
-void DocumentMarkerController::addMarker(const Position& start, |
- const Position& end, |
- DocumentMarker::MarkerType type, |
- const String& description) { |
+void DocumentMarkerController::addCompositionMarker(const Position& start, |
yosin_UTC9
2017/03/22 05:23:46
Please move addCompositionMarker() changes to anot
rlanday
2017/03/22 17:21:51
I was just re-ordering the methods to put them in
|
+ const Position& end, |
+ Color underlineColor, |
+ bool thick, |
+ Color backgroundColor) { |
+ DCHECK(!m_document->needsLayoutTreeUpdate()); |
+ |
+ for (TextIterator markedText(start, end); !markedText.atEnd(); |
+ markedText.advance()) { |
+ addMarker(markedText.currentContainer(), |
+ DocumentMarker::createCompositionMarker( |
+ markedText.startOffsetInCurrentContainer(), |
+ markedText.endOffsetInCurrentContainer(), underlineColor, |
+ thick, backgroundColor)); |
+ } |
+} |
+ |
+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); |
// Use a TextIterator to visit the potentially multiple nodes the range |
// covers. |
@@ -83,6 +102,18 @@ void DocumentMarkerController::addMarker(const Position& start, |
} |
} |
+void DocumentMarkerController::addGrammarMarker(const Position& start, |
+ const Position& end, |
+ const String& description) { |
+ addGrammarOrSpellingMarker(start, end, DocumentMarker::Grammar, description); |
+} |
+ |
+void DocumentMarkerController::addSpellingMarker(const Position& start, |
+ const Position& end, |
+ const String& description) { |
+ addGrammarOrSpellingMarker(start, end, DocumentMarker::Spelling, description); |
+} |
+ |
void DocumentMarkerController::addTextMatchMarker(const EphemeralRange& range, |
bool activeMatch) { |
DCHECK(!m_document->needsLayoutTreeUpdate()); |
@@ -100,23 +131,6 @@ void DocumentMarkerController::addTextMatchMarker(const EphemeralRange& range, |
// throttling algorithm. crbug.com/6819. |
} |
-void DocumentMarkerController::addCompositionMarker(const Position& start, |
Xiaocheng
2017/03/22 02:00:29
nit: Shouldn't move this function.
|
- const Position& end, |
- Color underlineColor, |
- bool thick, |
- Color backgroundColor) { |
- DCHECK(!m_document->needsLayoutTreeUpdate()); |
- |
- for (TextIterator markedText(start, end); !markedText.atEnd(); |
- markedText.advance()) { |
- addMarker(markedText.currentContainer(), |
- DocumentMarker::createCompositionMarker( |
- markedText.startOffsetInCurrentContainer(), |
- markedText.endOffsetInCurrentContainer(), underlineColor, |
- thick, backgroundColor)); |
- } |
-} |
- |
void DocumentMarkerController::prepareForDestruction() { |
clear(); |
} |