OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 CompositionMarker_h | 5 #ifndef CompositionMarker_h |
6 #define CompositionMarker_h | 6 #define CompositionMarker_h |
7 | 7 |
8 #include "core/editing/markers/DocumentMarker.h" | 8 #include "core/editing/markers/DocumentMarker.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 // A subclass of DocumentMarker used to store information specific to | 12 // A subclass of DocumentMarker used to store information specific to |
13 // composition markers. We store what color to display the underline (possibly | 13 // composition markers. We store what color to display the underline (possibly |
14 // transparent), whether the underline should be thick or not, and what | 14 // transparent), whether the underline should be thick or not, and what |
15 // background color should be used under the marked text (also possibly | 15 // background color should be used under the marked text (also possibly |
16 // transparent). | 16 // transparent). |
17 class CORE_EXPORT CompositionMarker final : public DocumentMarker { | 17 class CORE_EXPORT CompositionMarker final : public DocumentMarker { |
18 public: | 18 public: |
19 CompositionMarker(unsigned start_offset, | 19 CompositionMarker(unsigned start_offset, |
20 unsigned end_offset, | 20 unsigned end_offset, |
21 Color underline_color, | 21 Color underline_color, |
22 bool thick, | 22 bool thick, |
23 Color background_color); | 23 Color background_color); |
24 | 24 |
| 25 // DocumentMarker implementations |
| 26 MarkerType GetType() const final; |
| 27 |
| 28 // CompositionMarker-specific |
25 Color UnderlineColor() const; | 29 Color UnderlineColor() const; |
26 bool Thick() const; | 30 bool Thick() const; |
27 Color BackgroundColor() const; | 31 Color BackgroundColor() const; |
28 | 32 |
29 private: | 33 private: |
30 const Color underline_color_; | 34 const Color underline_color_; |
31 const Color background_color_; | 35 const Color background_color_; |
32 const bool thick_; | 36 const bool thick_; |
33 | 37 |
34 DISALLOW_COPY_AND_ASSIGN(CompositionMarker); | 38 DISALLOW_COPY_AND_ASSIGN(CompositionMarker); |
35 }; | 39 }; |
36 | 40 |
37 DEFINE_TYPE_CASTS(CompositionMarker, | 41 DEFINE_TYPE_CASTS(CompositionMarker, |
38 DocumentMarker, | 42 DocumentMarker, |
39 marker, | 43 marker, |
40 marker->GetType() == DocumentMarker::kComposition, | 44 marker->GetType() == DocumentMarker::kComposition, |
41 marker.GetType() == DocumentMarker::kComposition); | 45 marker.GetType() == DocumentMarker::kComposition); |
42 | 46 |
43 } // namespace blink | 47 } // namespace blink |
44 | 48 |
45 #endif | 49 #endif |
OLD | NEW |