summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-21 11:52:48 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-21 11:52:48 +0000
commit8ddb57924349567a94419878536c781cd7791847 (patch)
tree3b325ab15224efb1ff58012f73a5d4cd20aa0241 /chrome/browser/cocoa
parent23b9fbef6262820af93c1312674d94715b2c4baf (diff)
downloadchromium_src-8ddb57924349567a94419878536c781cd7791847.zip
chromium_src-8ddb57924349567a94419878536c781cd7791847.tar.gz
chromium_src-8ddb57924349567a94419878536c781cd7791847.tar.bz2
Mac: Fix corner case of fading out Bookmark bar buttons for no reason
The bug report was that you could create bookmark bar items that weren't truncated but still got the fadeout effect we use for truncated bookmark bar items. The reason this was happening was because our calculation of when Cocoa was going to clip the text was off. Solution: Add a slop value to better match Cocoa. BUG=53868 TEST=Repro steps in bug. Review URL: http://codereview.chromium.org/3872004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/gradient_button_cell.mm7
1 files changed, 5 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/gradient_button_cell.mm b/chrome/browser/cocoa/gradient_button_cell.mm
index 4cab381..f6ac577 100644
--- a/chrome/browser/cocoa/gradient_button_cell.mm
+++ b/chrome/browser/cocoa/gradient_button_cell.mm
@@ -641,8 +641,11 @@ static const NSTimeInterval kAnimationContinuousCycleDuration = 0.4;
inView:(NSView *)controlView {
NSSize size = [title size];
- // Don't complicate drawing unless we need to clip
- if (floor(size.width) <= NSWidth(cellFrame)) {
+ // Empirically, Cocoa will draw an extra 2 pixels past NSWidth(cellFrame)
+ // before it clips the text.
+ const CGFloat kOverflowBeforeClip = 2;
+ // Don't complicate drawing unless we need to clip.
+ if (floor(size.width) <= (NSWidth(cellFrame) + kOverflowBeforeClip)) {
return [super drawTitle:title withFrame:cellFrame inView:controlView];
}