Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: chrome/browser/ui/cocoa/download/download_show_all_button.mm

Issue 240093006: CoreAnimation: Fix text anti-aliasing in download shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_omnibox_aa
Patch Set: Fix typo Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/download/download_show_all_button.h" 5 #import "chrome/browser/ui/cocoa/download/download_show_all_button.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "chrome/browser/ui/cocoa/download/download_show_all_cell.h" 8 #import "chrome/browser/ui/cocoa/download/download_show_all_cell.h"
9 #import "chrome/browser/ui/cocoa/nsview_additions.h"
10 #import "chrome/browser/ui/cocoa/view_id_util.h"
9 #include "grit/generated_resources.h" 11 #include "grit/generated_resources.h"
10 #include "grit/theme_resources.h" 12 #include "grit/theme_resources.h"
11 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
12 #include "ui/gfx/image/image.h" 14 #include "ui/gfx/image/image.h"
13 15
14 @implementation DownloadShowAllButton 16 @implementation DownloadShowAllButton
15 17
16 - (void)awakeFromNib { 18 - (void)awakeFromNib {
17 DCHECK([[self cell] isKindOfClass:[DownloadShowAllCell class]]); 19 DCHECK([[self cell] isKindOfClass:[DownloadShowAllCell class]]);
18 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 20 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
19 NSImage* favicon = rb.GetNativeImageNamed(IDR_DOWNLOADS_FAVICON).ToNSImage(); 21 NSImage* favicon = rb.GetNativeImageNamed(IDR_DOWNLOADS_FAVICON).ToNSImage();
20 [self setImage:favicon]; 22 [self setImage:favicon];
21 } 23 }
22 24
23 // GTM's layout tweaker calls sizeToFit to receive the desired width of views. 25 // GTM's layout tweaker calls sizeToFit to receive the desired width of views.
24 // By default, buttons will be only 14px high, but the Show All button needs to 26 // By default, buttons will be only 14px high, but the Show All button needs to
25 // be higher. 27 // be higher.
26 - (void)sizeToFit { 28 - (void)sizeToFit {
27 NSRect oldRect = [self frame]; 29 NSRect oldRect = [self frame];
28 [super sizeToFit]; 30 [super sizeToFit];
29 NSRect newRect = [self frame]; 31 NSRect newRect = [self frame];
30 32
31 // Keep old height. 33 // Keep old height.
32 newRect.origin.y = oldRect.origin.y; 34 newRect.origin.y = oldRect.origin.y;
33 newRect.size.height = oldRect.size.height; 35 newRect.size.height = oldRect.size.height;
34 36
35 [self setFrame:newRect]; 37 [self setFrame:newRect];
36 } 38 }
37 39
40 - (BOOL)isOpaque {
41 // Make this control opaque so that sub-pixel anti-aliasing works when
42 // CoreAnimation is enabled.
43 return YES;
44 }
45
46 - (void)drawRect:(NSRect)rect {
47 NSView* downloadShelfView = [self ancestorWithViewID:VIEW_ID_DOWNLOAD_SHELF];
48 [self cr_drawUsingAncestor:downloadShelfView inRect:rect];
49 [super drawRect:rect];
50 }
51
38 @end 52 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_item_button.mm ('k') | chrome/browser/ui/cocoa/view_id_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698