Commit 04207809 authored by estade@chromium.org's avatar estade@chromium.org

fix position of close buttons in linux tabs

I don't know what has caused the recent regression, but this fixes it. The position of the close button is not consistent between windows and mac, I chose to follow mac.

BUG=none

Review URL: https://codereview.chromium.org/11034002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162306 0039d316-1c4b-4281-b951-d872f2087c98
parent 4e8110d4
...@@ -87,10 +87,8 @@ const double kMiniTitleChangeThrobOpacity = 0.75; ...@@ -87,10 +87,8 @@ const double kMiniTitleChangeThrobOpacity = 0.75;
// Duration for when the title of an inactive mini-tab changes. // Duration for when the title of an inactive mini-tab changes.
const int kMiniTitleChangeThrobDuration = 1000; const int kMiniTitleChangeThrobDuration = 1000;
// The vertical and horizontal offset used to position the close button // The horizontal offset used to position the close button in the tab.
// in the tab. TODO(jhawkins): Ask pkasting what the Fuzz is about. const int kCloseButtonHorzFuzz = 4;
const int kCloseButtonVertFuzz = 0;
const int kCloseButtonHorzFuzz = 5;
// Gets the bounds of |widget| relative to |parent|. // Gets the bounds of |widget| relative to |parent|.
gfx::Rect GetWidgetBoundsRelativeToParent(GtkWidget* parent, gfx::Rect GetWidgetBoundsRelativeToParent(GtkWidget* parent,
...@@ -744,17 +742,19 @@ void TabRendererGtk::Layout() { ...@@ -744,17 +742,19 @@ void TabRendererGtk::Layout() {
// Size the Close button. // Size the Close button.
showing_close_button_ = ShouldShowCloseBox(); showing_close_button_ = ShouldShowCloseBox();
if (showing_close_button_) { if (showing_close_button_) {
int close_button_top = int close_button_top = kTopPadding +
kTopPadding + kCloseButtonVertFuzz +
(content_height - close_button_height_) / 2; (content_height - close_button_height_) / 2;
close_button_bounds_.SetRect(local_bounds.width() + kCloseButtonHorzFuzz, int close_button_left =
close_button_top, close_button_width_, local_bounds.right() - close_button_width_ + kCloseButtonHorzFuzz;
close_button_bounds_.SetRect(close_button_left,
close_button_top,
close_button_width_,
close_button_height_); close_button_height_);
// If the close button color has changed, generate a new one. // If the close button color has changed, generate a new one.
if (theme_service_) { if (theme_service_) {
SkColor tab_text_color = SkColor tab_text_color =
theme_service_->GetColor(ThemeService::COLOR_TAB_TEXT); theme_service_->GetColor(ThemeService::COLOR_TAB_TEXT);
if (!close_button_color_ || tab_text_color != close_button_color_) { if (!close_button_color_ || tab_text_color != close_button_color_) {
close_button_color_ = tab_text_color; close_button_color_ = tab_text_color;
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
...@@ -1014,6 +1014,7 @@ bool TabRendererGtk::ShouldShowCloseBox() const { ...@@ -1014,6 +1014,7 @@ bool TabRendererGtk::ShouldShowCloseBox() const {
CustomDrawButton* TabRendererGtk::MakeCloseButton() { CustomDrawButton* TabRendererGtk::MakeCloseButton() {
CustomDrawButton* button = new CustomDrawButton(IDR_TAB_CLOSE, CustomDrawButton* button = new CustomDrawButton(IDR_TAB_CLOSE,
IDR_TAB_CLOSE_P, IDR_TAB_CLOSE_H, IDR_TAB_CLOSE); IDR_TAB_CLOSE_P, IDR_TAB_CLOSE_H, IDR_TAB_CLOSE);
button->ForceChromeTheme();
g_signal_connect(button->widget(), "clicked", g_signal_connect(button->widget(), "clicked",
G_CALLBACK(OnCloseButtonClickedThunk), this); G_CALLBACK(OnCloseButtonClickedThunk), this);
......
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