summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-24 20:49:57 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-24 20:49:57 +0000
commitc815f9751a6b34f41793e185971f38f88a4b4eb8 (patch)
tree8636ec654ccf7bd02011cb7598b75fa27db818a1 /chrome/browser
parent2609bc107a31083c6c88e207d13eaa029d594235 (diff)
downloadchromium_src-c815f9751a6b34f41793e185971f38f88a4b4eb8.zip
chromium_src-c815f9751a6b34f41793e185971f38f88a4b4eb8.tar.gz
chromium_src-c815f9751a6b34f41793e185971f38f88a4b4eb8.tar.bz2
Mac: make pinned tab title change alert more noticeable.
Make the alert glow fade in to look like a selected tab, which should be quite visible on all themes, including the default theme (i.e., no theme). BUG=32791 TEST=Go to <http://www.surflocal.net/Awards/submit/animatedtitle.html>, pin that tab, and create and select a new tab. Watch the pinned tab "glow" in and out quite visibly (but smoothly). Check that it behaves properly when the mouse moves over it. Check with lots of different themes. Review URL: http://codereview.chromium.org/549144 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/cocoa/tab_view.mm40
1 files changed, 20 insertions, 20 deletions
diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm
index 4267b15..d97b6b3 100644
--- a/chrome/browser/cocoa/tab_view.mm
+++ b/chrome/browser/cocoa/tab_view.mm
@@ -648,50 +648,50 @@ const CGFloat kRapidCloseDist = 2.5;
GTMTheme* theme = [self gtm_theme];
- // Setting the pattern phase
+ // Set the pattern phase.
NSPoint phase = [self gtm_themePatternPhase];
[context setPatternPhase:phase];
+ // Don't draw the window/tab bar background when selected, since the tab
+ // background overlay drawn over it (see below) will be fully opaque.
if (!selected) {
NSColor* windowColor =
[theme backgroundPatternColorForStyle:GTMThemeStyleWindow
state:GTMThemeStateActiveWindow];
- if (windowColor) {
- [windowColor set];
- } else {
- [[NSColor windowBackgroundColor] set];
- }
-
+ if (!windowColor)
+ windowColor = [NSColor windowBackgroundColor];
+ [windowColor set];
[path fill];
NSColor* tabColor =
[theme backgroundPatternColorForStyle:GTMThemeStyleTabBarDeselected
state:GTMThemeStateActiveWindow];
- if (tabColor) {
- [tabColor set];
- } else {
- [[NSColor colorWithCalibratedWhite:1.0 alpha:0.3] set];
- }
+ if (!tabColor)
+ tabColor = [NSColor colorWithCalibratedWhite:1.0 alpha:0.3];
+ [tabColor set];
[path fill];
}
[context saveGraphicsState];
[path addClip];
- // Use the same overlay for both hover and alert glows by combining their
- // opacities. Note that h + a - h*a = h + a*(1-h) = a + h*(1-a).
+ // Use the same overlay for the selected state and for hover and alert glows;
+ // for the selected state, it's fully opaque.
CGFloat hoverAlpha = [self hoverAlpha];
CGFloat alertAlpha = [self alertAlpha];
- CGFloat glowAlpha = hoverAlpha + alertAlpha - hoverAlpha * alertAlpha;
- if (selected || glowAlpha > 0) {
- // Draw the background.
- CGFloat backgroundAlpha = glowAlpha * 0.5;
+ if (selected || hoverAlpha > 0 || alertAlpha > 0) {
+ // Draw the selected background / glow overlay.
[context saveGraphicsState];
CGContextRef cgContext =
(CGContextRef)([context graphicsPort]);
CGContextBeginTransparencyLayer(cgContext, 0);
- if (!selected)
+ if (!selected) {
+ // The alert glow overlay is like the selected state but at most at most
+ // 80% opaque. The hover glow brings up the overlay's opacity at most 50%.
+ CGFloat backgroundAlpha = 0.8 * alertAlpha;
+ backgroundAlpha += (1 - backgroundAlpha) * 0.5 * hoverAlpha;
CGContextSetAlpha(cgContext, backgroundAlpha);
+ }
[path addClip];
[context saveGraphicsState];
[super drawBackground];
@@ -728,7 +728,7 @@ const CGFloat kRapidCloseDist = 2.5;
[highlightTransform translateXBy:1 yBy:-1];
scoped_nsobject<NSBezierPath> highlightPath([path copy]);
[highlightPath transformUsingAffineTransform:highlightTransform];
- [[NSColor colorWithCalibratedWhite:1.0 alpha:0.2 + 0.3 * glowAlpha]
+ [[NSColor colorWithCalibratedWhite:1.0 alpha:0.2 + 0.3 * hoverAlpha]
setStroke];
[highlightPath stroke];