Bug 1146249 - Tiles on the newtab page don't wrap properly [r=adw, a=sylvestre]
authorEd Lee <edilee@mozilla.com>
Mon, 23 Mar 2015 01:16:30 -0700
changeset 258198 6892b485a7e0
parent 258197 4afccec73fb9
child 258199 5fd426f495ff
push id4619
push useredilee@gmail.com
push date2015-04-02 05:50 +0000
treeherdermozilla-beta@daf8a9291a9b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, sylvestre
bugs1146249
milestone38.0
Bug 1146249 - Tiles on the newtab page don't wrap properly [r=adw, a=sylvestre] Calculate the appropriate cell width for computing the grid width.
browser/base/content/newtab/grid.js
--- a/browser/base/content/newtab/grid.js
+++ b/browser/base/content/newtab/grid.js
@@ -185,19 +185,19 @@ let gGrid = {
     // Same goes for the grid if that's not ready yet.
     if (!this.isDocumentLoaded || !this._ready) {
       return;
     }
 
     // Save the cell's computed height/width including margin and border
     if (this._cellMargin === undefined) {
       let refCell = document.querySelector(".newtab-cell");
-      this._cellMargin = parseFloat(getComputedStyle(refCell).marginTop) +
+      this._cellMargin = parseFloat(getComputedStyle(refCell).marginTop);
+      this._cellHeight = refCell.offsetHeight + this._cellMargin +
         parseFloat(getComputedStyle(refCell).marginBottom);
-      this._cellHeight = refCell.offsetHeight + this._cellMargin;
       this._cellWidth = refCell.offsetWidth + this._cellMargin;
     }
 
     let availSpace = document.documentElement.clientHeight - this._cellMargin -
                      document.querySelector("#newtab-search-container").offsetHeight;
     let visibleRows = Math.floor(availSpace / this._cellHeight);
     this._node.style.height = this._computeHeight() + "px";
     this._node.style.maxHeight = this._computeHeight(visibleRows) + "px";