OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 int title_left = favicon_bounds_.right() + kFaviconTitleSpacing; | 791 int title_left = favicon_bounds_.right() + kFaviconTitleSpacing; |
792 int title_width = lb.width() - title_left; | 792 int title_width = lb.width() - title_left; |
793 if (showing_media_indicator_) { | 793 if (showing_media_indicator_) { |
794 title_width = media_indicator_bounds_.x() - kViewSpacing - title_left; | 794 title_width = media_indicator_bounds_.x() - kViewSpacing - title_left; |
795 } else if (close_button_->visible()) { | 795 } else if (close_button_->visible()) { |
796 // Allow the title to overlay the close button's empty border padding. | 796 // Allow the title to overlay the close button's empty border padding. |
797 title_width = close_button_->x() + close_button_->GetInsets().left() - | 797 title_width = close_button_->x() + close_button_->GetInsets().left() - |
798 kViewSpacing - title_left; | 798 kViewSpacing - title_left; |
799 } | 799 } |
800 gfx::Rect rect(title_left, lb.y(), std::max(title_width, 0), lb.height()); | 800 gfx::Rect rect(title_left, lb.y(), std::max(title_width, 0), lb.height()); |
| 801 const int title_height = title_->GetPreferredSize().height(); |
| 802 if (title_height > rect.height()) { |
| 803 rect.set_y(lb.y() - (title_height - rect.height()) / 2); |
| 804 rect.set_height(title_height); |
| 805 } |
801 rect.set_x(GetMirroredXForRect(rect)); | 806 rect.set_x(GetMirroredXForRect(rect)); |
802 title_->SetBoundsRect(rect); | 807 title_->SetBoundsRect(rect); |
803 } | 808 } |
804 title_->SetVisible(show_title); | 809 title_->SetVisible(show_title); |
805 } | 810 } |
806 | 811 |
807 void Tab::OnThemeChanged() { | 812 void Tab::OnThemeChanged() { |
808 LoadTabImages(); | 813 LoadTabImages(); |
809 } | 814 } |
810 | 815 |
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 const gfx::ImageSkia& image) { | 1603 const gfx::ImageSkia& image) { |
1599 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); | 1604 DCHECK_NE(scale_factor, ui::SCALE_FACTOR_NONE); |
1600 ImageCacheEntry entry; | 1605 ImageCacheEntry entry; |
1601 entry.resource_id = resource_id; | 1606 entry.resource_id = resource_id; |
1602 entry.scale_factor = scale_factor; | 1607 entry.scale_factor = scale_factor; |
1603 entry.image = image; | 1608 entry.image = image; |
1604 image_cache_->push_front(entry); | 1609 image_cache_->push_front(entry); |
1605 if (image_cache_->size() > kMaxImageCacheSize) | 1610 if (image_cache_->size() > kMaxImageCacheSize) |
1606 image_cache_->pop_back(); | 1611 image_cache_->pop_back(); |
1607 } | 1612 } |
OLD | NEW |