Chromium Code Reviews| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // If |select| is false, the selection start is moved to the same position. |
| 332 void MoveCursor(BreakType break_type, | 332 // |select_behavior| specifies the selection behavior in case the selection |
| 333 VisualCursorDirection direction, | 333 // direction is reversed. |
| 334 bool select); | 334 void MoveCursor( |
| 335 BreakType break_type, | |
| 336 VisualCursorDirection direction, | |
| 337 bool select, | |
| 338 SelectionReversedBehavior select_behavior = SELECTION_DEFAULT); | |
|
tapted
2016/08/11 03:44:07
This isn't a good use of default arguments - if |s
karandeepb
2016/08/16 10:24:51
Acknowledged, removed the use of default args.
| |
| 335 | 339 |
| 336 // Set the selection_model_ to the value of |selection|. | 340 // Set the selection_model_ to the value of |selection|. |
| 337 // The selection range is clamped to text().length() if out of range. | 341 // The selection range is clamped to text().length() if out of range. |
| 338 // Returns true if the cursor position or selection range changed. | 342 // 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 | 343 // 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. | 344 // grapheme boundary), it is a no-op and returns false. |
| 341 bool MoveCursorTo(const SelectionModel& selection_model); | 345 bool MoveCursorTo(const SelectionModel& selection_model); |
| 342 | 346 |
| 343 // Set the selection_model_ based on |range|. | 347 // Set the selection_model_ based on |range|. |
| 344 // If the |range| start or end is greater than text length, it is modified | 348 // 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 | 853 // Lines computed by EnsureLayout. These should be invalidated upon |
| 850 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 854 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
| 851 std::vector<internal::Line> lines_; | 855 std::vector<internal::Line> lines_; |
| 852 | 856 |
| 853 DISALLOW_COPY_AND_ASSIGN(RenderText); | 857 DISALLOW_COPY_AND_ASSIGN(RenderText); |
| 854 }; | 858 }; |
| 855 | 859 |
| 856 } // namespace gfx | 860 } // namespace gfx |
| 857 | 861 |
| 858 #endif // UI_GFX_RENDER_TEXT_H_ | 862 #endif // UI_GFX_RENDER_TEXT_H_ |
| OLD | NEW |