Index: chrome/browser/autofill/autofill_text_field_mac.mm |
diff --git a/chrome/browser/autofill/autofill_text_field_mac.mm b/chrome/browser/autofill/autofill_text_field_mac.mm |
index ff5b1a0bd39911f0c06edd66e063b567920a34a2..509b1a6e3c65f0035a6380d53537d645e322e355 100644 |
--- a/chrome/browser/autofill/autofill_text_field_mac.mm |
+++ b/chrome/browser/autofill/autofill_text_field_mac.mm |
@@ -10,22 +10,18 @@ |
@implementation AutoFillTextField |
- (void)awakeFromNib { |
- if ([self tag] == AUTOFILL_CC_TAG) |
+ // Fields tagged with this value in the nib file will be treated as credit |
+ // card number fields. |
+ const int kAutoFillCreditCardTag = 22; |
+ |
+ if ([self tag] == kAutoFillCreditCardTag) { |
isCreditCardField_ = YES; |
-} |
-// Override NSResponder method for when the text field may gain focus. We |
-// call |scrollRectToVisible| to ensure that this text field is visible within |
-// the scrolling area. |
-- (BOOL)becomeFirstResponder { |
- // Vertical inset is negative to indicate "outset". Provides some visual |
- // space above and below when tabbing between fields. |
- const CGFloat kVerticalInset = -40.0; |
- BOOL becoming = [super becomeFirstResponder]; |
- if (becoming) { |
- [self scrollRectToVisible:NSInsetRect([self bounds], 0.0, kVerticalInset)]; |
+ // KVO bindings initialize fields prior to |awakeFromNib|. In the credit |
+ // card field case we need to re-initialize the value to the obfuscated |
+ // version. |
+ [self setObjectValue:[self objectValue]]; |
} |
- return becoming; |
} |
- (void)setObjectValue:(id)object { |
@@ -51,6 +47,7 @@ |
// fetched if it is changed, and since we force selection, that should clear |
// the obfuscation. Nevertheless, we'll be paranoid here since we don't want |
// the obfuscating ***s to end up in the database. |
+ NOTREACHED(); |
return obfuscatedValue_.get(); |
} else { |
return [super objectValue]; |