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

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

Issue 2923033002: [ActiveSuggestionMarker #2] Add ActiveSuggestionMarker (Closed)
Patch Set: Update comment on ActiveSuggestionMarker.h Created 3 years, 6 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 5295203b934ae952c4f4068af6a611bf04dc981f..a9309fae840172d93c5b50057c0fa4918ed1b977 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.cpp
@@ -34,6 +34,8 @@
#include "core/dom/Text.h"
#include "core/editing/VisibleUnits.h"
#include "core/editing/iterators/TextIterator.h"
+#include "core/editing/markers/ActiveSuggestionMarker.h"
+#include "core/editing/markers/ActiveSuggestionMarkerListImpl.h"
#include "core/editing/markers/CompositionMarker.h"
#include "core/editing/markers/CompositionMarkerListImpl.h"
#include "core/editing/markers/DocumentMarkerListEditor.h"
@@ -65,6 +67,8 @@ DocumentMarker::MarkerTypeIndex MarkerTypeToMarkerIndex(
return DocumentMarker::kTextMatchMarkerIndex;
case DocumentMarker::kComposition:
return DocumentMarker::kCompositionMarkerIndex;
+ case DocumentMarker::kActiveSuggestion:
+ return DocumentMarker::kActiveSuggestionMarkerIndex;
}
NOTREACHED();
@@ -73,6 +77,8 @@ DocumentMarker::MarkerTypeIndex MarkerTypeToMarkerIndex(
DocumentMarkerList* CreateListForType(DocumentMarker::MarkerType type) {
switch (type) {
+ case DocumentMarker::kActiveSuggestion:
+ return new ActiveSuggestionMarkerListImpl();
case DocumentMarker::kComposition:
return new CompositionMarkerListImpl();
case DocumentMarker::kSpelling:
@@ -163,6 +169,19 @@ void DocumentMarkerController::AddCompositionMarker(
});
}
+void DocumentMarkerController::AddActiveSuggestionMarker(
+ const EphemeralRange& range,
+ Color underline_color,
+ StyleableMarker::Thickness thickness,
+ Color background_color) {
+ DCHECK(!document_->NeedsLayoutTreeUpdate());
+ AddMarkerInternal(range, [underline_color, thickness, background_color](
+ int start_offset, int end_offset) {
+ return new ActiveSuggestionMarker(start_offset, end_offset, underline_color,
+ thickness, background_color);
+ });
+}
+
void DocumentMarkerController::PrepareForDestruction() {
Clear();
}

Powered by Google App Engine
This is Rietveld 408576698