Commit cc246076 authored by erg@chromium.org's avatar erg@chromium.org

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
parent 89f15ec5
...@@ -74,6 +74,12 @@ const int kHoverDurationMs = 90; ...@@ -74,6 +74,12 @@ const int kHoverDurationMs = 90;
// How opaque to make the hover state (out of 1). // How opaque to make the hover state (out of 1).
const double kHoverOpacity = 0.33; 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. // Max opacity for the mini-tab title change animation.
const double kMiniTitleChangeThrobOpacity = 0.75; const double kMiniTitleChangeThrobOpacity = 0.75;
...@@ -945,8 +951,6 @@ void TabRendererGtk::PaintInactiveTabBackground(GtkWidget* widget, ...@@ -945,8 +951,6 @@ void TabRendererGtk::PaintInactiveTabBackground(GtkWidget* widget,
cairo_t* cr) { cairo_t* cr) {
int theme_id = data_.incognito ? int theme_id = data_.incognito ?
IDR_THEME_TAB_BACKGROUND_INCOGNITO : IDR_THEME_TAB_BACKGROUND; IDR_THEME_TAB_BACKGROUND_INCOGNITO : IDR_THEME_TAB_BACKGROUND;
if (IsSelected())
theme_id = IDR_THEME_TAB_BACKGROUND_V;
CairoCachedSurface* tab_bg = CairoCachedSurface* tab_bg =
theme_service_->GetSurfaceNamed(theme_id, widget); theme_service_->GetSurfaceNamed(theme_id, widget);
...@@ -1024,12 +1028,19 @@ CustomDrawButton* TabRendererGtk::MakeCloseButton() { ...@@ -1024,12 +1028,19 @@ CustomDrawButton* TabRendererGtk::MakeCloseButton() {
} }
double TabRendererGtk::GetThrobValue() { 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()) { if (mini_title_animation_.get() && mini_title_animation_->is_animating()) {
return mini_title_animation_->GetCurrentValue() * 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() { void TabRendererGtk::CloseButtonClicked() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment