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

Unified Diff: chrome/browser/cocoa/tab_cell.mm

Issue 151197: Remove 10.6 NSGradient workaround (Closed)
Patch Set: Created 11 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/cocoa/tab_cell.mm
diff --git a/chrome/browser/cocoa/tab_cell.mm b/chrome/browser/cocoa/tab_cell.mm
index a2adf277a6fd213ceafdfbc624ef05d2aea5a777..23719e89aa3fcfb600a6ff167f090922837f01d9 100644
--- a/chrome/browser/cocoa/tab_cell.mm
+++ b/chrome/browser/cocoa/tab_cell.mm
@@ -10,38 +10,6 @@
#define CP1_MULTIPLIER 1.0/3.0
#define CP2_MULTIPLIER 3.0/8.0
-namespace {
- NSGradient *getGradientForStyle(bool selected, bool active) {
- // Workaround for
- // rdar://6857649 - NSGradient fails when using LAB Colorspace
- // Once that's fixed we can remove this function and just call through
- // to -[GTMTheme gradientForStyle:active:] directly with
- // GTMThemeStyleTabBarSelected/GTMThemeStyleTabBarDeselected
- NSUInteger startHighlight, endHighlight;
- if (selected) {
- startHighlight = GTMColorationLightHighlight;
- endHighlight = GTMColorationLightMidtone;
- } else {
- startHighlight = GTMColorationLightShadow;
- endHighlight = GTMColorationLightShadow;
- }
-
- NSColor *backgroundColor = [[GTMTheme defaultTheme] backgroundColor];
- NSColor *startColor = [backgroundColor gtm_colorAdjustedFor:startHighlight
- faded:!active];
- NSColor *endColor = [backgroundColor gtm_colorAdjustedFor:endHighlight
- faded:!active];
- NSColorSpace *genericRGB = [NSColorSpace genericRGBColorSpace];
- startColor = [startColor colorUsingColorSpace:genericRGB];
- endColor = [endColor colorUsingColorSpace:genericRGB];
-
- return [[[NSGradient alloc] initWithStartingColor:startColor
- endingColor:endColor]
- autorelease];
-
- }
-} // namespace
-
@implementation TabCell
- (id)initTextCell:(NSString *)aString {
@@ -107,10 +75,12 @@ namespace {
[path lineToPoint:NSMakePoint(bottomRight.x + 1, bottomRight.y)];
[path lineToPoint:NSMakePoint(bottomRight.x + 1, bottomRight.y + 1)];
+ GTMTheme *theme = [GTMTheme defaultTheme];
NSGradient *gradient = nil;
if (selected) {
- gradient = getGradientForStyle(true, active);
+ gradient = [theme gradientForStyle:GTMThemeStyleTabBarSelected
+ active:active];
// Stroke with a translucent black
[[NSColor colorWithCalibratedWhite:0.0 alpha:active ? 0.5 : 0.3] set];
[[NSGraphicsContext currentContext] saveGraphicsState];
@@ -120,7 +90,8 @@ namespace {
[path fill];
[[NSGraphicsContext currentContext] restoreGraphicsState];
} else {
- gradient = getGradientForStyle(false, active);
+ gradient = [theme gradientForStyle:GTMThemeStyleTabBarDeselected
+ active:active];
// Stroke with a translucent black
[[NSColor colorWithCalibratedWhite:0.0 alpha:active ? 0.3 : 0.1] set];
}
« 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