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