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

Side by Side 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: new implementation, linux only 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_RENDER_TEXT_H_ 5 #ifndef UI_GFX_RENDER_TEXT_H_
6 #define UI_GFX_RENDER_TEXT_H_ 6 #define UI_GFX_RENDER_TEXT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 const FontList& font_list() const { return font_list_; } 129 const FontList& font_list() const { return font_list_; }
130 void SetFontList(const FontList& font_list); 130 void SetFontList(const FontList& font_list);
131 131
132 // Set the font size to |size| in pixels. 132 // Set the font size to |size| in pixels.
133 void SetFontSize(int size); 133 void SetFontSize(int size);
134 134
135 // Get the first font in |font_list_|. 135 // Get the first font in |font_list_|.
136 const Font& GetFont() const; 136 const Font& GetFont() const;
137 137
138 // Like text() except that it returns asterisks or bullets if this is an
139 // obscured field.
140 string16 GetDisplayText() const;
xji 2012/02/18 01:28:47 change to protected.
benrg 2012/02/24 19:07:44 Done.
141
138 const SelectionModel& selection_model() const { return selection_model_; } 142 const SelectionModel& selection_model() const { return selection_model_; }
139 143
140 bool cursor_enabled() const { return cursor_enabled_; } 144 bool cursor_enabled() const { return cursor_enabled_; }
141 void SetCursorEnabled(bool cursor_enabled); 145 void SetCursorEnabled(bool cursor_enabled);
142 146
143 bool cursor_visible() const { return cursor_visible_; } 147 bool cursor_visible() const { return cursor_visible_; }
144 void set_cursor_visible(bool visible) { cursor_visible_ = visible; } 148 void set_cursor_visible(bool visible) { cursor_visible_ = visible; }
145 149
146 bool insert_mode() const { return insert_mode_; } 150 bool insert_mode() const { return insert_mode_; }
147 void ToggleInsertMode(); 151 void ToggleInsertMode();
148 152
149 bool focused() const { return focused_; } 153 bool focused() const { return focused_; }
150 void set_focused(bool focused) { focused_ = focused; } 154 void set_focused(bool focused) { focused_ = focused; }
151 155
152 const StyleRange& default_style() const { return default_style_; } 156 const StyleRange& default_style() const { return default_style_; }
153 void set_default_style(const StyleRange& style) { default_style_ = style; } 157 void set_default_style(const StyleRange& style) { default_style_ = style; }
154 158
159 // In an obscured (password) field, all text is drawn as asterisks or bullets.
160 bool is_obscured() const { return obscured_; }
161 void SetObscured(bool obscured);
162
155 const Rect& display_rect() const { return display_rect_; } 163 const Rect& display_rect() const { return display_rect_; }
156 void SetDisplayRect(const Rect& r); 164 void SetDisplayRect(const Rect& r);
157 165
158 void set_fade_head(bool fade_head) { fade_head_ = fade_head; } 166 void set_fade_head(bool fade_head) { fade_head_ = fade_head; }
159 bool fade_head() const { return fade_head_; } 167 bool fade_head() const { return fade_head_; }
160 void set_fade_tail(bool fade_tail) { fade_tail_ = fade_tail; } 168 void set_fade_tail(bool fade_tail) { fade_tail_ = fade_tail; }
161 bool fade_tail() const { return fade_tail_; } 169 bool fade_tail() const { return fade_tail_; }
162 170
163 // This cursor position corresponds to SelectionModel::selection_end. In 171 // This cursor position corresponds to SelectionModel::selection_end. In
164 // addition to representing the selection end, it's also where logical text 172 // addition to representing the selection end, it's also where logical text
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 bool focused_; 411 bool focused_;
404 412
405 // Composition text range. 413 // Composition text range.
406 ui::Range composition_range_; 414 ui::Range composition_range_;
407 415
408 // List of style ranges. Elements in the list never overlap each other. 416 // List of style ranges. Elements in the list never overlap each other.
409 StyleRanges style_ranges_; 417 StyleRanges style_ranges_;
410 // The default text style. 418 // The default text style.
411 StyleRange default_style_; 419 StyleRange default_style_;
412 420
421 // True if this is an obscured (password) field.
422 bool obscured_;
423
413 // Fade text head and/or tail, if text doesn't fit into |display_rect_|. 424 // Fade text head and/or tail, if text doesn't fit into |display_rect_|.
414 bool fade_head_; 425 bool fade_head_;
415 bool fade_tail_; 426 bool fade_tail_;
416 427
417 // The local display area for rendering the text. 428 // The local display area for rendering the text.
418 Rect display_rect_; 429 Rect display_rect_;
419 430
420 // The offset for the text to be drawn, relative to the display area. 431 // The offset for the text to be drawn, relative to the display area.
421 // Get this point with GetUpdatedDisplayOffset (or risk using a stale value). 432 // Get this point with GetUpdatedDisplayOffset (or risk using a stale value).
422 Point display_offset_; 433 Point display_offset_;
423 434
424 // The cached bounds and offset are invalidated by changes to the cursor, 435 // The cached bounds and offset are invalidated by changes to the cursor,
425 // selection, font, and other operations that adjust the visible text bounds. 436 // selection, font, and other operations that adjust the visible text bounds.
426 bool cached_bounds_and_offset_valid_; 437 bool cached_bounds_and_offset_valid_;
427 438
428 DISALLOW_COPY_AND_ASSIGN(RenderText); 439 DISALLOW_COPY_AND_ASSIGN(RenderText);
429 }; 440 };
430 441
431 } // namespace gfx 442 } // namespace gfx
432 443
433 #endif // UI_GFX_RENDER_TEXT_H_ 444 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698