Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 464943002: Vertically center excessively tall Views tab titles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698