OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/tabs/tab_renderer_gtk.h" | 5 #include "chrome/browser/gtk/tabs/tab_renderer_gtk.h" |
6 | 6 |
7 #include "app/gfx/canvas_paint.h" | 7 #include "app/gfx/canvas_paint.h" |
8 #include "app/gfx/favicon_size.h" | 8 #include "app/gfx/favicon_size.h" |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 close_button_bounds_.SetRect(local_bounds.width() + kCloseButtonHorzFuzz, | 495 close_button_bounds_.SetRect(local_bounds.width() + kCloseButtonHorzFuzz, |
496 close_button_top, close_button_width_, | 496 close_button_top, close_button_width_, |
497 close_button_height_); | 497 close_button_height_); |
498 } else { | 498 } else { |
499 close_button_bounds_.SetRect(0, 0, 0, 0); | 499 close_button_bounds_.SetRect(0, 0, 0, 0); |
500 } | 500 } |
501 | 501 |
502 if (!is_pinned() || width() >= kPinnedTabRendererAsTabWidth) { | 502 if (!is_pinned() || width() >= kPinnedTabRendererAsTabWidth) { |
503 // Size the Title text to fill the remaining space. | 503 // Size the Title text to fill the remaining space. |
504 int title_left = favicon_bounds_.right() + kFavIconTitleSpacing; | 504 int title_left = favicon_bounds_.right() + kFavIconTitleSpacing; |
505 int title_top = kTopPadding + (content_height - title_font_height_) / 2; | 505 // Center the mean line of the text in the content area. |
| 506 int title_top = kTopPadding + |
| 507 (content_height - title_font_->baseline()) / 2; |
506 | 508 |
507 // If the user has big fonts, the title will appear rendered too far down | 509 // If the user has big fonts, the title will appear rendered too far down |
508 // on the y-axis if we use the regular top padding, so we need to adjust it | 510 // on the y-axis if we use the regular top padding, so we need to adjust it |
509 // so that the text appears centered. | 511 // so that the text appears centered. |
510 gfx::Size minimum_size = GetMinimumUnselectedSize(); | 512 gfx::Size minimum_size = GetMinimumUnselectedSize(); |
511 int text_height = title_top + title_font_height_ + kBottomPadding; | 513 int text_height = title_top + title_font_height_ + kBottomPadding; |
512 if (text_height > minimum_size.height()) | 514 if (text_height > minimum_size.height()) |
513 title_top -= (text_height - minimum_size.height()) / 2; | 515 title_top -= (text_height - minimum_size.height()) / 2; |
514 | 516 |
515 int title_width; | 517 int title_width; |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 821 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
820 // Force the font size to 8pt. | 822 // Force the font size to 8pt. |
821 gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont); | 823 gfx::Font base_font = rb.GetFont(ResourceBundle::BaseFont); |
822 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 8)); | 824 title_font_ = new gfx::Font(gfx::Font::CreateFont(base_font.FontName(), 8)); |
823 title_font_height_ = title_font_->height(); | 825 title_font_height_ = title_font_->height(); |
824 | 826 |
825 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); | 827 crashed_fav_icon = rb.GetBitmapNamed(IDR_SAD_FAVICON); |
826 | 828 |
827 initialized_ = true; | 829 initialized_ = true; |
828 } | 830 } |
OLD | NEW |