1 // Copyright 2017 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_SUGGESTION_MARKER_PROPERTIES_H_ 6 #define THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_SUGGESTION_MARKER_PROPERTIES_H_ 7 8 #include "third_party/blink/renderer/core/core_export.h" 9 #include "third_party/blink/renderer/core/editing/markers/styleable_marker.h" 10 #include "third_party/blink/renderer/core/editing/markers/suggestion_marker.h" 11 12 using ui::mojom::ImeTextSpanThickness; 13 using ui::mojom::ImeTextSpanUnderlineStyle; 14 15 namespace blink { 16 17 // This class is used to pass parameters to 18 // |DocumentMarkerController::AddSuggestionMarker()|. 19 class CORE_EXPORT SuggestionMarkerProperties final { 20 STACK_ALLOCATED(); 21 22 public: 23 class CORE_EXPORT Builder; 24 25 SuggestionMarkerProperties(const SuggestionMarkerProperties&); 26 SuggestionMarkerProperties(); 27 Type()28 SuggestionMarker::SuggestionType Type() const { return type_; } RemoveOnFinishComposing()29 SuggestionMarker::RemoveOnFinishComposing RemoveOnFinishComposing() const { 30 return remove_on_finish_composing_; 31 } Suggestions()32 Vector<String> Suggestions() const { return suggestions_; } HighlightColor()33 Color HighlightColor() const { return highlight_color_; } UnderlineColor()34 Color UnderlineColor() const { return underline_color_; } BackgroundColor()35 Color BackgroundColor() const { return background_color_; } Thickness()36 ImeTextSpanThickness Thickness() const { return thickness_; } UnderlineStyle()37 ImeTextSpanUnderlineStyle UnderlineStyle() const { return underline_style_; } TextColor()38 Color TextColor() const { return text_color_; } 39 40 private: 41 SuggestionMarker::SuggestionType type_ = 42 SuggestionMarker::SuggestionType::kNotMisspelling; 43 SuggestionMarker::RemoveOnFinishComposing remove_on_finish_composing_ = 44 SuggestionMarker::RemoveOnFinishComposing::kDoNotRemove; 45 Vector<String> suggestions_; 46 Color highlight_color_ = Color::kTransparent; 47 Color underline_color_ = Color::kTransparent; 48 Color background_color_ = Color::kTransparent; 49 ImeTextSpanThickness thickness_ = ImeTextSpanThickness::kThin; 50 ImeTextSpanUnderlineStyle underline_style_ = 51 ImeTextSpanUnderlineStyle::kSolid; 52 Color text_color_ = Color::kTransparent; 53 }; 54 55 // This class is used for building SuggestionMarkerProperties objects. 56 class CORE_EXPORT SuggestionMarkerProperties::Builder final { 57 STACK_ALLOCATED(); 58 59 public: 60 explicit Builder(const SuggestionMarkerProperties&); 61 Builder(); 62 63 SuggestionMarkerProperties Build() const; 64 65 Builder& SetType(SuggestionMarker::SuggestionType); 66 Builder& SetRemoveOnFinishComposing(bool); 67 Builder& SetSuggestions(const Vector<String>& suggestions); 68 Builder& SetHighlightColor(Color); 69 Builder& SetUnderlineColor(Color); 70 Builder& SetBackgroundColor(Color); 71 Builder& SetThickness(ImeTextSpanThickness); 72 Builder& SetUnderlineStyle(ImeTextSpanUnderlineStyle); 73 Builder& SetTextColor(Color); 74 75 private: 76 SuggestionMarkerProperties data_; 77 78 DISALLOW_COPY_AND_ASSIGN(Builder); 79 }; 80 81 } // namespace blink 82 83 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_EDITING_MARKERS_SUGGESTION_MARKER_PROPERTIES_H_ 84