From d4c0ca6fff00aed010e339b612358fdd0b66dc69 Mon Sep 17 00:00:00 2001 From: "groby@chromium.org" Date: Fri, 14 Mar 2014 21:54:35 +0000 Subject: [rAC, OSX] Hide disabled fields without text. requestAutocomplete should never display disabled fields that don't have a text value - those fields are not editable, and don't give any info to the user. BUG=325491 Review URL: https://codereview.chromium.org/199623002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257218 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/ui/cocoa/autofill/autofill_textfield.mm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/chrome/browser/ui/cocoa/autofill/autofill_textfield.mm b/chrome/browser/ui/cocoa/autofill/autofill_textfield.mm index d0e3ea5..af881de 100644 --- a/chrome/browser/ui/cocoa/autofill/autofill_textfield.mm +++ b/chrome/browser/ui/cocoa/autofill/autofill_textfield.mm @@ -215,10 +215,6 @@ const CGFloat kMinimumHeight = 27.0; // Enforced minimum height for text cells. - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { NSRect textFrame = [self textFrameForFrame:cellFrame]; [super drawInteriorWithFrame:textFrame inView:controlView]; -} - -- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { - [super drawWithFrame:cellFrame inView:controlView]; if (icon_) { NSRect iconFrame = [self decorationFrameForFrame:cellFrame]; @@ -229,6 +225,14 @@ const CGFloat kMinimumHeight = 27.0; // Enforced minimum height for text cells. respectFlipped:YES hints:nil]; } +} + +- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { + // If the control is disabled and doesn't have text, don't draw it. + if (![self isEnabled] && ([[self stringValue] length] == 0)) + return; + + [super drawWithFrame:cellFrame inView:controlView]; if (invalid_) { gfx::ScopedNSGraphicsContextSaveGState state; -- cgit v1.1