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_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_H_ |
6 #define UI_GFX_RENDER_TEXT_H_ | 6 #define UI_GFX_RENDER_TEXT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current, | 202 virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current, |
203 BreakType break_type); | 203 BreakType break_type); |
204 virtual SelectionModel GetRightSelectionModel(const SelectionModel& current, | 204 virtual SelectionModel GetRightSelectionModel(const SelectionModel& current, |
205 BreakType break_type); | 205 BreakType break_type); |
206 | 206 |
207 // Get the SelectionModels corresponding to visual text ends. | 207 // Get the SelectionModels corresponding to visual text ends. |
208 // The returned value represents a cursor/caret position without a selection. | 208 // The returned value represents a cursor/caret position without a selection. |
209 virtual SelectionModel LeftEndSelectionModel(); | 209 virtual SelectionModel LeftEndSelectionModel(); |
210 virtual SelectionModel RightEndSelectionModel(); | 210 virtual SelectionModel RightEndSelectionModel(); |
211 | 211 |
212 // Get the logical index of the grapheme preceeding the argument |position|. | 212 // Get the logical index of the grapheme preceding the argument |position|. |
213 virtual size_t GetIndexOfPreviousGrapheme(size_t position); | 213 virtual size_t GetIndexOfPreviousGrapheme(size_t position); |
214 | 214 |
215 // Get the visual bounds containing the logical substring within |from| to | 215 // Get the visual bounds containing the logical substring within |from| to |
216 // |to|. These bounds could be visually discontinuous if the substring is | 216 // |to|. These bounds could be visually discontinuous if the substring is |
217 // split by a LTR/RTL level change. These bounds are in local coordinates, but | 217 // split by a LTR/RTL level change. These bounds are in local coordinates, but |
218 // may be outside the visible region if the text is longer than the textfield. | 218 // may be outside the visible region if the text is longer than the textfield. |
219 // Subsequent text, cursor, or bounds changes may invalidate returned values. | 219 // Subsequent text, cursor, or bounds changes may invalidate returned values. |
220 // TODO(msw) Re-evaluate this function's necessity and signature. | 220 // TODO(msw) Re-evaluate this function's necessity and signature. |
221 virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to); | 221 virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to); |
222 | 222 |
223 // Return true if cursor can appear in front of the character at |position|, | 223 // Returns true if the cursor can appear at the specified location, which |
224 // which means it is a grapheme boundary or the first character in the text. | 224 // means it is a grapheme boundary or the first character in the text. If |
225 virtual bool IsCursorablePosition(size_t position) = 0; | 225 // |is_trailing| is false, the location specified is in front of the character |
226 // at index |position|, otherwise the location corresponds to the end of the | |
227 // character. | |
228 virtual bool IsCursorablePosition(size_t position, bool is_trailing) = 0; | |
msw
2011/11/29 20:42:00
Can this take a SelectionModel::CaretPlacement ins
| |
226 | 229 |
227 // Updates the layout so that the next draw request can correctly | 230 // Updates the layout so that the next draw request can correctly |
228 // render the text and its attributes. | 231 // render the text and its attributes. |
229 virtual void UpdateLayout() = 0; | 232 virtual void UpdateLayout() = 0; |
230 | 233 |
231 // Apply composition style (underline) to composition range and selection | 234 // Apply composition style (underline) to composition range and selection |
232 // style (foreground) to selection range. | 235 // style (foreground) to selection range. |
233 void ApplyCompositionAndSelectionStyles(StyleRanges* style_ranges) const; | 236 void ApplyCompositionAndSelectionStyles(StyleRanges* style_ranges) const; |
234 | 237 |
235 // Convert points from the text space to the view space and back. | 238 // Convert points from the text space to the view space and back. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 // The cached bounds and offset are invalidated by changes to the cursor, | 299 // The cached bounds and offset are invalidated by changes to the cursor, |
297 // selection, font, and other operations that adjust the visible text bounds. | 300 // selection, font, and other operations that adjust the visible text bounds. |
298 bool cached_bounds_and_offset_valid_; | 301 bool cached_bounds_and_offset_valid_; |
299 | 302 |
300 DISALLOW_COPY_AND_ASSIGN(RenderText); | 303 DISALLOW_COPY_AND_ASSIGN(RenderText); |
301 }; | 304 }; |
302 | 305 |
303 } // namespace gfx | 306 } // namespace gfx |
304 | 307 |
305 #endif // UI_GFX_RENDER_TEXT_H_ | 308 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |