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

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

Issue 2780313002: [WIP] Refactor DocumentMarker (Closed)
Patch Set: Move accessor methods into derived classes 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..9c58d8f68325e7940349f484924c3df399a00396 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));
}
}
@@ -438,7 +439,10 @@ static String showMarkerHelper(const DocumentMarkerVector& markers) {
builder.append(":");
builder.appendNumber(marker->endOffset());
builder.append("](");
- builder.appendNumber(marker->activeMatch());
+ if (marker->type() == DocumentMarker::TextMatch)
+ builder.appendNumber(toTextMatchMarker(marker)->activeMatch());
+ else
+ builder.appendNumber(0);
builder.append(")");
}

Powered by Google App Engine
This is Rietveld 408576698