Index: ui/gfx/render_text.h |
=================================================================== |
--- ui/gfx/render_text.h (revision 97884) |
+++ ui/gfx/render_text.h (working copy) |
@@ -121,9 +121,12 @@ |
private: |
void Init(size_t start, size_t end, size_t pos, CaretPlacement status); |
- // Logical selection start. If there is non-empty selection, the selection |
- // always starts visually at the leading edge of the selection_start. So, we |
- // do not need extra information for visual selection bounding. |
+ // Logical selection start. If there is non-empty selection, if |
+ // selection_start_ is less than selection_end_, the selection starts visually |
+ // at the leading edge of the selection_start_. If selection_start_ is greater |
+ // than selection_end_, the selection starts visually at the trailing edge of |
+ // selection_start_'s previous grapheme. So, we do not need extra information |
+ // for visual bounding. |
size_t selection_start_; |
// The logical cursor position that next character will be inserted into. |
@@ -176,7 +179,7 @@ |
// edits take place, and doesn't necessarily correspond to |
// SelectionModel::caret_pos. |
size_t GetCursorPosition() const; |
- void SetCursorPosition(const size_t position); |
+ void SetCursorPosition(size_t position); |
void SetCaretPlacement(SelectionModel::CaretPlacement placement) { |
selection_model_.set_caret_placement(placement); |
@@ -226,7 +229,7 @@ |
// Apply |default_style_| over the entire text range. |
virtual void ApplyDefaultStyle(); |
- base::i18n::TextDirection GetTextDirection() const; |
+ virtual base::i18n::TextDirection GetTextDirection(); |
// Get the width of the entire string. |
virtual int GetStringWidth(); |
@@ -274,13 +277,18 @@ |
virtual SelectionModel GetRightSelectionModel(const SelectionModel& current, |
BreakType break_type); |
- // Get the logical index of the grapheme preceeding the argument |position|. |
+ // Get the logical index of the grapheme preceding the argument |position|. |
virtual 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; |
+ // Convert points from the text space to the view space and back. |
+ // Handles the display area, display offset, and the application LTR/RTL mode. |
+ Point ToTextPoint(const Point& point); |
+ Point ToViewPoint(const Point& point); |
+ |
private: |
friend class RenderTextTest; |
@@ -292,12 +300,22 @@ |
// Clear out |style_ranges_|. |
void ClearStyleRanges(); |
+ // 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. |
+ 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(); |
+ // Returns the selection model of selection_start_. This should be called only |
+ // when selection is not empty, i.e. selection_end_ != selection_start_. |
msw
2011/08/24 08:55:30
I would hope that this function does something rea
xji
2011/08/25 03:15:19
changed the implementation to return selection_mod
|
+ // The returned value represents a cursor/caret position without a selection. |
+ SelectionModel GetSelectionModelForSelectionStart(); |
+ |
// Logical UTF-16 string data to be drawn. |
string16 text_; |