+ // When there are multiple tabs, we'll have one active and some inactive
+ // tabs. If the desired width was between the minimum sizes of these types,
+ // try to shrink the tabs with the smaller minimum. For example, if we have
+ // a strip of width 10 with 4 tabs, the desired width per tab will be 2.5.
+ // If selected tabs have a minimum width of 4 and unselected tabs have
+ // minimum width of 1, the above code would set *unselected_width = 2.5,
+ // *selected_width = 4, which results in a total width of 11.5. Instead, we
+ // want to set *unselected_width = 2, *selected_width = 4, for a total width
+ // of 10.
+ if (numberOfNonMiniTabs > 1 && nonMiniTabWidth < kMinActiveTabWidth) {
+ nonMiniTabWidth = (availableSpaceForNonMini - kMinActiveTabWidth) /
+ (numberOfNonMiniTabs - 1) +
+ kTabOverlap;
+ if (nonMiniTabWidth < kMinTabWidth) {
+ // The above adjustment caused the tabs to not fit, show 1 less tab.
+ --numberOfNonMiniTabs;
+ nonMiniTabWidth =
+ ((availableSpaceForNonMini - kTabOverlap) / numberOfNonMiniTabs) +
+ kTabOverlap;
+ }
+ }
+