Bug 675481 - Space reserved for expand button should be determined at run-time r=tim
authorRaymond Lee <raymond@raysquare.com>
Mon, 15 Aug 2011 11:21:22 +0800
changeset 75371 6137de4b8036d0602f9dee98d889bb42c163b15d
parent 75370 c762e01dd6dc27a90357a9d6388967d9412c2522
child 75372 85582dd3a1a4fc0c4d5c0dd613fb1a28f10fdf0e
push id21011
push userrcampbell@mozilla.com
push dateTue, 16 Aug 2011 15:35:10 +0000
treeherdermozilla-central@e765c8f565c6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstim
bugs675481
milestone8.0a1
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
Bug 675481 - Space reserved for expand button should be determined at run-time r=tim
browser/base/content/tabview/groupitems.js
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -510,17 +510,17 @@ GroupItem.prototype = Utils.extend(new I
 
     // Make the computed bounds' "padding" and expand button margin actually be
     // themeable --OR-- compute this from actual bounds. Bug 586546
     box.inset(6, 6);
 
     // make some room for the expand button if we're stacked
     let isStacked = (options && options.forceStacked) || this.isStacked();
     if (isStacked)
-      box.height -= 33; // 33px room for the expand button
+      box.height -= this.$expander.height() + 9; // the button height plus padding
 
     return box;
   },
 
   // ----------
   // Function: setBounds
   // Sets the bounds with the given <Rect>, animating unless "immediately" is false.
   //
@@ -1261,17 +1261,16 @@ GroupItem.prototype = Utils.extend(new I
   },
 
   // ----------
   // Function: showExpandControl
   // Show the control which expands a stacked groupItem into a quick-look view.
   showExpandControl: function GroupItem_showExpandControl() {
     let parentBB = this.getBounds();
     let childBB = this.getChild(0).getBounds();
-    let padding = 7;
     this.$expander
         .show()
         .css({
           left: parentBB.width/2 - this.$expander.width()/2
         });
   },
 
   // ----------
@@ -1387,25 +1386,27 @@ GroupItem.prototype = Utils.extend(new I
 
     if (GroupItems._arrangePaused) {
       GroupItems.pushArrange(this, options);
       return false;
     }
     
     let shouldStack = this.shouldStack(childrenToArrange.length + (options.addTab ? 1 : 0));
     let shouldStackArrange = (shouldStack && !this.expanded);
-    let box = this.getContentBounds({forceStacked: shouldStackArrange});
-    
+    let box;
+
     // if we should stack and we're not expanded
     if (shouldStackArrange) {
       this.showExpandControl();
+      box = this.getContentBounds({forceStacked: true});
       this._stackArrange(childrenToArrange, box, options);
       return false;
     } else {
       this.hideExpandControl();
+      box = this.getContentBounds({forceStacked: false});
       // a dropIndex is returned
       return this._gridArrange(childrenToArrange, box, options);
     }
   },
 
   // ----------
   // Function: _stackArrange
   // Arranges the children in a stack.