Chromium Code Reviews| Index: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm |
| diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm |
| index 8b75753a5e6a9f903185f9613587cba16f541642..e6e4e2485db559206caa4d566d393d58eee8633f 100644 |
| --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm |
| +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm |
| @@ -559,6 +559,13 @@ private: |
| return 70.0; |
| } |
| ++ (CGFloat)tabOverlap { |
| + if (!ui::MaterialDesignController::IsModeMaterial()) { |
| + return kTabOverlapNonMD; |
| + } |
| + return kTabOverlap; |
| +} |
| + |
| // Finds the TabContentsController associated with the given index into the tab |
| // model and swaps out the sole child of the contentArea to display its |
| // contents. |
| @@ -912,6 +919,7 @@ private: |
| const CGFloat kMinTabWidth = [TabController minTabWidth]; |
| const CGFloat kMinActiveTabWidth = [TabController minActiveTabWidth]; |
| const CGFloat kPinnedTabWidth = [TabController pinnedTabWidth]; |
| + const CGFloat tabOverlap = [TabStripController tabOverlap]; |
|
Avi (use Gerrit)
2016/05/04 20:57:20
kTabOverlap is taken, but having this be not a k..
shrike
2016/05/04 21:15:20
Yeah, it needs to (sorry, still locking all of our
|
| NSRect enclosingRect = NSZeroRect; |
| ScopedNSAnimationContextGroup mainAnimationGroup(animate); |
| @@ -935,10 +943,10 @@ private: |
| if (!ui::MaterialDesignController::IsModeMaterial()) { |
| availableSpace -= |
| NSWidth([newTabButton_ frame]) + kNewTabButtonOffsetNonMD - |
| - kTabOverlapNonMD; |
| + tabOverlap; |
| } else { |
| availableSpace -= |
| - NSWidth([newTabButton_ frame]) + kNewTabButtonOffset - kTabOverlap; |
| + NSWidth([newTabButton_ frame]) + kNewTabButtonOffset - tabOverlap; |
| } |
| // Account for the right-side controls if not in rapid closure mode. |
| // (In rapid closure mode, the available width is set based on the |
| @@ -956,7 +964,7 @@ private: |
| CGFloat availableSpaceForNonPinned = availableSpace; |
| if ([self numberOfOpenPinnedTabs]) { |
| availableSpaceForNonPinned -= |
| - [self numberOfOpenPinnedTabs] * (kPinnedTabWidth - kTabOverlap); |
| + [self numberOfOpenPinnedTabs] * (kPinnedTabWidth - tabOverlap); |
| availableSpaceForNonPinned -= kLastPinnedTabSpacing; |
| } |
| @@ -966,15 +974,14 @@ private: |
| CGFloat nonPinnedTabWidthFraction = 0; |
| NSInteger numberOfNonPinnedTabs = MIN( |
| [self numberOfOpenNonPinnedTabs], |
| - (availableSpaceForNonPinned - kTabOverlap) / (kMinTabWidth - |
| - kTabOverlap)); |
| + (availableSpaceForNonPinned - tabOverlap) / (kMinTabWidth - tabOverlap)); |
| if (numberOfNonPinnedTabs) { |
| // Find the width of a non-pinned tab. This only applies to horizontal |
| // mode. Add in the amount we "get back" from the tabs overlapping. |
| nonPinnedTabWidth = |
| - ((availableSpaceForNonPinned - kTabOverlap) / numberOfNonPinnedTabs) + |
| - kTabOverlap; |
| + ((availableSpaceForNonPinned - tabOverlap) / numberOfNonPinnedTabs) + |
| + tabOverlap; |
| // Clamp the width between the max and min. |
| nonPinnedTabWidth = MAX(MIN(nonPinnedTabWidth, kMaxTabWidth), kMinTabWidth); |
| @@ -990,14 +997,12 @@ private: |
| // of 10. |
| if (numberOfNonPinnedTabs > 1 && nonPinnedTabWidth < kMinActiveTabWidth) { |
| nonPinnedTabWidth = (availableSpaceForNonPinned - kMinActiveTabWidth) / |
| - (numberOfNonPinnedTabs - 1) + |
| - kTabOverlap; |
| + (numberOfNonPinnedTabs - 1) + tabOverlap; |
| if (nonPinnedTabWidth < kMinTabWidth) { |
| // The above adjustment caused the tabs to not fit, show 1 less tab. |
| --numberOfNonPinnedTabs; |
| - nonPinnedTabWidth = ((availableSpaceForNonPinned - kTabOverlap) / |
| - numberOfNonPinnedTabs) + |
| - kTabOverlap; |
| + nonPinnedTabWidth = ((availableSpaceForNonPinned - tabOverlap) / |
| + numberOfNonPinnedTabs) + tabOverlap; |
| } |
| } |
| @@ -1056,7 +1061,7 @@ private: |
| if (NSMidX(tabFrame) > placeholderMin) { |
| hasPlaceholderGap = true; |
| offset += NSWidth(placeholderFrame_); |
| - offset -= kTabOverlap; |
| + offset -= tabOverlap; |
| tabFrame.origin.x = offset; |
| } |
| } |
| @@ -1144,7 +1149,7 @@ private: |
| enclosingRect = NSUnionRect(tabFrame, enclosingRect); |
| offset += NSWidth(tabFrame); |
| - offset -= kTabOverlap; |
| + offset -= tabOverlap; |
| } |
| // Hide the new tab button if we're explicitly told to. It may already |
| @@ -1157,7 +1162,7 @@ private: |
| // We've already ensured there's enough space for the new tab button |
| // so we don't have to check it against the available space. We do need |
| // to make sure we put it after any placeholder. |
| - CGFloat maxTabX = MAX(offset, NSMaxX(placeholderFrame_) - kTabOverlap); |
| + CGFloat maxTabX = MAX(offset, NSMaxX(placeholderFrame_) - tabOverlap); |
| newTabNewFrame.origin = NSMakePoint(maxTabX + kNewTabButtonOffset, 0); |
| if ([tabContentsArray_ count]) |
| [newTabButton_ setHidden:NO]; |
| @@ -1979,6 +1984,7 @@ private: |
| // to drop on that tab). |
| const double kMiddleProportion = 0.5; |
| const double kLRProportion = (1.0 - kMiddleProportion) / 2.0; |
| + const CGFloat tabOverlap = [TabStripController tabOverlap]; |
| DCHECK(index && disposition); |
| NSInteger i = 0; |
| @@ -1992,8 +1998,8 @@ private: |
| NSRect frame = [view frame]; |
| // Modify the frame to make it "unoverlapped". |
| - frame.origin.x += kTabOverlap / 2.0; |
| - frame.size.width -= kTabOverlap; |
| + frame.origin.x += tabOverlap / 2.0; |
| + frame.size.width -= tabOverlap; |
| if (frame.size.width < 1.0) |
| frame.size.width = 1.0; // try to avoid complete failure |
| @@ -2100,6 +2106,7 @@ private: |
| // The minimum y-coordinate at which one should consider place the arrow. |
| const CGFloat arrowBaseY = 25; |
| + const CGFloat tabOverlap = [TabStripController tabOverlap]; |
| NSInteger index; |
| WindowOpenDisposition disposition; |
| @@ -2113,13 +2120,13 @@ private: |
| DCHECK(disposition == NEW_FOREGROUND_TAB); |
| NSInteger lastIndex = [tabArray_ count] - 1; |
| NSRect overRect = [[[tabArray_ objectAtIndex:lastIndex] view] frame]; |
| - arrowPos.x = overRect.origin.x + overRect.size.width - kTabOverlap / 2.0; |
| + arrowPos.x = overRect.origin.x + overRect.size.width - tabOverlap / 2.0; |
| } else { |
| NSRect overRect = [[[tabArray_ objectAtIndex:index] view] frame]; |
| switch (disposition) { |
| case NEW_FOREGROUND_TAB: |
| // Insert tab (to the left of the given tab). |
| - arrowPos.x = overRect.origin.x + kTabOverlap / 2.0; |
| + arrowPos.x = overRect.origin.x + tabOverlap / 2.0; |
| break; |
| case CURRENT_TAB: |
| // Overwrite the given tab. |