OLD | NEW |
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_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 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 const SelectionModel& selection_model() const { return selection_model_; } | 322 const SelectionModel& selection_model() const { return selection_model_; } |
323 | 323 |
324 const Range& selection() const { return selection_model_.selection(); } | 324 const Range& selection() const { return selection_model_.selection(); } |
325 | 325 |
326 size_t cursor_position() const { return selection_model_.caret_pos(); } | 326 size_t cursor_position() const { return selection_model_.caret_pos(); } |
327 void SetCursorPosition(size_t position); | 327 void SetCursorPosition(size_t position); |
328 | 328 |
329 // Moves the cursor left or right. Cursor movement is visual, meaning that | 329 // Moves the cursor left or right. Cursor movement is visual, meaning that |
330 // left and right are relative to screen, not the directionality of the text. | 330 // left and right are relative to screen, not the directionality of the text. |
331 // If |select| is false, the selection start is moved to the same position. | 331 // |selection_behavior| determines whether a selection is to be made and it's |
| 332 // behavior. |
332 void MoveCursor(BreakType break_type, | 333 void MoveCursor(BreakType break_type, |
333 VisualCursorDirection direction, | 334 VisualCursorDirection direction, |
334 bool select); | 335 SelectionBehavior selection_behavior); |
335 | 336 |
336 // Set the selection_model_ to the value of |selection|. | 337 // Set the selection_model_ to the value of |selection|. |
337 // The selection range is clamped to text().length() if out of range. | 338 // The selection range is clamped to text().length() if out of range. |
338 // Returns true if the cursor position or selection range changed. | 339 // Returns true if the cursor position or selection range changed. |
339 // If any index in |selection_model| is not a cursorable position (not on a | 340 // If any index in |selection_model| is not a cursorable position (not on a |
340 // grapheme boundary), it is a no-op and returns false. | 341 // grapheme boundary), it is a no-op and returns false. |
341 bool MoveCursorTo(const SelectionModel& selection_model); | 342 bool MoveCursorTo(const SelectionModel& selection_model); |
342 | 343 |
343 // Set the selection_model_ based on |range|. | 344 // Set the selection_model_ based on |range|. |
344 // If the |range| start or end is greater than text length, it is modified | 345 // If the |range| start or end is greater than text length, it is modified |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 // Lines computed by EnsureLayout. These should be invalidated upon | 850 // Lines computed by EnsureLayout. These should be invalidated upon |
850 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 851 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
851 std::vector<internal::Line> lines_; | 852 std::vector<internal::Line> lines_; |
852 | 853 |
853 DISALLOW_COPY_AND_ASSIGN(RenderText); | 854 DISALLOW_COPY_AND_ASSIGN(RenderText); |
854 }; | 855 }; |
855 | 856 |
856 } // namespace gfx | 857 } // namespace gfx |
857 | 858 |
858 #endif // UI_GFX_RENDER_TEXT_H_ | 859 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |