Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(507)

Side by Side Diff: ui/base/ime/composition_underline.h

Issue 313053007: Passing BackgroundColorSpan and UnderlineSpan from Clank to Blink. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/basictypes.h"
10 #include "third_party/skia/include/core/SkColor.h" 11 #include "third_party/skia/include/core/SkColor.h"
11 12
12 namespace ui { 13 namespace ui {
13 14
14 // Intentionally keep sync with blink::WebCompositionUnderline defined in: 15 // Intentionally keep sync with blink::WebCompositionUnderline defined in:
15 // third_party/WebKit/public/web/WebCompositionUnderline.h 16 // third_party/WebKit/public/web/WebCompositionUnderline.h
16 struct CompositionUnderline { 17 struct CompositionUnderline {
17 CompositionUnderline() 18 CompositionUnderline()
18 : start_offset(0), 19 : start_offset(0),
19 end_offset(0), 20 end_offset(0),
20 color(0), 21 color(SK_ColorTRANSPARENT),
21 thick(false) {} 22 thick(false),
23 background_color(SK_ColorTRANSPARENT) {}
22 24
23 CompositionUnderline(unsigned s, unsigned e, SkColor c, bool t) 25 // TODO(huangs): remove this constructor.
24 : start_offset(s), 26 CompositionUnderline(uint32 s, uint32 e, SkColor c, bool t)
Seigo Nonaka 2014/06/20 06:39:13 nit: Can we put only background color for composit
huangs 2014/06/20 14:28:25 Filed issue: http://crbug.com/387032 A more ambit
25 end_offset(e), 27 : start_offset(s),
26 color(c), 28 end_offset(e),
27 thick(t) {} 29 color(c),
30 thick(t),
31 background_color(SK_ColorTRANSPARENT) {}
32
33 CompositionUnderline(uint32 s, uint32 e, SkColor c, bool t, SkColor bc)
34 : start_offset(s),
35 end_offset(e),
36 color(c),
37 thick(t),
38 background_color(bc) {}
28 39
29 bool operator==(const CompositionUnderline& rhs) const { 40 bool operator==(const CompositionUnderline& rhs) const {
30 return (this->start_offset == rhs.start_offset) && 41 return (this->start_offset == rhs.start_offset) &&
31 (this->end_offset == rhs.end_offset) && 42 (this->end_offset == rhs.end_offset) && (this->color == rhs.color) &&
32 (this->color == rhs.color) && 43 (this->thick == rhs.thick) &&
33 (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 uint32 start_offset;
41 // identical to blink::WebCompositionUnderline. 52 uint32 end_offset;
42 unsigned start_offset;
43 unsigned end_offset;
44 SkColor color; 53 SkColor color;
45 bool thick; 54 bool thick;
55 SkColor background_color;
46 }; 56 };
47 57
48 typedef std::vector<CompositionUnderline> CompositionUnderlines; 58 typedef std::vector<CompositionUnderline> CompositionUnderlines;
49 59
50 } // namespace ui 60 } // namespace ui
51 61
52 #endif // UI_BASE_IME_COMPOSITION_UNDERLINE_H_ 62 #endif // UI_BASE_IME_COMPOSITION_UNDERLINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698