summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/tab_strip_controller.mm
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 17:13:13 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 17:13:13 +0000
commit89cabc49e14c635d9aae572d34443f3c9c44ffd6 (patch)
tree36f24a9f7b2476344fd91a89826b50d2c22c44f1 /chrome/browser/cocoa/tab_strip_controller.mm
parent1cd878378d4a24acb527f6c7f90e9d130e58955e (diff)
downloadchromium_src-89cabc49e14c635d9aae572d34443f3c9c44ffd6.zip
chromium_src-89cabc49e14c635d9aae572d34443f3c9c44ffd6.tar.gz
chromium_src-89cabc49e14c635d9aae572d34443f3c9c44ffd6.tar.bz2
Restrict use of tab positioning animation on a new tab to when there are more than one tab. Don't use animation on new tab button
BUG=none TEST=NTB shows up correctly and doesn't show during drags. Review URL: http://codereview.chromium.org/174579 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25049 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_strip_controller.mm')
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm15
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];