diff options
-rw-r--r-- | chrome/browser/cocoa/tab_strip_controller.mm | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm index c6a42f7..73cd85a 100644 --- a/chrome/browser/cocoa/tab_strip_controller.mm +++ b/chrome/browser/cocoa/tab_strip_controller.mm @@ -419,8 +419,10 @@ static const float kUseFullAvailableWidth = -1.0; tabFrame.origin.x = offset; } - // Animate the tab in by putting it below the horizon. - if (newTab && visible && animate) { + // Animate the tab in by putting it below the horizon, but don't bother + // if we only have 1 tab. + BOOL shouldAnimate = animate && [tabContentsArray_ count] > 1; + if (newTab && visible && shouldAnimate) { [[tab view] setFrame:NSOffsetRect(tabFrame, 0, -NSHeight(tabFrame))]; } @@ -449,7 +451,8 @@ static const float kUseFullAvailableWidth = -1.0; } // Hide the new tab button if we're explicitly told to. It may already - // be hidden, doing it again doesn't hurt. + // be hidden, doing it again doesn't hurt. Otherwise position it + // appropriately, showing it if necessary. if (forceNewTabButtonHidden_) { [newTabButton_ setHidden:YES]; } else { @@ -461,10 +464,8 @@ static const float kUseFullAvailableWidth = -1.0; NSMakePoint(MIN(availableWidth, offset + kNewTabButtonOffset), 0); newTabNewFrame.origin.x = MAX(newTabNewFrame.origin.x, NSMaxX(placeholderFrame_)); - if (i > 0 && [newTabButton_ isHidden]) { - id target = animate ? [newTabButton_ animator] : newTabButton_; - [target setHidden:NO]; - } + if ([tabContentsArray_ count]) + [newTabButton_ setHidden:NO]; if (!NSEqualRects(newTabTargetFrame_, newTabNewFrame)) { [newTabButton_ setFrame:newTabNewFrame]; |