Chromium Code Reviews| Index: ui/gfx/render_text.h |
| diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h |
| index da3607d9e11f8ed7109d2033f28903f7171b9d19..7f37ae077d2a8990544c125424ebd31242ab3e9e 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 SetIsObscured(bool obscured); |
|
oshima
2011/12/06 23:57:18
SetObscured
benrg
2011/12/08 21:40:55
Done.
|
| + |
| 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 |
| @@ -296,6 +294,9 @@ class UI_EXPORT RenderText { |
| // The default text style. |
| StyleRange default_style_; |
| + // True if this is a password field. |
|
oshima
2011/12/06 23:57:18
update the comment
benrg
2011/12/08 21:40:55
Done.
|
| + 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. |