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

Side by Side Diff: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm

Issue 1946993004: [Mac][Material Design] Fix TabStripController test that fails under MD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" 5 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
6 6
7 #import <QuartzCore/QuartzCore.h> 7 #import <QuartzCore/QuartzCore.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 #include <limits> 10 #include <limits>
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 + (CGFloat)defaultTabHeight { 552 + (CGFloat)defaultTabHeight {
553 return [TabController defaultTabHeight]; 553 return [TabController defaultTabHeight];
554 } 554 }
555 555
556 + (CGFloat)defaultLeftIndentForControls { 556 + (CGFloat)defaultLeftIndentForControls {
557 // Default indentation leaves enough room so tabs don't overlap with the 557 // Default indentation leaves enough room so tabs don't overlap with the
558 // window controls. 558 // window controls.
559 return 70.0; 559 return 70.0;
560 } 560 }
561 561
562 + (CGFloat)tabOverlap {
563 if (!ui::MaterialDesignController::IsModeMaterial()) {
564 return kTabOverlapNonMD;
565 }
566 return kTabOverlap;
567 }
568
562 // Finds the TabContentsController associated with the given index into the tab 569 // Finds the TabContentsController associated with the given index into the tab
563 // model and swaps out the sole child of the contentArea to display its 570 // model and swaps out the sole child of the contentArea to display its
564 // contents. 571 // contents.
565 - (void)swapInTabAtIndex:(NSInteger)modelIndex { 572 - (void)swapInTabAtIndex:(NSInteger)modelIndex {
566 DCHECK(modelIndex >= 0 && modelIndex < tabStripModel_->count()); 573 DCHECK(modelIndex >= 0 && modelIndex < tabStripModel_->count());
567 NSInteger index = [self indexFromModelIndex:modelIndex]; 574 NSInteger index = [self indexFromModelIndex:modelIndex];
568 TabContentsController* controller = [tabContentsArray_ objectAtIndex:index]; 575 TabContentsController* controller = [tabContentsArray_ objectAtIndex:index];
569 576
570 // Make sure we do not draw any transient arrangements of views. 577 // Make sure we do not draw any transient arrangements of views.
571 gfx::ScopedCocoaDisableScreenUpdates cocoa_disabler; 578 gfx::ScopedCocoaDisableScreenUpdates cocoa_disabler;
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 - (void)layoutTabsWithAnimation:(BOOL)animate 912 - (void)layoutTabsWithAnimation:(BOOL)animate
906 regenerateSubviews:(BOOL)doUpdate { 913 regenerateSubviews:(BOOL)doUpdate {
907 DCHECK([NSThread isMainThread]); 914 DCHECK([NSThread isMainThread]);
908 if (![tabArray_ count]) 915 if (![tabArray_ count])
909 return; 916 return;
910 917
911 const CGFloat kMaxTabWidth = [TabController maxTabWidth]; 918 const CGFloat kMaxTabWidth = [TabController maxTabWidth];
912 const CGFloat kMinTabWidth = [TabController minTabWidth]; 919 const CGFloat kMinTabWidth = [TabController minTabWidth];
913 const CGFloat kMinActiveTabWidth = [TabController minActiveTabWidth]; 920 const CGFloat kMinActiveTabWidth = [TabController minActiveTabWidth];
914 const CGFloat kPinnedTabWidth = [TabController pinnedTabWidth]; 921 const CGFloat kPinnedTabWidth = [TabController pinnedTabWidth];
922 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
915 923
916 NSRect enclosingRect = NSZeroRect; 924 NSRect enclosingRect = NSZeroRect;
917 ScopedNSAnimationContextGroup mainAnimationGroup(animate); 925 ScopedNSAnimationContextGroup mainAnimationGroup(animate);
918 mainAnimationGroup.SetCurrentContextDuration(kAnimationDuration); 926 mainAnimationGroup.SetCurrentContextDuration(kAnimationDuration);
919 927
920 // Update the current subviews and their z-order if requested. 928 // Update the current subviews and their z-order if requested.
921 if (doUpdate) 929 if (doUpdate)
922 [self regenerateSubviewList]; 930 [self regenerateSubviewList];
923 931
924 // Compute the base width of tabs given how much room we're allowed. Note that 932 // Compute the base width of tabs given how much room we're allowed. Note that
925 // pinned tabs have a fixed width. We may not be able to use the entire width 933 // pinned tabs have a fixed width. We may not be able to use the entire width
926 // if the user is quickly closing tabs. This may be negative, but that's okay 934 // if the user is quickly closing tabs. This may be negative, but that's okay
927 // (taken care of by |MAX()| when calculating tab sizes). 935 // (taken care of by |MAX()| when calculating tab sizes).
928 CGFloat availableSpace = 0; 936 CGFloat availableSpace = 0;
929 if ([self inRapidClosureMode]) { 937 if ([self inRapidClosureMode]) {
930 availableSpace = availableResizeWidth_; 938 availableSpace = availableResizeWidth_;
931 } else { 939 } else {
932 availableSpace = NSWidth([tabStripView_ frame]); 940 availableSpace = NSWidth([tabStripView_ frame]);
933 941
934 // Account for the width of the new tab button. 942 // Account for the width of the new tab button.
935 if (!ui::MaterialDesignController::IsModeMaterial()) { 943 if (!ui::MaterialDesignController::IsModeMaterial()) {
936 availableSpace -= 944 availableSpace -=
937 NSWidth([newTabButton_ frame]) + kNewTabButtonOffsetNonMD - 945 NSWidth([newTabButton_ frame]) + kNewTabButtonOffsetNonMD -
938 kTabOverlapNonMD; 946 tabOverlap;
939 } else { 947 } else {
940 availableSpace -= 948 availableSpace -=
941 NSWidth([newTabButton_ frame]) + kNewTabButtonOffset - kTabOverlap; 949 NSWidth([newTabButton_ frame]) + kNewTabButtonOffset - tabOverlap;
942 } 950 }
943 // Account for the right-side controls if not in rapid closure mode. 951 // Account for the right-side controls if not in rapid closure mode.
944 // (In rapid closure mode, the available width is set based on the 952 // (In rapid closure mode, the available width is set based on the
945 // position of the rightmost tab, not based on the width of the tab strip, 953 // position of the rightmost tab, not based on the width of the tab strip,
946 // so the right controls have already been accounted for.) 954 // so the right controls have already been accounted for.)
947 availableSpace -= [self rightIndentForControls]; 955 availableSpace -= [self rightIndentForControls];
948 } 956 }
949 957
950 // Need to leave room for the left-side controls even in rapid closure mode. 958 // Need to leave room for the left-side controls even in rapid closure mode.
951 availableSpace -= [self leftIndentForControls]; 959 availableSpace -= [self leftIndentForControls];
952 960
953 // This may be negative, but that's okay (taken care of by |MAX()| when 961 // This may be negative, but that's okay (taken care of by |MAX()| when
954 // calculating tab sizes). "pinned" tabs in horizontal mode just get a special 962 // calculating tab sizes). "pinned" tabs in horizontal mode just get a special
955 // section, they don't change size. 963 // section, they don't change size.
956 CGFloat availableSpaceForNonPinned = availableSpace; 964 CGFloat availableSpaceForNonPinned = availableSpace;
957 if ([self numberOfOpenPinnedTabs]) { 965 if ([self numberOfOpenPinnedTabs]) {
958 availableSpaceForNonPinned -= 966 availableSpaceForNonPinned -=
959 [self numberOfOpenPinnedTabs] * (kPinnedTabWidth - kTabOverlap); 967 [self numberOfOpenPinnedTabs] * (kPinnedTabWidth - tabOverlap);
960 availableSpaceForNonPinned -= kLastPinnedTabSpacing; 968 availableSpaceForNonPinned -= kLastPinnedTabSpacing;
961 } 969 }
962 970
963 // Initialize |nonPinnedTabWidth| in case there aren't any non-pinned tabs; 971 // Initialize |nonPinnedTabWidth| in case there aren't any non-pinned tabs;
964 // this value shouldn't actually be used. 972 // this value shouldn't actually be used.
965 CGFloat nonPinnedTabWidth = kMaxTabWidth; 973 CGFloat nonPinnedTabWidth = kMaxTabWidth;
966 CGFloat nonPinnedTabWidthFraction = 0; 974 CGFloat nonPinnedTabWidthFraction = 0;
967 NSInteger numberOfNonPinnedTabs = MIN( 975 NSInteger numberOfNonPinnedTabs = MIN(
968 [self numberOfOpenNonPinnedTabs], 976 [self numberOfOpenNonPinnedTabs],
969 (availableSpaceForNonPinned - kTabOverlap) / (kMinTabWidth - 977 (availableSpaceForNonPinned - tabOverlap) / (kMinTabWidth - tabOverlap));
970 kTabOverlap));
971 978
972 if (numberOfNonPinnedTabs) { 979 if (numberOfNonPinnedTabs) {
973 // Find the width of a non-pinned tab. This only applies to horizontal 980 // Find the width of a non-pinned tab. This only applies to horizontal
974 // mode. Add in the amount we "get back" from the tabs overlapping. 981 // mode. Add in the amount we "get back" from the tabs overlapping.
975 nonPinnedTabWidth = 982 nonPinnedTabWidth =
976 ((availableSpaceForNonPinned - kTabOverlap) / numberOfNonPinnedTabs) + 983 ((availableSpaceForNonPinned - tabOverlap) / numberOfNonPinnedTabs) +
977 kTabOverlap; 984 tabOverlap;
978 985
979 // Clamp the width between the max and min. 986 // Clamp the width between the max and min.
980 nonPinnedTabWidth = MAX(MIN(nonPinnedTabWidth, kMaxTabWidth), kMinTabWidth); 987 nonPinnedTabWidth = MAX(MIN(nonPinnedTabWidth, kMaxTabWidth), kMinTabWidth);
981 988
982 // When there are multiple tabs, we'll have one active and some inactive 989 // When there are multiple tabs, we'll have one active and some inactive
983 // tabs. If the desired width was between the minimum sizes of these types, 990 // tabs. If the desired width was between the minimum sizes of these types,
984 // try to shrink the tabs with the smaller minimum. For example, if we have 991 // try to shrink the tabs with the smaller minimum. For example, if we have
985 // a strip of width 10 with 4 tabs, the desired width per tab will be 2.5. 992 // a strip of width 10 with 4 tabs, the desired width per tab will be 2.5.
986 // If selected tabs have a minimum width of 4 and unselected tabs have 993 // If selected tabs have a minimum width of 4 and unselected tabs have
987 // minimum width of 1, the above code would set *unselected_width = 2.5, 994 // minimum width of 1, the above code would set *unselected_width = 2.5,
988 // *selected_width = 4, which results in a total width of 11.5. Instead, we 995 // *selected_width = 4, which results in a total width of 11.5. Instead, we
989 // want to set *unselected_width = 2, *selected_width = 4, for a total width 996 // want to set *unselected_width = 2, *selected_width = 4, for a total width
990 // of 10. 997 // of 10.
991 if (numberOfNonPinnedTabs > 1 && nonPinnedTabWidth < kMinActiveTabWidth) { 998 if (numberOfNonPinnedTabs > 1 && nonPinnedTabWidth < kMinActiveTabWidth) {
992 nonPinnedTabWidth = (availableSpaceForNonPinned - kMinActiveTabWidth) / 999 nonPinnedTabWidth = (availableSpaceForNonPinned - kMinActiveTabWidth) /
993 (numberOfNonPinnedTabs - 1) + 1000 (numberOfNonPinnedTabs - 1) + tabOverlap;
994 kTabOverlap;
995 if (nonPinnedTabWidth < kMinTabWidth) { 1001 if (nonPinnedTabWidth < kMinTabWidth) {
996 // The above adjustment caused the tabs to not fit, show 1 less tab. 1002 // The above adjustment caused the tabs to not fit, show 1 less tab.
997 --numberOfNonPinnedTabs; 1003 --numberOfNonPinnedTabs;
998 nonPinnedTabWidth = ((availableSpaceForNonPinned - kTabOverlap) / 1004 nonPinnedTabWidth = ((availableSpaceForNonPinned - tabOverlap) /
999 numberOfNonPinnedTabs) + 1005 numberOfNonPinnedTabs) + tabOverlap;
1000 kTabOverlap;
1001 } 1006 }
1002 } 1007 }
1003 1008
1004 // Separate integral and fractional parts. 1009 // Separate integral and fractional parts.
1005 CGFloat integralPart = std::floor(nonPinnedTabWidth); 1010 CGFloat integralPart = std::floor(nonPinnedTabWidth);
1006 nonPinnedTabWidthFraction = nonPinnedTabWidth - integralPart; 1011 nonPinnedTabWidthFraction = nonPinnedTabWidth - integralPart;
1007 nonPinnedTabWidth = integralPart; 1012 nonPinnedTabWidth = integralPart;
1008 } 1013 }
1009 1014
1010 BOOL visible = [[tabStripView_ window] isVisible]; 1015 BOOL visible = [[tabStripView_ window] isVisible];
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 continue; 1054 continue;
1050 } 1055 }
1051 1056
1052 if (placeholderTab_ && !hasPlaceholderGap) { 1057 if (placeholderTab_ && !hasPlaceholderGap) {
1053 const CGFloat placeholderMin = NSMinX(placeholderFrame_); 1058 const CGFloat placeholderMin = NSMinX(placeholderFrame_);
1054 // If the left edge is to the left of the placeholder's left, but the 1059 // If the left edge is to the left of the placeholder's left, but the
1055 // mid is to the right of it slide over to make space for it. 1060 // mid is to the right of it slide over to make space for it.
1056 if (NSMidX(tabFrame) > placeholderMin) { 1061 if (NSMidX(tabFrame) > placeholderMin) {
1057 hasPlaceholderGap = true; 1062 hasPlaceholderGap = true;
1058 offset += NSWidth(placeholderFrame_); 1063 offset += NSWidth(placeholderFrame_);
1059 offset -= kTabOverlap; 1064 offset -= tabOverlap;
1060 tabFrame.origin.x = offset; 1065 tabFrame.origin.x = offset;
1061 } 1066 }
1062 } 1067 }
1063 1068
1064 // Set the width. Selected tabs are slightly wider when things get really 1069 // Set the width. Selected tabs are slightly wider when things get really
1065 // small and thus we enforce a different minimum width. 1070 // small and thus we enforce a different minimum width.
1066 BOOL isPinned = [tab pinned]; 1071 BOOL isPinned = [tab pinned];
1067 if (isPinned) { 1072 if (isPinned) {
1068 tabFrame.size.width = kPinnedTabWidth; 1073 tabFrame.size.width = kPinnedTabWidth;
1069 } else { 1074 } else {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 }]; 1142 }];
1138 1143
1139 [frameTarget setFrame:tabFrame]; 1144 [frameTarget setFrame:tabFrame];
1140 [targetFrames_ setObject:[NSValue valueWithRect:tabFrame] 1145 [targetFrames_ setObject:[NSValue valueWithRect:tabFrame]
1141 forKey:identifier]; 1146 forKey:identifier];
1142 } 1147 }
1143 1148
1144 enclosingRect = NSUnionRect(tabFrame, enclosingRect); 1149 enclosingRect = NSUnionRect(tabFrame, enclosingRect);
1145 1150
1146 offset += NSWidth(tabFrame); 1151 offset += NSWidth(tabFrame);
1147 offset -= kTabOverlap; 1152 offset -= tabOverlap;
1148 } 1153 }
1149 1154
1150 // Hide the new tab button if we're explicitly told to. It may already 1155 // Hide the new tab button if we're explicitly told to. It may already
1151 // be hidden, doing it again doesn't hurt. Otherwise position it 1156 // be hidden, doing it again doesn't hurt. Otherwise position it
1152 // appropriately, showing it if necessary. 1157 // appropriately, showing it if necessary.
1153 if (forceNewTabButtonHidden_) { 1158 if (forceNewTabButtonHidden_) {
1154 [newTabButton_ setHidden:YES]; 1159 [newTabButton_ setHidden:YES];
1155 } else { 1160 } else {
1156 NSRect newTabNewFrame = [newTabButton_ frame]; 1161 NSRect newTabNewFrame = [newTabButton_ frame];
1157 // We've already ensured there's enough space for the new tab button 1162 // We've already ensured there's enough space for the new tab button
1158 // so we don't have to check it against the available space. We do need 1163 // so we don't have to check it against the available space. We do need
1159 // to make sure we put it after any placeholder. 1164 // to make sure we put it after any placeholder.
1160 CGFloat maxTabX = MAX(offset, NSMaxX(placeholderFrame_) - kTabOverlap); 1165 CGFloat maxTabX = MAX(offset, NSMaxX(placeholderFrame_) - tabOverlap);
1161 newTabNewFrame.origin = NSMakePoint(maxTabX + kNewTabButtonOffset, 0); 1166 newTabNewFrame.origin = NSMakePoint(maxTabX + kNewTabButtonOffset, 0);
1162 if ([tabContentsArray_ count]) 1167 if ([tabContentsArray_ count])
1163 [newTabButton_ setHidden:NO]; 1168 [newTabButton_ setHidden:NO];
1164 1169
1165 if (!NSEqualRects(newTabTargetFrame_, newTabNewFrame)) { 1170 if (!NSEqualRects(newTabTargetFrame_, newTabNewFrame)) {
1166 // Set the new tab button image correctly based on where the cursor is. 1171 // Set the new tab button image correctly based on where the cursor is.
1167 NSWindow* window = [tabStripView_ window]; 1172 NSWindow* window = [tabStripView_ window];
1168 NSPoint currentMouse = [window mouseLocationOutsideOfEventStream]; 1173 NSPoint currentMouse = [window mouseLocationOutsideOfEventStream];
1169 currentMouse = [tabStripView_ convertPoint:currentMouse fromView:nil]; 1174 currentMouse = [tabStripView_ convertPoint:currentMouse fromView:nil];
1170 1175
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
1972 // the |TabStripView|'s coordinates). It considers only the x-coordinate of the 1977 // the |TabStripView|'s coordinates). It considers only the x-coordinate of the
1973 // given point. If it's in the "middle" of a tab, it drops on that tab. If it's 1978 // given point. If it's in the "middle" of a tab, it drops on that tab. If it's
1974 // to the left, it inserts to the left, and similarly for the right. 1979 // to the left, it inserts to the left, and similarly for the right.
1975 - (void)droppingURLsAt:(NSPoint)point 1980 - (void)droppingURLsAt:(NSPoint)point
1976 givesIndex:(NSInteger*)index 1981 givesIndex:(NSInteger*)index
1977 disposition:(WindowOpenDisposition*)disposition { 1982 disposition:(WindowOpenDisposition*)disposition {
1978 // Proportion of the tab which is considered the "middle" (and causes things 1983 // Proportion of the tab which is considered the "middle" (and causes things
1979 // to drop on that tab). 1984 // to drop on that tab).
1980 const double kMiddleProportion = 0.5; 1985 const double kMiddleProportion = 0.5;
1981 const double kLRProportion = (1.0 - kMiddleProportion) / 2.0; 1986 const double kLRProportion = (1.0 - kMiddleProportion) / 2.0;
1987 const CGFloat tabOverlap = [TabStripController tabOverlap];
1982 1988
1983 DCHECK(index && disposition); 1989 DCHECK(index && disposition);
1984 NSInteger i = 0; 1990 NSInteger i = 0;
1985 for (TabController* tab in tabArray_.get()) { 1991 for (TabController* tab in tabArray_.get()) {
1986 NSView* view = [tab view]; 1992 NSView* view = [tab view];
1987 DCHECK([view isKindOfClass:[TabView class]]); 1993 DCHECK([view isKindOfClass:[TabView class]]);
1988 1994
1989 // Recall that |-[NSView frame]| is in its superview's coordinates, so a 1995 // Recall that |-[NSView frame]| is in its superview's coordinates, so a
1990 // |TabView|'s frame is in the coordinates of the |TabStripView| (which 1996 // |TabView|'s frame is in the coordinates of the |TabStripView| (which
1991 // matches the coordinate system of |point|). 1997 // matches the coordinate system of |point|).
1992 NSRect frame = [view frame]; 1998 NSRect frame = [view frame];
1993 1999
1994 // Modify the frame to make it "unoverlapped". 2000 // Modify the frame to make it "unoverlapped".
1995 frame.origin.x += kTabOverlap / 2.0; 2001 frame.origin.x += tabOverlap / 2.0;
1996 frame.size.width -= kTabOverlap; 2002 frame.size.width -= tabOverlap;
1997 if (frame.size.width < 1.0) 2003 if (frame.size.width < 1.0)
1998 frame.size.width = 1.0; // try to avoid complete failure 2004 frame.size.width = 1.0; // try to avoid complete failure
1999 2005
2000 // Drop in a new tab to the left of tab |i|? 2006 // Drop in a new tab to the left of tab |i|?
2001 if (point.x < (frame.origin.x + kLRProportion * frame.size.width)) { 2007 if (point.x < (frame.origin.x + kLRProportion * frame.size.width)) {
2002 *index = i; 2008 *index = i;
2003 *disposition = NEW_FOREGROUND_TAB; 2009 *disposition = NEW_FOREGROUND_TAB;
2004 return; 2010 return;
2005 } 2011 }
2006 2012
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 2099
2094 [self openURL:&url inView:view at:point]; 2100 [self openURL:&url inView:view at:point];
2095 } 2101 }
2096 2102
2097 // (URLDropTargetController protocol) 2103 // (URLDropTargetController protocol)
2098 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { 2104 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point {
2099 DCHECK_EQ(view, tabStripView_.get()); 2105 DCHECK_EQ(view, tabStripView_.get());
2100 2106
2101 // The minimum y-coordinate at which one should consider place the arrow. 2107 // The minimum y-coordinate at which one should consider place the arrow.
2102 const CGFloat arrowBaseY = 25; 2108 const CGFloat arrowBaseY = 25;
2109 const CGFloat tabOverlap = [TabStripController tabOverlap];
2103 2110
2104 NSInteger index; 2111 NSInteger index;
2105 WindowOpenDisposition disposition; 2112 WindowOpenDisposition disposition;
2106 [self droppingURLsAt:point 2113 [self droppingURLsAt:point
2107 givesIndex:&index 2114 givesIndex:&index
2108 disposition:&disposition]; 2115 disposition:&disposition];
2109 2116
2110 NSPoint arrowPos = NSMakePoint(0, arrowBaseY); 2117 NSPoint arrowPos = NSMakePoint(0, arrowBaseY);
2111 if (index == -1) { 2118 if (index == -1) {
2112 // Append a tab at the end. 2119 // Append a tab at the end.
2113 DCHECK(disposition == NEW_FOREGROUND_TAB); 2120 DCHECK(disposition == NEW_FOREGROUND_TAB);
2114 NSInteger lastIndex = [tabArray_ count] - 1; 2121 NSInteger lastIndex = [tabArray_ count] - 1;
2115 NSRect overRect = [[[tabArray_ objectAtIndex:lastIndex] view] frame]; 2122 NSRect overRect = [[[tabArray_ objectAtIndex:lastIndex] view] frame];
2116 arrowPos.x = overRect.origin.x + overRect.size.width - kTabOverlap / 2.0; 2123 arrowPos.x = overRect.origin.x + overRect.size.width - tabOverlap / 2.0;
2117 } else { 2124 } else {
2118 NSRect overRect = [[[tabArray_ objectAtIndex:index] view] frame]; 2125 NSRect overRect = [[[tabArray_ objectAtIndex:index] view] frame];
2119 switch (disposition) { 2126 switch (disposition) {
2120 case NEW_FOREGROUND_TAB: 2127 case NEW_FOREGROUND_TAB:
2121 // Insert tab (to the left of the given tab). 2128 // Insert tab (to the left of the given tab).
2122 arrowPos.x = overRect.origin.x + kTabOverlap / 2.0; 2129 arrowPos.x = overRect.origin.x + tabOverlap / 2.0;
2123 break; 2130 break;
2124 case CURRENT_TAB: 2131 case CURRENT_TAB:
2125 // Overwrite the given tab. 2132 // Overwrite the given tab.
2126 arrowPos.x = overRect.origin.x + overRect.size.width / 2.0; 2133 arrowPos.x = overRect.origin.x + overRect.size.width / 2.0;
2127 break; 2134 break;
2128 default: 2135 default:
2129 NOTREACHED(); 2136 NOTREACHED();
2130 } 2137 }
2131 } 2138 }
2132 2139
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2289 2296
2290 - (TabAlertState)alertStateForContents:(content::WebContents*)contents { 2297 - (TabAlertState)alertStateForContents:(content::WebContents*)contents {
2291 return chrome::GetTabAlertStateForContents(contents); 2298 return chrome::GetTabAlertStateForContents(contents);
2292 } 2299 }
2293 2300
2294 - (void)themeDidChangeNotification:(NSNotification*)notification { 2301 - (void)themeDidChangeNotification:(NSNotification*)notification {
2295 [newTabButton_ setImages]; 2302 [newTabButton_ setImages];
2296 } 2303 }
2297 2304
2298 @end 2305 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/tabs/tab_strip_controller.h ('k') | chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698