Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: ui/gfx/render_text.h

Issue 7598014: Adjust GetLeft/RightSelectionModel return, cursor on edit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix caret placement API for RTL text edits. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | ui/gfx/render_text.cc » ('j') | ui/gfx/render_text.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698