| Index: ui/message_center/cocoa/opaque_views.mm
|
| diff --git a/ui/message_center/cocoa/opaque_views.mm b/ui/message_center/cocoa/opaque_views.mm
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..907008513f54c27168fdadd772b7c946e334a6c6
|
| --- /dev/null
|
| +++ b/ui/message_center/cocoa/opaque_views.mm
|
| @@ -0,0 +1,63 @@
|
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#import "ui/message_center/cocoa/opaque_views.h"
|
| +
|
| +@implementation MCDropDown
|
| +// The view must be opaque to render subpixel antialiasing.
|
| +- (BOOL)isOpaque {
|
| + return YES;
|
| +}
|
| +
|
| +// The view must also fill its background to render subpixel antialiasing.
|
| +- (void)drawRect:(NSRect)dirtyRect {
|
| + [backgroundColor_ set];
|
| + NSRectFill(dirtyRect);
|
| + [super drawRect:dirtyRect];
|
| +}
|
| +
|
| +- (NSColor*)backgroundColor {
|
| + return backgroundColor_;
|
| +}
|
| +
|
| +- (void)setBackgroundColor:(NSColor*)backgroundColor {
|
| + backgroundColor_.reset([backgroundColor retain]);
|
| +}
|
| +@end
|
| +
|
| +@implementation MCTextField
|
| +- (id)initWithFrame:(NSRect)frameRect andColor:(NSColor*)color {
|
| + self = [self initWithFrame:frameRect];
|
| + if (self) {
|
| + [self setBackgroundColor:color];
|
| + backgroundColor_.reset([color retain]);
|
| + }
|
| + return self;
|
| +}
|
| +
|
| +- (id)initWithFrame:(NSRect)frameRect {
|
| + self = [super initWithFrame:frameRect];
|
| + if (self) {
|
| + [self setAutoresizingMask:NSViewMinYMargin];
|
| + [self setBezeled:NO];
|
| + [self setBordered:NO];
|
| + [self setEditable:NO];
|
| + [self setSelectable:NO];
|
| + [self setDrawsBackground:YES];
|
| + }
|
| + return self;
|
| +}
|
| +
|
| +// The view must be opaque to render subpixel antialiasing.
|
| +- (BOOL)isOpaque {
|
| + return YES;
|
| +}
|
| +
|
| +// The view must also fill its background to render subpixel antialiasing.
|
| +- (void)drawRect:(NSRect)dirtyRect {
|
| + [backgroundColor_ set];
|
| + NSRectFill(dirtyRect);
|
| + [super drawRect:dirtyRect];
|
| +}
|
| +@end
|
|
|