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

Unified Diff: ui/views/controls/textfield/textfield.cc

Issue 8748001: Make text input type and password visibility bit independent in Textfield (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 11 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/views/controls/textfield/textfield.cc
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 6da051073be25960449c556782802ba0a5b8f17e..7cdddc658849d6798690cb1e9fd3303c727892c0 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -105,18 +105,13 @@ bool Textfield::IsObscured() const {
}
void Textfield::SetObscured(bool obscured) {
- if (obscured) {
- style_ = static_cast<StyleFlags>(style_ | STYLE_OBSCURED);
- SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
- } else {
- style_ = static_cast<StyleFlags>(style_ & ~STYLE_OBSCURED);
- SetTextInputType(ui::TEXT_INPUT_TYPE_TEXT);
+ if (obscured != IsObscured()) {
+ style_ = static_cast<StyleFlags>(style_ ^ STYLE_OBSCURED);
+ if (native_wrapper_)
+ native_wrapper_->UpdateIsObscured();
}
- if (native_wrapper_)
- native_wrapper_->UpdateIsObscured();
}
-
ui::TextInputType Textfield::GetTextInputType() const {
if (read_only() || !enabled())
return ui::TEXT_INPUT_TYPE_NONE;
@@ -125,9 +120,6 @@ ui::TextInputType Textfield::GetTextInputType() const {
void Textfield::SetTextInputType(ui::TextInputType type) {
text_input_type_ = type;
- bool should_be_obscured = type == ui::TEXT_INPUT_TYPE_PASSWORD;
- if (IsObscured() != should_be_obscured)
- SetObscured(should_be_obscured);
}
void Textfield::SetText(const string16& text) {

Powered by Google App Engine
This is Rietveld 408576698