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 <algorithm> | 8 #include <algorithm> |
9 #include <cstring> | 9 #include <cstring> |
10 #include <string> | 10 #include <string> |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 // offset from the top of |display_rect_| to the text baseline, in pixels. | 342 // offset from the top of |display_rect_| to the text baseline, in pixels. |
343 // The baseline is determined from the font list and display rect, and does | 343 // The baseline is determined from the font list and display rect, and does |
344 // not depend on the text. | 344 // not depend on the text. |
345 int GetBaseline(); | 345 int GetBaseline(); |
346 | 346 |
347 void Draw(Canvas* canvas); | 347 void Draw(Canvas* canvas); |
348 | 348 |
349 // Draws a cursor at |position|. | 349 // Draws a cursor at |position|. |
350 void DrawCursor(Canvas* canvas, const SelectionModel& position); | 350 void DrawCursor(Canvas* canvas, const SelectionModel& position); |
351 | 351 |
352 // Draw the selected text without a cursor or selection highlight. Subpixel | |
353 // antialiasing is disabled and foreground color is forced to black. | |
354 void DrawSelectedTextForDrag(Canvas* canvas); | |
355 | |
356 // Gets the SelectionModel from a visual point in local coordinates. | 352 // Gets the SelectionModel from a visual point in local coordinates. |
357 virtual SelectionModel FindCursorPosition(const Point& point) = 0; | 353 virtual SelectionModel FindCursorPosition(const Point& point) = 0; |
358 | 354 |
359 // Return true if cursor can appear in front of the character at |position|, | 355 // Return true if cursor can appear in front of the character at |position|, |
360 // which means it is a grapheme boundary or the first character in the text. | 356 // which means it is a grapheme boundary or the first character in the text. |
361 virtual bool IsCursorablePosition(size_t position) = 0; | 357 virtual bool IsCursorablePosition(size_t position) = 0; |
362 | 358 |
363 // Get the visual bounds of a cursor at |caret|. These bounds typically | 359 // Get the visual bounds of a cursor at |caret|. These bounds typically |
364 // represent a vertical line if |insert_mode| is true. Pass false for | 360 // represent a vertical line if |insert_mode| is true. Pass false for |
365 // |insert_mode| to retrieve the bounds of the associated glyph. These bounds | 361 // |insert_mode| to retrieve the bounds of the associated glyph. These bounds |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 // Lines computed by EnsureLayout. These should be invalidated with | 680 // Lines computed by EnsureLayout. These should be invalidated with |
685 // ResetLayout and on |display_rect_| changes. | 681 // ResetLayout and on |display_rect_| changes. |
686 std::vector<internal::Line> lines_; | 682 std::vector<internal::Line> lines_; |
687 | 683 |
688 DISALLOW_COPY_AND_ASSIGN(RenderText); | 684 DISALLOW_COPY_AND_ASSIGN(RenderText); |
689 }; | 685 }; |
690 | 686 |
691 } // namespace gfx | 687 } // namespace gfx |
692 | 688 |
693 #endif // UI_GFX_RENDER_TEXT_H_ | 689 #endif // UI_GFX_RENDER_TEXT_H_ |
OLD | NEW |