OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GFX_RENDER_TEXT_LINUX_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_LINUX_H_ |
6 #define UI_GFX_RENDER_TEXT_LINUX_H_ | 6 #define UI_GFX_RENDER_TEXT_LINUX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <pango/pango.h> | 9 #include <pango/pango.h> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 virtual void SetDisplayRect(const Rect&r) OVERRIDE; | 23 virtual void SetDisplayRect(const Rect&r) OVERRIDE; |
24 virtual void SetCompositionRange(const ui::Range& composition_range) OVERRIDE; | 24 virtual void SetCompositionRange(const ui::Range& composition_range) OVERRIDE; |
25 virtual void ApplyStyleRange(StyleRange style_range) OVERRIDE; | 25 virtual void ApplyStyleRange(StyleRange style_range) OVERRIDE; |
26 virtual void ApplyDefaultStyle() OVERRIDE; | 26 virtual void ApplyDefaultStyle() OVERRIDE; |
27 virtual base::i18n::TextDirection GetTextDirection() OVERRIDE; | 27 virtual base::i18n::TextDirection GetTextDirection() OVERRIDE; |
28 virtual int GetStringWidth() OVERRIDE; | 28 virtual int GetStringWidth() OVERRIDE; |
29 virtual void Draw(Canvas* canvas) OVERRIDE; | 29 virtual void Draw(Canvas* canvas) OVERRIDE; |
30 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; | 30 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; |
31 virtual Rect GetCursorBounds(const SelectionModel& position, | 31 virtual Rect GetCursorBounds(const SelectionModel& position, |
32 bool insert_mode) OVERRIDE; | 32 bool insert_mode) OVERRIDE; |
| 33 virtual size_t GetIndexOfNextGrapheme(size_t position) OVERRIDE; |
| 34 |
33 | 35 |
34 protected: | 36 protected: |
35 // Overridden from RenderText: | 37 // Overridden from RenderText: |
36 virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current, | 38 virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current, |
37 BreakType break_type) OVERRIDE; | 39 BreakType break_type) OVERRIDE; |
38 virtual SelectionModel GetRightSelectionModel(const SelectionModel& current, | 40 virtual SelectionModel GetRightSelectionModel(const SelectionModel& current, |
39 BreakType break_type) OVERRIDE; | 41 BreakType break_type) OVERRIDE; |
40 virtual SelectionModel LeftEndSelectionModel() OVERRIDE; | 42 virtual SelectionModel LeftEndSelectionModel() OVERRIDE; |
41 virtual SelectionModel RightEndSelectionModel() OVERRIDE; | 43 virtual SelectionModel RightEndSelectionModel() OVERRIDE; |
42 virtual size_t GetIndexOfPreviousGrapheme(size_t position) OVERRIDE; | 44 virtual size_t GetIndexOfPreviousGrapheme(size_t position) OVERRIDE; |
| 45 virtual bool IsCursorablePosition(size_t position) OVERRIDE; |
43 | 46 |
44 private: | 47 private: |
45 enum RelativeLogicalPosition { | 48 enum RelativeLogicalPosition { |
46 PREVIOUS, | 49 PREVIOUS, |
47 NEXT | 50 NEXT |
48 }; | 51 }; |
49 | 52 |
50 // Get the logical start index of the next grapheme after |position|. | |
51 size_t GetIndexOfNextGrapheme(size_t position); | |
52 | |
53 // Returns the run that contains |position|. Return NULL if not found. | 53 // Returns the run that contains |position|. Return NULL if not found. |
54 GSList* GetRunContainingPosition(size_t position) const; | 54 GSList* GetRunContainingPosition(size_t position) const; |
55 | 55 |
56 // Given |utf8_index_of_current_grapheme|, returns the UTF8 or UTF16 index of | 56 // Given |utf8_index_of_current_grapheme|, returns the UTF8 or UTF16 index of |
57 // next grapheme in the text if |pos| is NEXT, otherwise, returns the index of | 57 // next grapheme in the text if |pos| is NEXT, otherwise, returns the index of |
58 // previous grapheme. Returns 0 if there is no previous grapheme, and returns | 58 // previous grapheme. Returns 0 if there is no previous grapheme, and returns |
59 // the |text_| length if there is no next grapheme. | 59 // the |text_| length if there is no next grapheme. |
60 size_t Utf8IndexOfAdjacentGrapheme(size_t utf8_index_of_current_grapheme, | 60 size_t Utf8IndexOfAdjacentGrapheme(size_t utf8_index_of_current_grapheme, |
61 RelativeLogicalPosition pos) const; | 61 RelativeLogicalPosition pos) const; |
62 size_t Utf16IndexOfAdjacentGrapheme(size_t utf8_index_of_current_grapheme, | 62 size_t Utf16IndexOfAdjacentGrapheme(size_t utf8_index_of_current_grapheme, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 const char* layout_text_; | 115 const char* layout_text_; |
116 // The text length. | 116 // The text length. |
117 size_t layout_text_len_; | 117 size_t layout_text_len_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(RenderTextLinux); | 119 DISALLOW_COPY_AND_ASSIGN(RenderTextLinux); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace gfx; | 122 } // namespace gfx; |
123 | 123 |
124 #endif // UI_GFX_RENDER_TEXT_LINUX_H_ | 124 #endif // UI_GFX_RENDER_TEXT_LINUX_H_ |
OLD | NEW |