Chromium Code Reviews| Index: ui/gfx/render_text.h |
| diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h |
| index 99b4033f03f483d275d5f9a0bff674a6c06015f9..f7232904b0cc857e256c94c45b6633b782994c95 100644 |
| --- a/ui/gfx/render_text.h |
| +++ b/ui/gfx/render_text.h |
| @@ -49,7 +49,10 @@ struct UI_API StyleRange { |
| typedef std::vector<StyleRange> StyleRanges; |
| -// TODO(msw): Distinguish between logical character and glyph? |
| +// TODO(msw): Distinguish between logical character stops and glyph stops? |
| +// CHARACTER_BREAK cursor movements should stop at neighboring characters. |
| +// WORD_BREAK cursor movements should stop at the nearest word boundaries. |
| +// LINE_BREAK cursor movements should stop at the text ends as shown on screen. |
| enum BreakType { |
| CHARACTER_BREAK, |
| WORD_BREAK, |
| @@ -186,9 +189,6 @@ class UI_API RenderText { |
| // Moves the cursor left or right. Cursor movement is visual, meaning that |
| // left and right are relative to screen, not the directionality of the text. |
| // If |select| is false, the selection range is emptied at the new position. |
| - // If |break_type| is CHARACTER_BREAK, move to the neighboring character. |
| - // If |break_type| is WORD_BREAK, move to the nearest word boundary. |
| - // If |break_type| is LINE_BREAK, move to text edge as shown on screen. |
| void MoveCursorLeft(BreakType break_type, bool select); |
| void MoveCursorRight(BreakType break_type, bool select); |
| @@ -263,12 +263,15 @@ class UI_API RenderText { |
| const StyleRanges& style_ranges() const { return style_ranges_; } |
| - // Get the cursor position that visually neighbors |position|. |
| - // If |move_by_word| is true, return the neighboring word delimiter position. |
| - virtual SelectionModel GetLeftCursorPosition(const SelectionModel& current, |
| - bool move_by_word); |
| - virtual SelectionModel GetRightCursorPosition(const SelectionModel& current, |
| - bool move_by_word); |
| + // Get the selection model that visually neighbors |position| by |break_type|. |
| + // The returned value represents a cursor/caret position without a selection. |
| + virtual SelectionModel GetLeftSelectionModel(const SelectionModel& current, |
| + BreakType break_type); |
| + virtual SelectionModel GetRightSelectionModel(const SelectionModel& current, |
| + BreakType break_type); |
| + |
| + // Get the logical index of the grapheme preceeding the argument |position|. |
| + virtual size_t GetPreviousGrapheme(size_t position) const; |
|
xji
2011/08/08 23:56:13
Maybe GetIndexOfPreviousGrapheme or IndexOfPreviou
msw
2011/08/09 01:07:42
Done.
|
| // Apply composition style (underline) to composition range and selection |
| // style (foreground) to selection range. |