Chromium Code Reviews| 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 blink::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 background_color(0) {} | |
| 22 | 23 |
| 24 // TODO(huangs): remove this constructor. | |
| 23 CompositionUnderline(unsigned s, unsigned e, SkColor c, bool t) | 25 CompositionUnderline(unsigned s, unsigned e, SkColor c, bool t) |
| 24 : start_offset(s), | 26 : start_offset(s), |
| 25 end_offset(e), | 27 end_offset(e), |
| 26 color(c), | 28 color(c), |
| 27 thick(t) {} | 29 thick(t), |
| 30 background_color(0) {} | |
| 31 | |
| 32 CompositionUnderline(unsigned s, unsigned e, SkColor c, bool t, SkColor bc) | |
|
palmer
2014/06/10 20:32:23
Ahh, I see. Since these values cross the native/Ja
huangs
2014/06/11 02:41:01
Please note the comment below in line 51 stating w
| |
| 33 : start_offset(s), | |
| 34 end_offset(e), | |
| 35 color(c), | |
| 36 thick(t), | |
| 37 background_color(bc) {} | |
| 28 | 38 |
| 29 bool operator==(const CompositionUnderline& rhs) const { | 39 bool operator==(const CompositionUnderline& rhs) const { |
| 30 return (this->start_offset == rhs.start_offset) && | 40 return (this->start_offset == rhs.start_offset) && |
| 31 (this->end_offset == rhs.end_offset) && | 41 (this->end_offset == rhs.end_offset) && |
| 32 (this->color == rhs.color) && | 42 (this->color == rhs.color) && |
| 33 (this->thick == rhs.thick); | 43 (this->thick == rhs.thick) && |
| 44 (this->background_color == rhs.background_color); | |
| 34 } | 45 } |
| 35 | 46 |
| 36 bool operator!=(const CompositionUnderline& rhs) const { | 47 bool operator!=(const CompositionUnderline& rhs) const { |
| 37 return !(*this == rhs); | 48 return !(*this == rhs); |
| 38 } | 49 } |
| 39 | 50 |
| 40 // Though use of unsigned is discouraged, we use it here to make sure it's | 51 // Though use of unsigned is discouraged, we use it here to make sure it's |
| 41 // identical to blink::WebCompositionUnderline. | 52 // identical to blink::WebCompositionUnderline. |
| 42 unsigned start_offset; | 53 unsigned start_offset; |
| 43 unsigned end_offset; | 54 unsigned end_offset; |
| 44 SkColor color; | 55 SkColor color; |
| 45 bool thick; | 56 bool thick; |
| 57 SkColor background_color; | |
| 46 }; | 58 }; |
| 47 | 59 |
| 48 typedef std::vector<CompositionUnderline> CompositionUnderlines; | 60 typedef std::vector<CompositionUnderline> CompositionUnderlines; |
| 49 | 61 |
| 50 } // namespace ui | 62 } // namespace ui |
| 51 | 63 |
| 52 #endif // UI_BASE_IME_COMPOSITION_UNDERLINE_H_ | 64 #endif // UI_BASE_IME_COMPOSITION_UNDERLINE_H_ |
| OLD | NEW |