From 8a09dd59af03959f79a7f87dca6735bef7745170 Mon Sep 17 00:00:00 2001 From: "sky@google.com" Date: Mon, 8 Dec 2008 19:00:24 +0000 Subject: Fixes bug during tab close that results in all tabs after closed tab getting shifted to the left by one pixel. Forcing another layout (by resizing window or such) results in everything fixing itself. When closing a tab we resize the closed tabs width to Tab::GetMinimumUnselectedSize().width(). Subsequent tabs are positioned at width + kTabHOffset. Tab::GetMinimumUnselectedSize().width() is 15, where as kTabHOffset is -16, resulting in all subsequent tabs shifting to the left by 1. You'll have to tell me if this is the right fix. I suspect this could also be fixed by changing Tab::GetMinimumUnselectedSize().width() to be kTabHOffset, but I'm not sure what the effects of that are. We could also enforce next x not shifting back in AnimationLayout BUG=none TEST=create two tabs, select the first and close it. Resize the window a bit and make sure the tab doesn't shift to the right. Review URL: http://codereview.chromium.org/13625 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6525 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/views/tabs/tab_strip.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'chrome') diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index eb344c0..5569de3 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -293,8 +293,11 @@ class RemoveTabAnimation : public TabStrip::TabAnimation { // of the animation. // Removed animated Tabs are never selected. double start_width = start_unselected_width_; + // Make sure target_width is at least abs(kTabHOffset), otherwise if + // less than kTabHOffset during layout tabs get negatively offset. double target_width = - Tab::GetMinimumUnselectedSize().width() + kTabHOffset; + std::max(abs(kTabHOffset), + Tab::GetMinimumUnselectedSize().width() + kTabHOffset); double delta = start_width - target_width; return start_width - (delta * animation_.GetCurrentValue()); } -- cgit v1.1