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

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

Issue 2780313002: [WIP] Refactor DocumentMarker (Closed)
Patch Set: Move CompositionMarkerList::at() into this CL 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 aab6aebd02efde231634dc324bff117ad697d85d..4d74ac886e419d8dddf290df278481316084ceac 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -34,9 +34,11 @@
#include "core/dom/Range.h"
#include "core/dom/Text.h"
#include "core/editing/iterators/TextIterator.h"
+#include "core/editing/markers/CompositionMarker.h"
#include "core/editing/markers/CompositionMarkerList.h"
#include "core/editing/markers/DocumentMarkerList.h"
#include "core/editing/markers/EditingMarkerList.h"
+#include "core/editing/markers/SpellCheckMarker.h"
#include "core/editing/markers/SpellCheckMarkerList.h"
#include "core/editing/markers/TextMatchMarkerList.h"
#include "core/frame/FrameView.h"
@@ -64,13 +66,12 @@ void DocumentMarkerController::addMarker(const Position& start,
const Position& end,
DocumentMarker::MarkerType type,
const String& description) {
- DCHECK(type != DocumentMarker::TextMatch);
// Use a TextIterator to visit the potentially multiple nodes the range
// covers.
for (TextIterator markedText(start, end); !markedText.atEnd();
markedText.advance()) {
addMarker(markedText.currentContainer(),
- new DocumentMarker(
+ new SpellCheckMarker(
type, markedText.startOffsetInCurrentContainer(),
markedText.endOffsetInCurrentContainer(), description));
}
@@ -103,9 +104,9 @@ void DocumentMarkerController::addCompositionMarker(const Position& start,
for (TextIterator markedText(start, end); !markedText.atEnd();
markedText.advance()) {
addMarker(markedText.currentContainer(),
- new DocumentMarker(markedText.startOffsetInCurrentContainer(),
- markedText.endOffsetInCurrentContainer(),
- underlineColor, thick, backgroundColor));
+ new CompositionMarker(markedText.startOffsetInCurrentContainer(),
+ markedText.endOffsetInCurrentContainer(),
+ underlineColor, thick, backgroundColor));
}
}

Powered by Google App Engine
This is Rietveld 408576698