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

Unified Diff: chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc

Issue 8429012: GTK: Make the drawing of selected tabs use the throb value. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: constant nits Created 9 years, 2 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/gtk/tabs/tab_renderer_gtk.cc
diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
index 9237d24f124ff4b07aee33d1d0fe5b5e30067eda..2cb8215fdbc971f2cd625631ed1baea97ee2137e 100644
--- a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
@@ -74,6 +74,12 @@ const int kHoverDurationMs = 90;
// How opaque to make the hover state (out of 1).
const double kHoverOpacity = 0.33;
+// Opacity for non-active selected tabs.
+const double kSelectedTabOpacity = 0.45;
+
+// Selected (but not active) tabs have their throb value scaled down by this.
+const double kSelectedTabThrobScale = 0.5;
+
// Max opacity for the mini-tab title change animation.
const double kMiniTitleChangeThrobOpacity = 0.75;
@@ -945,8 +951,6 @@ void TabRendererGtk::PaintInactiveTabBackground(GtkWidget* widget,
cairo_t* cr) {
int theme_id = data_.incognito ?
IDR_THEME_TAB_BACKGROUND_INCOGNITO : IDR_THEME_TAB_BACKGROUND;
- if (IsSelected())
- theme_id = IDR_THEME_TAB_BACKGROUND_V;
CairoCachedSurface* tab_bg =
theme_service_->GetSurfaceNamed(theme_id, widget);
@@ -1024,12 +1028,19 @@ CustomDrawButton* TabRendererGtk::MakeCloseButton() {
}
double TabRendererGtk::GetThrobValue() {
+ bool is_selected = IsSelected();
+ double min = is_selected ? kSelectedTabOpacity : 0;
+ double scale = is_selected ? kSelectedTabThrobScale : 1;
+
if (mini_title_animation_.get() && mini_title_animation_->is_animating()) {
return mini_title_animation_->GetCurrentValue() *
- kMiniTitleChangeThrobOpacity;
+ kMiniTitleChangeThrobOpacity * scale + min;
}
- return hover_animation_.get() ?
- kHoverOpacity * hover_animation_->GetCurrentValue() : 0;
+
+ if (hover_animation_.get())
+ return kHoverOpacity * hover_animation_->GetCurrentValue() * scale + min;
+
+ return is_selected ? kSelectedTabOpacity : 0;
}
void TabRendererGtk::CloseButtonClicked() {
« 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