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

Unified Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2925543003: [ActiveSuggestionMarker #3] Add painting for ActiveSuggestionMarker (Closed)
Patch Set: marker_with_formatting => styleable_marker 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/testing/Internals.cpp
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index 09a4bf4b057ed23401a0145753c90f9aafecd161..3ec3d22c983d4be4cb756af03edc6639a5432318 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -1070,11 +1070,17 @@ static WTF::Optional<StyleableMarker::Thickness> ThicknessFrom(
return WTF::nullopt;
}
-void Internals::addCompositionMarker(const Range* range,
- const String& underline_color_value,
- const String& thickness_value,
- const String& background_color_value,
- ExceptionState& exception_state) {
+namespace {
+
+void addStyleableMarkerHelper(
+ const Range* range,
+ const String& underline_color_value,
+ const String& thickness_value,
+ const String& background_color_value,
+ ExceptionState& exception_state,
+ std::function<
+ void(const EphemeralRange&, Color, StyleableMarker::Thickness, Color)>
+ create_marker) {
DCHECK(range);
range->OwnerDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
@@ -1093,12 +1099,49 @@ void Internals::addCompositionMarker(const Range* range,
"Invalid underline color.") &&
ParseColor(background_color_value, background_color, exception_state,
"Invalid background color.")) {
- range->OwnerDocument().Markers().AddCompositionMarker(
- EphemeralRange(range), underline_color, thickness.value(),
- background_color);
+ create_marker(EphemeralRange(range), underline_color, thickness.value(),
+ background_color);
}
}
+} // namespace
+
+void Internals::addCompositionMarker(const Range* range,
+ const String& underline_color_value,
+ const String& thickness_value,
+ const String& background_color_value,
+ ExceptionState& exception_state) {
+ DocumentMarkerController& document_marker_controller =
+ range->OwnerDocument().Markers();
+ addStyleableMarkerHelper(
+ range, underline_color_value, thickness_value, background_color_value,
+ exception_state,
+ [&document_marker_controller](
+ const EphemeralRange& range, Color underline_color,
+ StyleableMarker::Thickness thickness, Color background_color) {
+ document_marker_controller.AddCompositionMarker(
+ range, underline_color, thickness, background_color);
+ });
+}
+
+void Internals::addActiveSuggestionMarker(const Range* range,
+ const String& underline_color_value,
+ const String& thickness_value,
+ const String& background_color_value,
+ ExceptionState& exception_state) {
+ DocumentMarkerController& document_marker_controller =
+ range->OwnerDocument().Markers();
+ addStyleableMarkerHelper(
+ range, underline_color_value, thickness_value, background_color_value,
+ exception_state,
+ [&document_marker_controller](
+ const EphemeralRange& range, Color underline_color,
+ StyleableMarker::Thickness thickness, Color background_color) {
+ document_marker_controller.AddActiveSuggestionMarker(
+ range, underline_color, thickness, background_color);
+ });
+}
+
void Internals::setTextMatchMarkersActive(Node* node,
unsigned start_offset,
unsigned end_offset,
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.h ('k') | third_party/WebKit/Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698