| 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 virtual SelectionModel FindCursorPosition(const Point& point) = 0; | 456 virtual SelectionModel FindCursorPosition(const Point& point) = 0; |
| 457 | 457 |
| 458 // Returns true if the position is a valid logical index into text(), and is | 458 // Returns true if the position is a valid logical index into text(), and is |
| 459 // also a valid grapheme boundary, which may be used as a cursor position. | 459 // also a valid grapheme boundary, which may be used as a cursor position. |
| 460 virtual bool IsValidCursorIndex(size_t index) = 0; | 460 virtual bool IsValidCursorIndex(size_t index) = 0; |
| 461 | 461 |
| 462 // Returns true if the position is a valid logical index into text(). Indices | 462 // Returns true if the position is a valid logical index into text(). Indices |
| 463 // amid multi-character graphemes are allowed here, unlike IsValidCursorIndex. | 463 // amid multi-character graphemes are allowed here, unlike IsValidCursorIndex. |
| 464 virtual bool IsValidLogicalIndex(size_t index) const; | 464 virtual bool IsValidLogicalIndex(size_t index) const; |
| 465 | 465 |
| 466 // Returns true if this instance supports text selection. |
| 467 virtual bool IsSelectionSupported() const = 0; |
| 468 |
| 466 // Get the visual bounds of a cursor at |caret|. These bounds typically | 469 // Get the visual bounds of a cursor at |caret|. These bounds typically |
| 467 // represent a vertical line if |insert_mode| is true. Pass false for | 470 // represent a vertical line if |insert_mode| is true. Pass false for |
| 468 // |insert_mode| to retrieve the bounds of the associated glyph. These bounds | 471 // |insert_mode| to retrieve the bounds of the associated glyph. These bounds |
| 469 // are in local coordinates, but may be outside the visible region if the text | 472 // are in local coordinates, but may be outside the visible region if the text |
| 470 // is longer than the textfield. Subsequent text, cursor, or bounds changes | 473 // is longer than the textfield. Subsequent text, cursor, or bounds changes |
| 471 // may invalidate returned values. Note that |caret| must be placed at | 474 // may invalidate returned values. Note that |caret| must be placed at |
| 472 // grapheme boundary, i.e. caret.caret_pos() must be a cursorable position. | 475 // grapheme boundary, i.e. caret.caret_pos() must be a cursorable position. |
| 473 Rect GetCursorBounds(const SelectionModel& caret, bool insert_mode); | 476 Rect GetCursorBounds(const SelectionModel& caret, bool insert_mode); |
| 474 | 477 |
| 475 // Compute the current cursor bounds, panning the text to show the cursor in | 478 // 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... |
| 858 // Lines computed by EnsureLayout. These should be invalidated upon | 861 // Lines computed by EnsureLayout. These should be invalidated upon |
| 859 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. | 862 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. |
| 860 std::vector<internal::Line> lines_; | 863 std::vector<internal::Line> lines_; |
| 861 | 864 |
| 862 DISALLOW_COPY_AND_ASSIGN(RenderText); | 865 DISALLOW_COPY_AND_ASSIGN(RenderText); |
| 863 }; | 866 }; |
| 864 | 867 |
| 865 } // namespace gfx | 868 } // namespace gfx |
| 866 | 869 |
| 867 #endif // UI_GFX_RENDER_TEXT_H_ | 870 #endif // UI_GFX_RENDER_TEXT_H_ |
| OLD | NEW |