| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 virtual SelectionModel FindCursorPosition(const Point& point) = 0; | 444 virtual SelectionModel FindCursorPosition(const Point& point) = 0; |
| 445 | 445 |
| 446 // Returns true if the position is a valid logical index into text(), and is | 446 // Returns true if the position is a valid logical index into text(), and is |
| 447 // also a valid grapheme boundary, which may be used as a cursor position. | 447 // also a valid grapheme boundary, which may be used as a cursor position. |
| 448 virtual bool IsValidCursorIndex(size_t index) = 0; | 448 virtual bool IsValidCursorIndex(size_t index) = 0; |
| 449 | 449 |
| 450 // Returns true if the position is a valid logical index into text(). Indices | 450 // Returns true if the position is a valid logical index into text(). Indices |
| 451 // amid multi-character graphemes are allowed here, unlike IsValidCursorIndex. | 451 // amid multi-character graphemes are allowed here, unlike IsValidCursorIndex. |
| 452 virtual bool IsValidLogicalIndex(size_t index) const; | 452 virtual bool IsValidLogicalIndex(size_t index) const; |
| 453 | 453 |
| 454 // Returns true if this instance supports text selection. |
| 455 virtual bool IsSelectionSupported() const = 0; |
| 456 |
| 454 // Get the visual bounds of a cursor at |caret|. These bounds typically | 457 // Get the visual bounds of a cursor at |caret|. These bounds typically |
| 455 // represent a vertical line if |insert_mode| is true. Pass false for | 458 // represent a vertical line if |insert_mode| is true. Pass false for |
| 456 // |insert_mode| to retrieve the bounds of the associated glyph. These bounds | 459 // |insert_mode| to retrieve the bounds of the associated glyph. These bounds |
| 457 // are in local coordinates, but may be outside the visible region if the text | 460 // are in local coordinates, but may be outside the visible region if the text |
| 458 // is longer than the textfield. Subsequent text, cursor, or bounds changes | 461 // is longer than the textfield. Subsequent text, cursor, or bounds changes |
| 459 // may invalidate returned values. Note that |caret| must be placed at | 462 // may invalidate returned values. Note that |caret| must be placed at |
| 460 // grapheme boundary, i.e. caret.caret_pos() must be a cursorable position. | 463 // grapheme boundary, i.e. caret.caret_pos() must be a cursorable position. |
| 461 Rect GetCursorBounds(const SelectionModel& caret, bool insert_mode); | 464 Rect GetCursorBounds(const SelectionModel& caret, bool insert_mode); |
| 462 | 465 |
| 463 // Compute the current cursor bounds, panning the text to show the cursor in | 466 // Compute the current cursor bounds, panning the text to show the cursor in |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 // Lines computed by EnsureLayout. These should be invalidated upon | 849 // Lines computed by EnsureLayout. These should be invalidated upon |
| 847 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 850 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
| 848 std::vector<internal::Line> lines_; | 851 std::vector<internal::Line> lines_; |
| 849 | 852 |
| 850 DISALLOW_COPY_AND_ASSIGN(RenderText); | 853 DISALLOW_COPY_AND_ASSIGN(RenderText); |
| 851 }; | 854 }; |
| 852 | 855 |
| 853 } // namespace gfx | 856 } // namespace gfx |
| 854 | 857 |
| 855 #endif // UI_GFX_RENDER_TEXT_H_ | 858 #endif // UI_GFX_RENDER_TEXT_H_ |
| OLD | NEW |