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

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

Issue 2555623002: Last round of cleaning up MD layout constants. (Closed)
Patch Set: pkasting review, remove debug code, rebase Created 4 years 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
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.h ('k') | chrome/browser/ui/views/tabs/tab_strip.cc » ('j') | 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 <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 // static 721 // static
722 gfx::Size Tab::GetMinimumActiveSize() { 722 gfx::Size Tab::GetMinimumActiveSize() {
723 gfx::Size minimum_size = GetMinimumInactiveSize(); 723 gfx::Size minimum_size = GetMinimumInactiveSize();
724 minimum_size.Enlarge(gfx::kFaviconSize, 0); 724 minimum_size.Enlarge(gfx::kFaviconSize, 0);
725 return minimum_size; 725 return minimum_size;
726 } 726 }
727 727
728 // static 728 // static
729 gfx::Size Tab::GetStandardSize() { 729 gfx::Size Tab::GetStandardSize() {
730 const int kNetTabWidth = 193; 730 const int kNetTabWidth = 193;
731 return gfx::Size(kNetTabWidth + GetLayoutConstant(TABSTRIP_TAB_OVERLAP), 731 return gfx::Size(kNetTabWidth + kOverlap, GetMinimumInactiveSize().height());
732 GetMinimumInactiveSize().height());
733 } 732 }
734 733
735 // static 734 // static
736 int Tab::GetTouchWidth() { 735 int Tab::GetTouchWidth() {
737 return kTouchWidth; 736 return kTouchWidth;
738 } 737 }
739 738
740 // static 739 // static
741 int Tab::GetPinnedWidth() { 740 int Tab::GetPinnedWidth() {
742 return GetMinimumInactiveSize().width() + 741 constexpr int kTabPinnedContentWidth = 23;
743 GetLayoutConstant(TAB_PINNED_CONTENT_WIDTH); 742 return GetMinimumInactiveSize().width() + kTabPinnedContentWidth;
744 } 743 }
745 744
746 // static 745 // static
747 int Tab::GetImmersiveHeight() { 746 int Tab::GetImmersiveHeight() {
748 return kImmersiveTabHeight; 747 return kImmersiveTabHeight;
749 } 748 }
750 749
751 // static 750 // static
752 float Tab::GetInverseDiagonalSlope() { 751 float Tab::GetInverseDiagonalSlope() {
753 // This is computed from the border path as follows: 752 // This is computed from the border path as follows:
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 image_size.width(), 911 image_size.width(),
913 image_size.height()); 912 image_size.height());
914 MaybeAdjustLeftForPinnedTab(&bounds); 913 MaybeAdjustLeftForPinnedTab(&bounds);
915 alert_indicator_button_->SetBoundsRect(bounds); 914 alert_indicator_button_->SetBoundsRect(bounds);
916 } 915 }
917 alert_indicator_button_->SetVisible(showing_alert_indicator_); 916 alert_indicator_button_->SetVisible(showing_alert_indicator_);
918 917
919 // Size the title to fill the remaining width and use all available height. 918 // Size the title to fill the remaining width and use all available height.
920 const bool show_title = ShouldRenderAsNormalTab(); 919 const bool show_title = ShouldRenderAsNormalTab();
921 if (show_title) { 920 if (show_title) {
922 const int title_spacing = GetLayoutConstant(TAB_FAVICON_TITLE_SPACING); 921 constexpr int kTitleSpacing = 6;
923 int title_left = showing_icon_ ? 922 int title_left =
924 (favicon_bounds_.right() + title_spacing) : start; 923 showing_icon_ ? (favicon_bounds_.right() + kTitleSpacing) : start;
925 int title_width = lb.right() - title_left; 924 int title_width = lb.right() - title_left;
926 if (showing_alert_indicator_) { 925 if (showing_alert_indicator_) {
927 title_width = 926 title_width =
928 alert_indicator_button_->x() - kAfterTitleSpacing - title_left; 927 alert_indicator_button_->x() - kAfterTitleSpacing - title_left;
929 } else if (showing_close_button_) { 928 } else if (showing_close_button_) {
930 // Allow the title to overlay the close button's empty border padding. 929 // Allow the title to overlay the close button's empty border padding.
931 title_width = close_button_->x() + close_button_->GetInsets().left() - 930 title_width = close_button_->x() + close_button_->GetInsets().left() -
932 kAfterTitleSpacing - title_left; 931 kAfterTitleSpacing - title_left;
933 } 932 }
934 // The Label will automatically center the font's cap height within the 933 // The Label will automatically center the font's cap height within the
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 SchedulePaintInRect(bounds); 1576 SchedulePaintInRect(bounds);
1578 } 1577 }
1579 1578
1580 gfx::Rect Tab::GetImmersiveBarRect() const { 1579 gfx::Rect Tab::GetImmersiveBarRect() const {
1581 // The main bar is as wide as the normal tab's horizontal top line. 1580 // The main bar is as wide as the normal tab's horizontal top line.
1582 gfx::Rect contents = GetContentsBounds(); 1581 gfx::Rect contents = GetContentsBounds();
1583 contents.set_y(0); 1582 contents.set_y(0);
1584 contents.set_height(kImmersiveBarHeight); 1583 contents.set_height(kImmersiveBarHeight);
1585 return contents; 1584 return contents;
1586 } 1585 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.h ('k') | chrome/browser/ui/views/tabs/tab_strip.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698