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

Unified Diff: chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm

Issue 338773002: [Mac] Make app window backgrounds white. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clip the native implementation to only draw the title bar. Created 6 years, 6 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: chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
index a4ad4eabc04d88a0f14caf214ffa876118597cd7..23c9868eed196217fa10cc7af24fd2b26f8fdbef 100644
--- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
@@ -217,6 +217,27 @@ std::vector<gfx::Rect> CalculateNonDraggableRegions(
return YES;
}
+- (void)drawCustomFrameRect:(NSRect)rect forView:(NSView*)view {
+ // Make the background color of the content area white. We can't just call
+ // -setBackgroundColor as that causes the title bar to be drawn in a solid
+ // color.
+ NSRect contentRect = [NSWindow contentRectForFrameRect:rect
tapted 2014/06/17 06:09:51 I think you can use [self contentRectForFrameRect:
jackhou1 2014/06/17 07:00:14 Done.
+ styleMask:[self styleMask]];
+ [[NSColor whiteColor] set];
+ NSRectFill(contentRect);
+
+ // Draw the native title bar. We clip the content area since the native
+ // implementation draws a grey background.
tapted 2014/06/17 06:09:52 nit: grey -> gray to be consistent with color :p
jackhou1 2014/06/17 07:00:14 Done.
+ NSRect titleBarRect = NSIntersectionRect(rect,
+ NSMakeRect(NSMinX(contentRect),
tapted 2014/06/17 06:09:51 I stared at the second argument for a while before
jackhou1 2014/06/17 07:00:14 Done.
+ NSMaxY(contentRect),
+ NSWidth(contentRect),
+ CGFLOAT_MAX));
+ [NSBezierPath clipRect:titleBarRect];
tapted 2014/06/17 06:09:52 It's possible clipping will be more expensive than
+ [super drawCustomFrameRect:rect
+ forView:view];
+}
+
@end
@interface ShellCustomFrameNSWindow : ShellNSWindow {
« 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