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

Unified Diff: ui/gfx/render_text.h

Issue 8747001: Reintroduce password support to NativeTextfieldViews (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments, Utf16OffsetToPointer bug Created 8 years, 10 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
Index: ui/gfx/render_text.h
diff --git a/ui/gfx/render_text.h b/ui/gfx/render_text.h
index db98b846057abbc7a8a0b63e0b1f7ce81953b3a6..645e80b6f91f080e2b0a7a78f22e1cb8c95cad43 100644
--- a/ui/gfx/render_text.h
+++ b/ui/gfx/render_text.h
@@ -152,6 +152,10 @@ class UI_EXPORT RenderText {
const StyleRange& default_style() const { return default_style_; }
void set_default_style(const 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);
@@ -325,6 +329,10 @@ class UI_EXPORT RenderText {
// Draw the text.
virtual void DrawVisualText(Canvas* canvas) = 0;
+ // Like text() except that it returns asterisks or bullets if this is an
+ // obscured field.
+ string16 GetDisplayText() const;
+
// Apply composition style (underline) to composition range and selection
// style (foreground) to selection range.
void ApplyCompositionAndSelectionStyles(StyleRanges* style_ranges);
@@ -357,6 +365,7 @@ class UI_EXPORT RenderText {
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, CustomDefaultStyle);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, ApplyStyleRange);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, StyleRangesAdjust);
+ FRIEND_TEST_ALL_PREFIXES(RenderTextTest, PasswordCensorship);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, GraphemePositions);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, SelectionModels);
FRIEND_TEST_ALL_PREFIXES(RenderTextTest, OriginForSkiaDrawing);
@@ -410,6 +419,9 @@ class UI_EXPORT RenderText {
// The default text style.
StyleRange default_style_;
+ // True if this is an obscured (password) field.
+ bool obscured_;
+
// Fade text head and/or tail, if text doesn't fit into |display_rect_|.
bool fade_head_;
bool fade_tail_;

Powered by Google App Engine
This is Rietveld 408576698