Index: chrome/browser/ui/cocoa/tabs/tab_view.mm |
diff --git a/chrome/browser/ui/cocoa/tabs/tab_view.mm b/chrome/browser/ui/cocoa/tabs/tab_view.mm |
index 09733c3a3656b8f6d8bc699f649523d49fbaa1e6..98c3f33fcb3d1911a22c389108943f87c7dec9ee 100644 |
--- a/chrome/browser/ui/cocoa/tabs/tab_view.mm |
+++ b/chrome/browser/ui/cocoa/tabs/tab_view.mm |
@@ -24,7 +24,9 @@ |
@end |
#endif |
-namespace { |
+// When the window doesn't have focus then we want to draw the button with a |
+// slightly lighter color. We do this by just reducing the alpha. |
+const CGFloat kImageNoFocusAlpha = 0.65; |
const int kMaskHeight = 29; // Height of the mask bitmap. |
const int kFillHeight = 25; // Height of the "mask on" part of the mask bitmap. |
@@ -52,8 +54,6 @@ const NSTimeInterval kGlowUpdateInterval = 0.025; |
// has moved less than the threshold, we want to close the tab. |
const CGFloat kRapidCloseDist = 2.5; |
-} // namespace |
- |
@interface TabView(Private) |
- (void)resetLastGlowUpdateTime; |
@@ -327,6 +327,11 @@ const CGFloat kRapidCloseDist = 2.5; |
bool selected = [self state]; |
+ // Background tabs should not paint over the tab strip separator, which is |
+ // two pixels high in both lodpi and hidpi. |
+ if (!selected && dirtyRect.origin.y < 1) |
+ dirtyRect.origin.y = 2 * [self cr_lineWidth]; |
+ |
bool usingDefaultTheme = themeProvider && themeProvider->UsingDefaultTheme(); |
NSColor* backgroundImageColor = [self backgroundColorForSelected:selected]; |
@@ -405,6 +410,9 @@ const CGFloat kRapidCloseDist = 2.5; |
// Draws the tab outline. |
- (void)drawStroke:(NSRect)dirtyRect { |
+ bool focused = [[self window] isKeyWindow] || [[self window] isMainWindow]; |
Robert Sesek
2013/01/07 22:08:04
BOOL
Nico
2013/01/07 22:20:15
DONE
|
+ CGFloat alpha = focused ? 1.0 : kImageNoFocusAlpha; |
+ |
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
float height = |
[rb.GetNativeImageNamed(IDR_TAB_ACTIVE_LEFT).ToNSImage() size].height; |
@@ -415,7 +423,7 @@ const CGFloat kRapidCloseDist = 2.5; |
rb.GetNativeImageNamed(IDR_TAB_ACTIVE_RIGHT).ToNSImage(), |
/*vertical=*/NO, |
NSCompositeSourceOver, |
- 1.0, |
+ alpha, |
Nico
2013/01/07 21:57:21
(I measured that this doesn't regress throbber per
|
/*flipped=*/NO); |
} else { |
NSDrawThreePartImage(NSMakeRect(0, 0, NSWidth([self bounds]), height), |
@@ -424,7 +432,7 @@ const CGFloat kRapidCloseDist = 2.5; |
rb.GetNativeImageNamed(IDR_TAB_INACTIVE_RIGHT).ToNSImage(), |
/*vertical=*/NO, |
NSCompositeSourceOver, |
- 1.0, |
+ alpha, |
/*flipped=*/NO); |
} |
} |