1 // Copyright (c) 2012 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 UI_BASE_IME_COMPOSITION_UNDERLINE_H_ 6 #define UI_BASE_IME_COMPOSITION_UNDERLINE_H_ 7 8 #include <vector> 9 10 #include "third_party/skia/include/core/SkColor.h" 11 12 namespace ui { 13 14 // Intentionally keep sync with blink::WebCompositionUnderline defined in: 15 // third_party/WebKit/public/web/WebCompositionUnderline.h 16 struct CompositionUnderline { 17 CompositionUnderline() 18 : start_offset(0), 19 end_offset(0), 20 color(0), 21 thick(false) {} 22 23 CompositionUnderline(unsigned s, unsigned e, SkColor c, bool t) 24 : start_offset(s), 25 end_offset(e), 26 color(c), 27 thick(t) {} 28 29 bool operator==(const CompositionUnderline& rhs) const { 30 return (this->start_offset == rhs.start_offset) && 31 (this->end_offset == rhs.end_offset) && 32 (this->color == rhs.color) && 33 (this->thick == rhs.thick); 34 } 35 36 bool operator!=(const CompositionUnderline& rhs) const { 37 return !(*this == rhs); 38 } 39 40 // Though use of unsigned is discouraged, we use it here to make sure it's 41 // identical to blink::WebCompositionUnderline. 42 unsigned start_offset; 43 unsigned end_offset; 44 SkColor color; 45 bool thick; 46 }; 47 48 typedef std::vector<CompositionUnderline> CompositionUnderlines; 49 50 } // namespace ui 51 52 #endif // UI_BASE_IME_COMPOSITION_UNDERLINE_H_ 53