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

Unified Diff: ios/chrome/browser/ui/tabs/tab_strip_controller.mm

Issue 2706983002: Make minimum width of tabs dynamic on iOS. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/tabs/tab_strip_controller.mm
diff --git a/ios/chrome/browser/ui/tabs/tab_strip_controller.mm b/ios/chrome/browser/ui/tabs/tab_strip_controller.mm
index 072c4e8a772b97dac3d23bcdb019c19602358b83..a61aff54566a9f9306f4df764e2a066b21dc610d 100644
--- a/ios/chrome/browser/ui/tabs/tab_strip_controller.mm
+++ b/ios/chrome/browser/ui/tabs/tab_strip_controller.mm
@@ -70,6 +70,7 @@ const CGFloat kTabOverlapForCompactLayout = 30.0;
const CGFloat kNewTabOverlap = 8.0;
const CGFloat kMaxTabWidth = 265.0;
+const CGFloat kMaxTabWidthForCompactLayout = 225.0;
// Toggle button dimensions.
const CGFloat kModeToggleButtonWidth = 36.0;
@@ -316,6 +317,9 @@ const CGFloat kNewTabButtonBottomOffsetHighRes = 2.0;
// Returns the tab overlap width depending on the current layout mode.
- (CGFloat)tabOverlap;
+// Returns the maximum tab view width depending on the current layout mode.
+- (CGFloat)maxTabWidth;
+
// Returns the minimum tab view width depending on the current layout mode.
- (CGFloat)minTabWidth;
@@ -1199,7 +1203,7 @@ const CGFloat kNewTabButtonBottomOffsetHighRes = 2.0;
CGFloat visibleSpace = [self tabStripVisibleSpace];
_currentTabWidth =
(visibleSpace + ([self tabOverlap] * (tabCount - 1))) / tabCount;
- _currentTabWidth = MIN(_currentTabWidth, kMaxTabWidth);
+ _currentTabWidth = MIN(_currentTabWidth, [self maxTabWidth]);
_currentTabWidth = MAX(_currentTabWidth, [self minTabWidth]);
// Set the content size to be large enough to contain all the tabs at the
@@ -1259,6 +1263,10 @@ const CGFloat kNewTabButtonBottomOffsetHighRes = 2.0;
return IsCompactTablet() ? kTabOverlapForCompactLayout : kTabOverlap;
}
+- (CGFloat)maxTabWidth {
+ return IsCompactTablet() ? kMaxTabWidthForCompactLayout : kMaxTabWidth;
+}
+
- (CGFloat)minTabWidth {
return IsCompactTablet() ? kMinTabWidthForCompactLayout : kMinTabWidth;
}
« 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