Index: ui/gfx/render_text.h |
=================================================================== |
--- ui/gfx/render_text.h (revision 109708) |
+++ ui/gfx/render_text.h (working copy) |
@@ -172,7 +172,7 @@ |
// may be outside the visible region if the text is longer than the textfield. |
// Subsequent text, cursor, or bounds changes may invalidate returned values. |
virtual Rect GetCursorBounds(const SelectionModel& selection, |
- bool insert_mode); |
+ bool insert_mode) = 0; |
// Compute the current cursor bounds, panning the text to show the cursor in |
// the display rect if necessary. These bounds are in local coordinates. |
@@ -209,16 +209,18 @@ |
virtual SelectionModel LeftEndSelectionModel(); |
virtual SelectionModel RightEndSelectionModel(); |
- // Get the logical index of the grapheme preceeding the argument |position|. |
- virtual size_t GetIndexOfPreviousGrapheme(size_t position); |
+ // Sets the selection model, the argument is assumed to be valid. |
+ virtual void SetSelectionModel(const SelectionModel& selection_model); |
// Get the visual bounds containing the logical substring within |from| to |
- // |to|. These bounds could be visually discontinuous if the substring is |
- // split by a LTR/RTL level change. These bounds are in local coordinates, but |
- // may be outside the visible region if the text is longer than the textfield. |
- // Subsequent text, cursor, or bounds changes may invalidate returned values. |
- // TODO(msw) Re-evaluate this function's necessity and signature. |
- virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to); |
+ // |to| into |bounds|. These bounds could be visually discontinuous if the |
+ // substring is split by a LTR/RTL level change. These bounds are in local |
+ // coordinates, but may be outside the visible region if the text is longer |
+ // than the textfield. Subsequent text, cursor, or bounds changes may |
+ // invalidate returned values. |
+ virtual void GetSubstringBounds(size_t from, |
+ size_t to, |
+ std::vector<Rect>* bounds) = 0; |
// Return true if cursor can appear in front of the character at |position|, |
// which means it is a grapheme boundary or the first character in the text. |
@@ -228,6 +230,12 @@ |
// render the text and its attributes. |
virtual void UpdateLayout() = 0; |
+ // Draw the text. |
+ virtual void DrawVisualText(Canvas* canvas) = 0; |
+ |
+ // Get the logical index of the grapheme preceding the argument |position|. |
+ size_t GetIndexOfPreviousGrapheme(size_t position); |
+ |
// Apply composition style (underline) to composition range and selection |
// style (foreground) to selection range. |
void ApplyCompositionAndSelectionStyles(StyleRanges* style_ranges) const; |
@@ -249,9 +257,6 @@ |
// The return value is bounded by 0 and the text length, inclusive. |
virtual size_t IndexOfAdjacentGrapheme(size_t index, bool next) = 0; |
- // Sets the selection model, the argument is assumed to be valid. |
- void SetSelectionModel(const SelectionModel& selection_model); |
- |
// Set the cursor to |position|, with the caret trailing the previous |
// grapheme, or if there is no previous grapheme, leading the cursor position. |
// If |select| is false, the selection start is moved to the same position. |
@@ -263,6 +268,10 @@ |
// cursor is within the visible display area. |
void UpdateCachedBoundsAndOffset(); |
+ // Draw the selection and cursor. |
+ void DrawSelection(Canvas* canvas); |
+ void DrawCursor(Canvas* canvas); |
+ |
// Logical UTF-16 string data to be drawn. |
string16 text_; |