Index: chrome/browser/ui/cocoa/autofill/autofill_textfield.mm |
diff --git a/chrome/browser/ui/cocoa/autofill/autofill_textfield.mm b/chrome/browser/ui/cocoa/autofill/autofill_textfield.mm |
index 0d855ca863abbcce1e2141dd67d24f2346e29aa1..6ee5aa9eb8cb5beb63ef45a0885cdb588715d419 100644 |
--- a/chrome/browser/ui/cocoa/autofill/autofill_textfield.mm |
+++ b/chrome/browser/ui/cocoa/autofill/autofill_textfield.mm |
@@ -40,11 +40,30 @@ const CGFloat kMinimumHeight = 27.0; // Enforced minimum height for text cells. |
- (BOOL)becomeFirstResponder { |
BOOL result = [super becomeFirstResponder]; |
- if (result && delegate_) |
+ if (result && delegate_) { |
[delegate_ fieldBecameFirstResponder:self]; |
+ shouldFilterClick_ = YES; |
+ } |
return result; |
} |
+- (void)onEditorMouseDown:(id)sender { |
+ // Since the dialog does not care about clicks that gave firstResponder |
+ // status, swallow those. |
+ if (!handlingFirstClick_) |
+ [delegate_ onMouseDown: self]; |
+} |
+ |
+- (void)mouseDown:(NSEvent*)theEvent { |
+ // mouseDown: is only invoked for a click that actually gave firstResponder |
+ // status to the NSTextField, and clicks to the border area. Further clicks |
+ // into the content are are handled by the field editor instead. |
+ handlingFirstClick_ = shouldFilterClick_; |
+ [super mouseDown:theEvent]; |
+ handlingFirstClick_ = NO; |
+ shouldFilterClick_ = NO; |
+} |
+ |
- (void)controlTextDidEndEditing:(NSNotification*)notification { |
if (delegate_) |
[delegate_ didEndEditing:self]; |
@@ -90,6 +109,7 @@ const CGFloat kMinimumHeight = 27.0; // Enforced minimum height for text cells. |
@end |
+ |
@implementation AutofillTextFieldCell |
@synthesize invalid = invalid_; |