Bug 1146249 - Tiles on the newtab page don't wrap properly [r=adw]
authorEd Lee <edilee@mozilla.com>
Mon, 23 Mar 2015 01:16:30 -0700
changeset 236114 8b514f389bf700fd6488469db296b5be70aa7abf
parent 236113 ac13bb5f374caff54cf6f71368232a24141c7e16
child 236115 eda1b8828dfbd8caeafb370bb650d691135524c5
push id57588
push userryanvm@gmail.com
push dateFri, 27 Mar 2015 15:17:31 +0000
treeherdermozilla-inbound@44e454b5e93b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1146249
milestone39.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 1146249 - Tiles on the newtab page don't wrap properly [r=adw] 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";