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_WIN_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_WIN_H_ |
6 #define UI_GFX_RENDER_TEXT_WIN_H_ | 6 #define UI_GFX_RENDER_TEXT_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <usp10.h> | 9 #include <usp10.h> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 bool insert_mode) OVERRIDE; | 65 bool insert_mode) OVERRIDE; |
66 | 66 |
67 protected: | 67 protected: |
68 // Overridden from RenderText: | 68 // Overridden from RenderText: |
69 virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current, | 69 virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current, |
70 BreakType break_type) OVERRIDE; | 70 BreakType break_type) OVERRIDE; |
71 virtual SelectionModel GetRightSelectionModel(const SelectionModel& current, | 71 virtual SelectionModel GetRightSelectionModel(const SelectionModel& current, |
72 BreakType break_type) OVERRIDE; | 72 BreakType break_type) OVERRIDE; |
73 virtual SelectionModel LeftEndSelectionModel() OVERRIDE; | 73 virtual SelectionModel LeftEndSelectionModel() OVERRIDE; |
74 virtual SelectionModel RightEndSelectionModel() OVERRIDE; | 74 virtual SelectionModel RightEndSelectionModel() OVERRIDE; |
75 virtual size_t GetIndexOfPreviousGrapheme(size_t position) OVERRIDE; | |
76 virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to) OVERRIDE; | 75 virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to) OVERRIDE; |
| 76 virtual bool IsCursorablePosition(size_t position) OVERRIDE; |
77 | 77 |
78 private: | 78 private: |
| 79 virtual size_t IndexOfAdjacentGrapheme(size_t index, bool next) OVERRIDE; |
| 80 |
79 void ItemizeLogicalText(); | 81 void ItemizeLogicalText(); |
80 void LayoutVisualText(HDC hdc); | 82 void LayoutVisualText(HDC hdc); |
81 | 83 |
82 // Return the run index that contains the argument; or the length of the | 84 // Return the run index that contains the argument; or the length of the |
83 // |runs_| vector if argument exceeds the text length or width. | 85 // |runs_| vector if argument exceeds the text length or width. |
84 size_t GetRunContainingPosition(size_t position) const; | 86 size_t GetRunContainingPosition(size_t position) const; |
85 size_t GetRunContainingPoint(const Point& point) const; | 87 size_t GetRunContainingPoint(const Point& point) const; |
86 | 88 |
87 // Return an index belonging to the |next| or previous logical grapheme. | |
88 // The return value is bounded by 0 and the text length, inclusive. | |
89 size_t IndexOfAdjacentGrapheme(size_t index, bool next) const; | |
90 | |
91 // Given a |run|, returns the SelectionModel that contains the logical first | 89 // Given a |run|, returns the SelectionModel that contains the logical first |
92 // or last caret position inside (not at a boundary of) the run. | 90 // or last caret position inside (not at a boundary of) the run. |
93 // The returned value represents a cursor/caret position without a selection. | 91 // The returned value represents a cursor/caret position without a selection. |
94 SelectionModel FirstSelectionModelInsideRun(internal::TextRun*) const; | 92 SelectionModel FirstSelectionModelInsideRun(internal::TextRun*); |
95 SelectionModel LastSelectionModelInsideRun(internal::TextRun*) const; | 93 SelectionModel LastSelectionModelInsideRun(internal::TextRun*); |
96 | 94 |
97 // Get the selection model visually left/right of |selection| by one grapheme. | 95 // Get the selection model visually left/right of |selection| by one grapheme. |
98 // The returned value represents a cursor/caret position without a selection. | 96 // The returned value represents a cursor/caret position without a selection. |
99 SelectionModel LeftSelectionModel(const SelectionModel& selection); | 97 SelectionModel LeftSelectionModel(const SelectionModel& selection); |
100 SelectionModel RightSelectionModel(const SelectionModel& selection); | 98 SelectionModel RightSelectionModel(const SelectionModel& selection); |
101 | 99 |
102 // Draw the text, cursor, and selection. | 100 // Draw the text, cursor, and selection. |
103 void DrawSelection(Canvas* canvas); | 101 void DrawSelection(Canvas* canvas); |
104 void DrawVisualText(Canvas* canvas); | 102 void DrawVisualText(Canvas* canvas); |
105 void DrawCursor(Canvas* canvas); | 103 void DrawCursor(Canvas* canvas); |
(...skipping 14 matching lines...) Expand all Loading... |
120 | 118 |
121 scoped_array<int> visual_to_logical_; | 119 scoped_array<int> visual_to_logical_; |
122 scoped_array<int> logical_to_visual_; | 120 scoped_array<int> logical_to_visual_; |
123 | 121 |
124 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); | 122 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); |
125 }; | 123 }; |
126 | 124 |
127 } // namespace gfx; | 125 } // namespace gfx; |
128 | 126 |
129 #endif // UI_GFX_RENDER_TEXT_WIN_H_ | 127 #endif // UI_GFX_RENDER_TEXT_WIN_H_ |
OLD | NEW |