Chromium Code Reviews| Index: ui/gfx/render_text.h |
| =================================================================== |
| --- ui/gfx/render_text.h (revision 100008) |
| +++ ui/gfx/render_text.h (working copy) |
| @@ -193,7 +193,9 @@ |
| // Set the selection_model_ to the value of |selection|. |
| // The selection model components are modified if invalid. |
| // Returns true if the cursor position or selection range changed. |
| - // TODO(xji): need to check the cursor is set at grapheme boundary. |
| + // If |selectin_start_| or |selection_end_| or |caret_pos_| in |
| + // |selection_model| is not a cursorable position (not on grapheme boundary), |
| + // it is a NO-OP and returns false. |
| bool MoveCursorTo(const SelectionModel& selection_model); |
|
msw
2011/09/09 23:03:24
Is it possible that the text could end with a non-
xji
2011/09/12 21:31:48
We do not allow that.
When I choose whether to use
|
| // Move the cursor to the position associated with the clicked point. |
| @@ -254,6 +256,9 @@ |
| // Subsequent text, cursor, or bounds changes may invalidate returned values. |
| const Rect& GetUpdatedCursorBounds(); |
| + // Get the logical index of the grapheme following the argument |position|. |
| + virtual size_t GetIndexOfNextGrapheme(size_t position); |
| + |
| protected: |
| RenderText(); |
| @@ -288,6 +293,10 @@ |
| // TODO(msw) Re-evaluate this function's necessity and signature. |
| virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to); |
| + // 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. |
| + virtual bool IsCursorablePosition(size_t position); |
| + |
| // Apply composition style (underline) to composition range and selection |
| // style (foreground) to selection range. |
| void ApplyCompositionAndSelectionStyles(StyleRanges* style_ranges) const; |
| @@ -311,10 +320,10 @@ |
| // 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. |
| + // If the |position| is not a cursorable position (not on grapheme boundary), |
| + // it is a NO-OP. |
| void MoveCursorTo(size_t position, bool select); |
| - bool IsPositionAtWordSelectionBoundary(size_t pos); |
| - |
| // Update the cached bounds and display offset to ensure that the current |
| // cursor is within the visible display area. |
| void UpdateCachedBoundsAndOffset(); |