| Index: ui/gfx/render_text.h
|
| diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
|
| index da3607d9e11f8ed7109d2033f28903f7171b9d19..19f24418aaa1c4beb6c9b251af619889d8aa8f18 100644
|
| --- a/ui/gfx/render_text.h
|
| +++ b/ui/gfx/render_text.h
|
| @@ -21,16 +21,6 @@
|
|
|
| namespace gfx {
|
|
|
| -// Color settings for text, backgrounds and cursor.
|
| -// These are tentative, and should be derived from theme, system
|
| -// settings and current settings.
|
| -// TODO(oshima): Change this to match the standard chrome
|
| -// before dogfooding textfield views.
|
| -const SkColor kSelectedTextColor = SK_ColorWHITE;
|
| -const SkColor kFocusedSelectionColor = SkColorSetRGB(30, 144, 255);
|
| -const SkColor kUnfocusedSelectionColor = SK_ColorLTGRAY;
|
| -const SkColor kCursorColor = SK_ColorBLACK;
|
| -
|
| class Canvas;
|
| class RenderTextTest;
|
|
|
| @@ -73,6 +63,10 @@ class UI_EXPORT RenderText {
|
| const string16& text() const { return text_; }
|
| void SetText(const string16& text);
|
|
|
| + // Like text() except that it returns asterisks or bullets if this is an
|
| + // obscured field.
|
| + string16 GetObscuredText() const;
|
| +
|
| const SelectionModel& selection_model() const { return selection_model_; }
|
|
|
| bool cursor_visible() const { return cursor_visible_; }
|
| @@ -87,6 +81,10 @@ class UI_EXPORT RenderText {
|
| const StyleRange& default_style() const { return default_style_; }
|
| void set_default_style(StyleRange style) { default_style_ = style; }
|
|
|
| + // In an obscured (password) field, all text is drawn as asterisks or bullets.
|
| + bool is_obscured() const { return obscured_; }
|
| + void SetObscured(bool obscured);
|
| +
|
| const Rect& display_rect() const { return display_rect_; }
|
| void SetDisplayRect(const Rect& r);
|
|
|
| @@ -156,12 +154,12 @@ class UI_EXPORT RenderText {
|
| virtual base::i18n::TextDirection GetTextDirection();
|
|
|
| // Get the width of the entire string.
|
| - virtual int GetStringWidth();
|
| + virtual int GetStringWidth() = 0;
|
|
|
| virtual void Draw(Canvas* canvas);
|
|
|
| // Gets the SelectionModel from a visual point in local coordinates.
|
| - virtual SelectionModel FindCursorPosition(const Point& point);
|
| + virtual SelectionModel FindCursorPosition(const Point& point) = 0;
|
|
|
| // Get the visual bounds of a cursor at |selection|. These bounds typically
|
| // represent a vertical line, but if |insert_mode| is true they contain the
|
| @@ -197,14 +195,14 @@ class UI_EXPORT RenderText {
|
| // 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);
|
| + BreakType break_type) = 0;
|
| virtual SelectionModel GetRightSelectionModel(const SelectionModel& current,
|
| - BreakType break_type);
|
| + BreakType break_type) = 0;
|
|
|
| // Get the SelectionModels corresponding to visual text ends.
|
| // The returned value represents a cursor/caret position without a selection.
|
| - virtual SelectionModel LeftEndSelectionModel();
|
| - virtual SelectionModel RightEndSelectionModel();
|
| + virtual SelectionModel LeftEndSelectionModel() = 0;
|
| + virtual SelectionModel RightEndSelectionModel() = 0;
|
|
|
| // Sets the selection model, the argument is assumed to be valid.
|
| virtual void SetSelectionModel(const SelectionModel& model);
|
| @@ -296,6 +294,9 @@ class UI_EXPORT RenderText {
|
| // The default text style.
|
| StyleRange default_style_;
|
|
|
| + // True if this is an obscured (password) field.
|
| + bool obscured_;
|
| +
|
| // The local display area for rendering the text.
|
| Rect display_rect_;
|
| // The offset for the text to be drawn, relative to the display area.
|
|
|