OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/tabs/tab.h" | 5 #include "chrome/browser/ui/views/tabs/tab.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 if (!data().mini || width() >= kMiniTabRendererAsNormalTabWidth) { | 285 if (!data().mini || width() >= kMiniTabRendererAsNormalTabWidth) { |
286 // If the user has big fonts, the title will appear rendered too far down | 286 // If the user has big fonts, the title will appear rendered too far down |
287 // on the y-axis if we use the regular top padding, so we need to adjust it | 287 // on the y-axis if we use the regular top padding, so we need to adjust it |
288 // so that the text appears centered. | 288 // so that the text appears centered. |
289 gfx::Size minimum_size = GetMinimumUnselectedSize(); | 289 gfx::Size minimum_size = GetMinimumUnselectedSize(); |
290 int text_height = title_top + font_height() + kBottomPadding; | 290 int text_height = title_top + font_height() + kBottomPadding; |
291 if (text_height > minimum_size.height()) | 291 if (text_height > minimum_size.height()) |
292 title_top -= (text_height - minimum_size.height()) / 2; | 292 title_top -= (text_height - minimum_size.height()) / 2; |
293 | 293 |
294 int title_width; | 294 int title_width; |
295 if (close_button()->IsVisible()) { | 295 if (close_button()->visible()) { |
296 title_width = std::max(close_button()->x() - | 296 title_width = std::max(close_button()->x() - |
297 kTitleCloseButtonSpacing - title_left, 0); | 297 kTitleCloseButtonSpacing - title_left, 0); |
298 } else { | 298 } else { |
299 title_width = std::max(lb.width() - title_left, 0); | 299 title_width = std::max(lb.width() - title_left, 0); |
300 } | 300 } |
301 title_bounds_.SetRect(title_left, title_top, title_width, font_height()); | 301 title_bounds_.SetRect(title_left, title_top, title_width, font_height()); |
302 } else { | 302 } else { |
303 title_bounds_.SetRect(title_left, title_top, 0, 0); | 303 title_bounds_.SetRect(title_left, title_top, 0, 0); |
304 } | 304 } |
305 | 305 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); | 677 tab_active_.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); |
678 tab_active_.l_width = tab_active_.image_l->width(); | 678 tab_active_.l_width = tab_active_.image_l->width(); |
679 tab_active_.r_width = tab_active_.image_r->width(); | 679 tab_active_.r_width = tab_active_.image_r->width(); |
680 | 680 |
681 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); | 681 tab_inactive_.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); |
682 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); | 682 tab_inactive_.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); |
683 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); | 683 tab_inactive_.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); |
684 tab_inactive_.l_width = tab_inactive_.image_l->width(); | 684 tab_inactive_.l_width = tab_inactive_.image_l->width(); |
685 tab_inactive_.r_width = tab_inactive_.image_r->width(); | 685 tab_inactive_.r_width = tab_inactive_.image_r->width(); |
686 } | 686 } |
OLD | NEW |