diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-17 20:05:49 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-17 20:05:49 +0000 |
commit | de0b5e72f4372213803575bfa15806d804a28ec9 (patch) | |
tree | a7aaf1278f271b72fd96b3b2bd04c39295ae53c5 /chrome | |
parent | 86ef1607660b7eb03afa15ea8cc5cfcbfa32ff2b (diff) | |
download | chromium_src-de0b5e72f4372213803575bfa15806d804a28ec9.zip chromium_src-de0b5e72f4372213803575bfa15806d804a28ec9.tar.gz chromium_src-de0b5e72f4372213803575bfa15806d804a28ec9.tar.bz2 |
Changes the width of pinned tabs to be slightly bigger.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/155701
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20985 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/gtk/tabs/tab_renderer_gtk.cc | 25 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/tab_renderer_gtk.h | 9 |
2 files changed, 12 insertions, 22 deletions
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc index 3c5ebd9..66a0a54 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc @@ -30,10 +30,13 @@ const int kFavIconTitleSpacing = 4; const int kTitleCloseButtonSpacing = 5; const int kStandardTitleWidth = 175; const int kDropShadowOffset = 2; -// Value added to pinned_tab_pref_width_ to get -// pinned_tab_renderer_as_tab_width_. See description of -// pinned_tab_renderer_as_tab_width_ for details. -const int kPinnedTabRendererAsNonPinnedWidth = 30; +// Preferred width of pinned tabs. +const int kPinnedTabWidth = 56; +// When a non-pinned tab is pinned the width of the tab animates. If the width +// of a pinned tab is >= kPinnedTabRendererAsTabWidth then the tab is rendered +// as a normal tab. This is done to avoid having the title immediately +// disappear when transitioning a tab from normal to pinned. +const int kPinnedTabRendererAsTabWidth = kPinnedTabWidth + 30; // How long the hover state takes. const int kHoverDurationMs = 90; @@ -104,8 +107,6 @@ int TabRendererGtk::close_button_width_ = 0; int TabRendererGtk::close_button_height_ = 0; SkColor TabRendererGtk::selected_title_color_ = SK_ColorBLACK; SkColor TabRendererGtk::unselected_title_color_ = SkColorSetRGB(64, 64, 64); -int TabRendererGtk::pinned_tab_renderer_as_tab_width_ = 0; -int TabRendererGtk::pinned_tab_pref_width_ = 0; //////////////////////////////////////////////////////////////////////////////// // TabRendererGtk::LoadingAnimation, public: @@ -319,7 +320,7 @@ gfx::Size TabRendererGtk::GetStandardSize() { // static int TabRendererGtk::GetPinnedWidth() { - return pinned_tab_pref_width_; + return kPinnedTabWidth; } // static @@ -351,10 +352,6 @@ void TabRendererGtk::LoadTabImages() { close_button_width_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->width(); close_button_height_ = rb.GetBitmapNamed(IDR_TAB_CLOSE)->height(); - - pinned_tab_pref_width_ = kLeftPadding + kFavIconSize + kRightPadding; - pinned_tab_renderer_as_tab_width_ = pinned_tab_pref_width_ + - kPinnedTabRendererAsNonPinnedWidth; } // static @@ -442,7 +439,7 @@ void TabRendererGtk::Paint(gfx::Canvas* canvas) { Layout(); PaintTabBackground(canvas); - if (!is_pinned() || width() > pinned_tab_renderer_as_tab_width_) + if (!is_pinned() || width() > kPinnedTabRendererAsTabWidth) PaintTitle(canvas); if (show_icon) @@ -478,6 +475,8 @@ void TabRendererGtk::Layout() { int favicon_top = kTopPadding + (content_height - kFavIconSize) / 2; favicon_bounds_.SetRect(local_bounds.x(), favicon_top, kFavIconSize, kFavIconSize); + if (is_pinned() && bounds_.width() < kPinnedTabRendererAsTabWidth) + favicon_bounds_.set_x((bounds_.width() - kFavIconSize) / 2); } else { favicon_bounds_.SetRect(local_bounds.x(), local_bounds.y(), 0, 0); } @@ -495,7 +494,7 @@ void TabRendererGtk::Layout() { close_button_bounds_.SetRect(0, 0, 0, 0); } - if (!is_pinned() || width() >= pinned_tab_renderer_as_tab_width_) { + if (!is_pinned() || width() >= kPinnedTabRendererAsTabWidth) { // Size the Title text to fill the remaining space. int title_left = favicon_bounds_.right() + kFavIconTitleSpacing; int title_top = kTopPadding + (content_height - title_font_height_) / 2; diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/gtk/tabs/tab_renderer_gtk.h index 0168bbe..1e49259 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.h +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.h @@ -295,15 +295,6 @@ class TabRendererGtk : public AnimationDelegate { static SkColor selected_title_color_; static SkColor unselected_title_color_; - // Preferred width of pinned tabs. - static int pinned_tab_pref_width_; - - // When a non-pinned tab is pinned the width of the tab animates. If the - // width of a pinned tab is >= pinned_tab_renderer_as_tab_width then the - // tab is rendered as a normal tab. This is done to avoid having the title - // immediately disappear when transitioning a tab from normal to pinned. - static int pinned_tab_renderer_as_tab_width_; - // The GtkDrawingArea we draw the tab on. OwnedWidgetGtk tab_; |