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, |