| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 VisualCursorDirection direction, | 334 VisualCursorDirection direction, |
| 335 SelectionBehavior selection_behavior); | 335 SelectionBehavior selection_behavior); |
| 336 | 336 |
| 337 // Set the selection_model_ to the value of |selection|. | 337 // Set the selection_model_ to the value of |selection|. |
| 338 // 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. |
| 339 // Returns true if the cursor position or selection range changed. | 339 // Returns true if the cursor position or selection range changed. |
| 340 // 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 |
| 341 // grapheme boundary), it is a no-op and returns false. | 341 // grapheme boundary), it is a no-op and returns false. |
| 342 bool MoveCursorTo(const SelectionModel& selection_model); | 342 bool MoveCursorTo(const SelectionModel& selection_model); |
| 343 | 343 |
| 344 // Moves the cursor to the text index corresponding to |point|. If |select| is |
| 345 // true, a selection is made with the current selection start index. If the |
| 346 // resultant text indices do not lie on valid grapheme boundaries, it is a no- |
| 347 // op and returns false. |
| 348 bool MoveCursorTo(const gfx::Point& point, bool select); |
| 349 |
| 344 // Set the selection_model_ based on |range|. | 350 // Set the selection_model_ based on |range|. |
| 345 // If the |range| start or end is greater than text length, it is modified | 351 // If the |range| start or end is greater than text length, it is modified |
| 346 // to be the text length. | 352 // to be the text length. |
| 347 // If the |range| start or end is not a cursorable position (not on grapheme | 353 // If the |range| start or end is not a cursorable position (not on grapheme |
| 348 // boundary), it is a NO-OP and returns false. Otherwise, returns true. | 354 // boundary), it is a NO-OP and returns false. Otherwise, returns true. |
| 349 bool SelectRange(const Range& range); | 355 bool SelectRange(const Range& range); |
| 350 | 356 |
| 351 // Returns true if the local point is over selected text. | 357 // Returns true if the local point is over selected text. |
| 352 bool IsPointInSelection(const Point& point); | 358 bool IsPointInSelection(const Point& point); |
| 353 | 359 |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 // Lines computed by EnsureLayout. These should be invalidated upon | 848 // Lines computed by EnsureLayout. These should be invalidated upon |
| 843 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 849 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
| 844 std::vector<internal::Line> lines_; | 850 std::vector<internal::Line> lines_; |
| 845 | 851 |
| 846 DISALLOW_COPY_AND_ASSIGN(RenderText); | 852 DISALLOW_COPY_AND_ASSIGN(RenderText); |
| 847 }; | 853 }; |
| 848 | 854 |
| 849 } // namespace gfx | 855 } // namespace gfx |
| 850 | 856 |
| 851 #endif // UI_GFX_RENDER_TEXT_H_ | 857 #endif // UI_GFX_RENDER_TEXT_H_ |
| OLD | NEW |