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

Unified Diff: ui/message_center/cocoa/notification_controller.mm

Issue 131453005: Make notification buttons draw a background so text gets subpixel AA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/cocoa/notification_controller.mm
diff --git a/ui/message_center/cocoa/notification_controller.mm b/ui/message_center/cocoa/notification_controller.mm
index 2de141e905a2d84fd59b21b3045138c16247bee3..452842cef1138abad368f2740255808b83b3f22e 100644
--- a/ui/message_center/cocoa/notification_controller.mm
+++ b/ui/message_center/cocoa/notification_controller.mm
@@ -52,13 +52,32 @@
@end
////////////////////////////////////////////////////////////////////////////////
+@interface MCNotificationButton : NSButton
+@end
+
+@implementation MCNotificationButton
+// drawRect: needs to fill the button with a background, otherwise we don't get
+// subpixel antialiasing.
+- (void)drawRect:(NSRect)dirtyRect {
+ NSColor* color = gfx::SkColorToCalibratedNSColor(
+ message_center::kNotificationBackgroundColor);
+ [color set];
+ NSRectFill(dirtyRect);
+ [super drawRect:dirtyRect];
+}
+@end
@interface MCNotificationButtonCell : NSButtonCell {
BOOL hovered_;
}
@end
+////////////////////////////////////////////////////////////////////////////////
@implementation MCNotificationButtonCell
+- (BOOL)isOpaque {
+ return YES;
+}
+
- (void)drawBezelWithFrame:(NSRect)frame inView:(NSView*)controlView {
// Else mouseEntered: and mouseExited: won't be called and hovered_ won't be
// valid.
@@ -486,8 +505,8 @@
NSRect buttonFrame = frame;
buttonFrame.origin = NSMakePoint(0, y);
buttonFrame.size.height = message_center::kButtonHeight;
- base::scoped_nsobject<NSButton> button(
- [[NSButton alloc] initWithFrame:buttonFrame]);
+ base::scoped_nsobject<MCNotificationButton> button(
+ [[MCNotificationButton alloc] initWithFrame:buttonFrame]);
base::scoped_nsobject<MCNotificationButtonCell> cell(
[[MCNotificationButtonCell alloc]
initTextCell:base::SysUTF16ToNSString(buttonInfo.title)]);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698