summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-01 00:56:41 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-01 00:56:41 +0000
commitcc246076071afdb254fe97982ee07e7733e88568 (patch)
tree518f1305fbf97112ee80cbbf746fc50be988f4e5
parent89f15ec58f62f57dcbd954361f32af7194481a45 (diff)
downloadchromium_src-cc246076071afdb254fe97982ee07e7733e88568.zip
chromium_src-cc246076071afdb254fe97982ee07e7733e88568.tar.gz
chromium_src-cc246076071afdb254fe97982ee07e7733e88568.tar.bz2
GTK: Make the drawing of selected tabs use the throb value.
Previously, we used a different inactive tab image, but that had the problem that selected background tabs that were showing the throbber would show the normal tab image within the throbber bounds. This makes us match how views renders. BUG=none TEST=Have a non-active, selected tab show the throbber. The area behind the throbber should match the rest of the tab. Review URL: http://codereview.chromium.org/8429012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108049 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc21
1 files changed, 16 insertions, 5 deletions
diff --git a/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc
index 9237d24..2cb8215 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() {