Bug 585785 - Skip the tab closing animation if the tab has the minimal width due to the opening animation not having moved yet. r=gavin a=b
authorDão Gottwald <dao@mozilla.com>
Fri, 22 Oct 2010 08:29:17 +0200
changeset 56357 b6c9c48336131e9d97488e7ef4cd828779da422e
parent 56356 95168409b1e43f2bd72ebfd5a8595e1c002f1979
child 56358 452fa9a39c8f7bc1fe45cd916aa71c75f3028086
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, b
bugs585785
milestone2.0b8pre
first release with
nightly linux32
b6c9c4833613 / 4.0b8pre / 20101022030613 / files
nightly linux64
b6c9c4833613 / 4.0b8pre / 20101022030852 / files
nightly mac
b6c9c4833613 / 4.0b8pre / 20101022030819 / files
nightly win32
b6c9c4833613 / 4.0b8pre / 20101022043027 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 585785 - Skip the tab closing animation if the tab has the minimal width due to the opening animation not having moved yet. r=gavin a=b
browser/base/content/tabbrowser.xml
browser/base/content/test/Makefile.in
browser/base/content/test/browser_bug585785.js
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1361,29 +1361,22 @@
               return;
             }
 
             var isLastTab = (this.tabs.length - this._removingTabs.length == 1);
 
             if (!this._beginRemoveTab(aTab, false, null, true))
               return;
 
-            /* Don't animate if:
-                - the caller didn't opt in
-                - this is the last tab in the window
-                - this is a pinned tab
-                - a bunch of other tabs are already closing (arbitrary threshold)
-                - the fadein attribute hasn't been set yet
-                - browser.tabs.animate is false   */
-
-            if (!animate ||
+            if (!animate /* the caller didn't opt in */ ||
                 isLastTab ||
                 aTab.pinned ||
-                this._removingTabs.length > 3 ||
-                aTab.getAttribute("fadein") != "true" ||
+                this._removingTabs.length > 3 /* don't want lots of concurrent animations */ ||
+                aTab.getAttribute("fadein") != "true" /* fade-in transition hasn't been triggered yet */ ||
+                window.getComputedStyle(aTab).maxWidth == "1px" /* fade-in transition hasn't moved yet */ ||
                 !Services.prefs.getBoolPref("browser.tabs.animate")) {
               this._endRemoveTab(aTab);
               return;
             }
 
             this._blurTab(aTab);
             aTab.removeAttribute("fadein");
           ]]>
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -146,16 +146,17 @@ endif
                  browser_bug562649.js \
                  browser_bug563588.js \
                  browser_bug577121.js \
                  browser_bug579872.js \
                  browser_bug580956.js \
                  browser_bug581242.js \
                  browser_bug581253.js \
                  browser_bug581947.js \
+                 browser_bug585785.js \
                  browser_bug585830.js \
                  browser_bug592338.js \
                  browser_bug594131.js \
                  browser_bug595507.js \
                  browser_bug596687.js \
                  browser_bug597218.js \
                  browser_contextSearchTabPosition.js \
                  browser_ctrlTab.js \
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/browser_bug585785.js
@@ -0,0 +1,9 @@
+function test() {
+  waitForExplicitFinish();
+  var tab = gBrowser.addTab();
+  executeSoon(function () {
+    gBrowser.removeTab(tab, {animate:true});
+    ok(!tab.parentNode, "tab successfully removed");
+    finish();
+  });
+}