From 20f3effa765f7491fdaf0c9717f58d8cde267a27 Mon Sep 17 00:00:00 2001 From: "rsesek@chromium.org" Date: Tue, 27 Sep 2011 23:14:14 +0000 Subject: [PATCH] [Mac] |-sizeToFit| does not handle small-sized HyperlinkButtonCell well, so pad the width a little. BUG=53569 TEST=visual Review URL: http://codereview.chromium.org/8002002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103042 0039d316-1c4b-4281-b951-d872f2087c98 --- .../content_setting_bubble_cocoa.mm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm index 32f2549907c3bc..c969a4f5129ceb 100644 --- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm +++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.mm @@ -213,15 +213,18 @@ - (NSButton*)hyperlinkButtonWithFrame:(NSRect)frame // Cell must be set immediately after construction. [button setCell:cell.get()]; + // Size to fit the button and add a little extra padding for the small-text + // hyperlink button, which sizeToFit gets wrong. + [GTMUILocalizerAndLayoutTweaker sizeToFitView:button]; + NSRect buttonFrame = [button frame]; + buttonFrame.size.width += 2; + // If the link text is too long, clamp it. - [button sizeToFit]; int maxWidth = NSWidth([[self bubble] frame]) - 2 * NSMinX(referenceFrame); - NSRect buttonFrame = [button frame]; - if (NSWidth(buttonFrame) > maxWidth) { + if (NSWidth(buttonFrame) > maxWidth) buttonFrame.size.width = maxWidth; - [button setFrame:buttonFrame]; - } + [button setFrame:buttonFrame]; [button setTarget:self]; [button setAction:@selector(popupLinkClicked:)]; return button;