Fixed Bug 578927: Re-order tabs in a group in Tab Candy doesn't reflect on the tab bar
authorRaymond Lee <raymond@appcoast.com>
Fri, 16 Jul 2010 18:00:46 +0800
changeset 50136 a4de92ecd04456dcb1b71f29955eef3cca1f3f7f
parent 50135 c70c8f86bce6164344dbd4afc9528c0b520a4313
child 50137 78590b6c9948184ff98d7b57e90de1ef39fbeada
push id15039
push useredward.lee@engineering.uiuc.edu
push dateThu, 12 Aug 2010 19:47:36 +0000
treeherdermozilla-central@5da28c582cc7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs578927
milestone2.0b2pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Fixed Bug 578927: Re-order tabs in a group in Tab Candy doesn't reflect on the tab bar
browser/base/content/tabcandy/app/groups.js
browser/base/content/tabcandy/app/ui.js
--- a/browser/base/content/tabcandy/app/groups.js
+++ b/browser/base/content/tabcandy/app/groups.js
@@ -1264,17 +1264,16 @@ window.Group.prototype = iQ.extend(new I
       self.expand();
     });
   },
 
   // ----------  
   // Function: setResizable
   // Sets whether the group is resizable and updates the UI accordingly.
   setResizable: function(value){
-
     this.resizeOptions.minWidth = 90;
     this.resizeOptions.minHeight = 90;
 
     if (value) {
       this.$resizer.fadeIn();
       this.resizable(true);
     } else {
       this.$resizer.fadeOut();
--- a/browser/base/content/tabcandy/app/ui.js
+++ b/browser/base/content/tabcandy/app/ui.js
@@ -103,37 +103,43 @@ var Tabbar = {
   showOnlyTheseTabs: function(tabs, options){
     try { 
       if (!options)
         options = {};
           
       var tabbrowser = Utils.getCurrentWindow().gBrowser;
       var tabBarTabs = this.getAllTabs();
       
-      var visibleTabs = [ tab.tab.raw for each ( tab in tabs ) if (tab.tab.tabbrowser == tabbrowser) ];
+      var visibleTabs =
+        [ tab.tab.raw for each ( tab in tabs ) if (tab.tab.tabbrowser == tabbrowser) ];
       
-      // Show all of the tabs in the group and move them (in order)
-      // that they appear in the group to the end of the tab strip.
-      // This way the tab order is matched up to the group's thumbnail
-      // order.      
+      // Show all of the tabs in the group.
       tabBarTabs.forEach(function(tab){
         var collapsed = true;
         visibleTabs.some(function(visibleTab, i) {
           if (visibleTab == tab) {
             collapsed = false;
             // remove the element to speed up the next loop.
-            visibleTabs.splice(i, 1);
-            if (!options.dontReorg) {
-              tabbrowser.moveTabTo(tab, tabBarTabs.length - 1);
-            }
+            if (options.dontReorg)
+              visibleTabs.splice(i, 1);
             return true;
           }
         });
         tab.collapsed = collapsed;
       });
+      
+      // Move them (in order) that they appear in the group to the end of the
+      // tab strip. This way the tab order is matched up to the group's
+      // thumbnail order.
+      if (!options.dontReorg) {
+        visibleTabs.forEach(function(visibleTab) {
+          tabbrowser.moveTabTo(visibleTab, tabBarTabs.length - 1);
+        });
+      }
+
     } catch(e) {
       Utils.log(e);
     }
   },
 
   // ----------
   // Function: showAllTabs
   // Shows all of the tabs in the tab bar.
@@ -611,18 +617,16 @@ window.Page = {
   }
 }
 
 // ##########
 // Class: UIClass
 // Singleton top-level UI manager. TODO: Integrate with <Page>.
 function UIClass() { 
   try {
-    Utils.log('TabCandy init --------------------');
-
     // Variable: navBar
     // A reference to the <Navbar>, for manipulating the browser's nav bar. 
     this.navBar = Navbar;
     
     // Variable: tabBar
     // A reference to the <Tabbar>, for manipulating the browser's tab bar.
     this.tabBar = Tabbar;