Chromium Code Reviews| Index: chrome/browser/ui/cocoa/tabpose_window.mm |
| diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm |
| index fa807305655f45d9f4d291ea961e374f940be6b1..3c32c671e09b2ed36d10bb4f5eca84574bbdefcb 100644 |
| --- a/chrome/browser/ui/cocoa/tabpose_window.mm |
| +++ b/chrome/browser/ui/cocoa/tabpose_window.mm |
| @@ -37,7 +37,7 @@ |
| #include "ui/gfx/image.h" |
| #include "ui/gfx/scoped_cg_context_state_mac.h" |
| -const int kTopGradientHeight = 15; |
| +const int kTopShadowGradientHeight = 15; |
| NSString* const kAnimationIdKey = @"AnimationId"; |
| NSString* const kAnimationIdFadeIn = @"FadeIn"; |
| @@ -62,7 +62,27 @@ const CGFloat kSelectionInset = 5; |
| base::mac::ScopedCFTypeRef<CGGradientRef> gradient( |
| CGGradientCreateWithColorComponents( |
| grayColorSpace.get(), grays, locations, arraysize(locations))); |
| - CGPoint topLeft = CGPointMake(0.0, kTopGradientHeight); |
| + CGPoint topLeft = CGPointMake(0.0, self.bounds.size.height); |
|
viettrungluu
2011/03/08 01:02:32
NSHeight?
|
| + CGContextDrawLinearGradient(context, gradient.get(), topLeft, CGPointZero, 0); |
| +} |
| +@end |
| + |
| +// This is similar to DarkGradientLayer at the moment, but it will probably get |
| +// differently rounded edges, so it's a separate class. |
|
viettrungluu
2011/03/08 01:02:32
Should this be a TODO? Should there be a bug for t
|
| +@interface GrayLayer : CALayer |
| +- (void)drawInContext:(CGContextRef)context; |
| +@end |
| + |
| +@implementation GrayLayer |
| +- (void)drawInContext:(CGContextRef)context { |
| + base::mac::ScopedCFTypeRef<CGColorSpaceRef> grayColorSpace( |
| + CGColorSpaceCreateWithName(kCGColorSpaceGenericGray)); |
| + CGFloat grays[] = { 204/255.0, 0.0, 175/255.0, 0.8 , 145/255.0, 0.8}; |
| + CGFloat locations[] = { 0, 0.5, 1 }; |
| + base::mac::ScopedCFTypeRef<CGGradientRef> gradient( |
| + CGGradientCreateWithColorComponents( |
| + grayColorSpace.get(), grays, locations, arraysize(locations))); |
| + CGPoint topLeft = CGPointMake(0.0, self.bounds.size.height); |
| CGContextDrawLinearGradient(context, gradient.get(), topLeft, CGPointZero, 0); |
| } |
| @end |
| @@ -1133,15 +1153,30 @@ void AnimateCALayerOpacityFromTo( |
| selectionHighlight_.hidden = YES; |
| [bgLayer_ addSublayer:selectionHighlight_]; |
| - // Top gradient. |
| + // Top shadow gradient. Needs to paint below the thumbs, so this can't |
| + // be part of grayLayer. |
| CALayer* gradientLayer = [DarkGradientLayer layer]; |
| gradientLayer.frame = CGRectMake( |
| 0, |
| - NSHeight(containingRect_) - kTopGradientHeight, |
| + NSHeight(containingRect_) - kTopShadowGradientHeight, |
| NSWidth(containingRect_), |
| - kTopGradientHeight); |
| + kTopShadowGradientHeight); |
| [gradientLayer setNeedsDisplay]; // Draw once. |
| [bgLayer_ addSublayer:gradientLayer]; |
| + |
| + // Top gray gradient. |
| + // bgLayer_ has to clip its children (for the thumbs), so this can't be |
| + // a child of bgLayer_. |
| + CGFloat toolbarHeight = |
| + NSHeight([[self contentView] bounds]) - NSHeight(containingRect_); |
| + CALayer* grayLayer = [GrayLayer layer]; |
| + grayLayer.frame = CGRectMake( |
| + 0, |
| + NSHeight([[self contentView] bounds]) - toolbarHeight, |
| + NSWidth(containingRect_), |
| + toolbarHeight); |
| + [grayLayer setNeedsDisplay]; // Draw once. |
| + [rootLayer_ addSublayer:grayLayer]; |
| } |
| // Layers for the tab thumbnails. |