Bug 1112556 - Ctrl-Tab previews are oversized with a small number of tabs open. r=dao
☠☠ backed out by 803bc910c45a ☠ ☠
authorabdelrhman <codo.abdo@gmail.com>
Thu, 18 Dec 2014 19:38:58 +0100
changeset 246205 08d1470a4042964793d541dd3fc0a0264fec60ec
parent 246204 83689aa1a00fadd691f40fd999b3ce16304b2af8
child 246206 01f50f0fbda6913faa54628b7d8040b2c9a84503
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1112556
milestone37.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 1112556 - Ctrl-Tab previews are oversized with a small number of tabs open. r=dao
browser/base/content/browser-ctrlTab.js
--- a/browser/base/content/browser-ctrlTab.js
+++ b/browser/base/content/browser-ctrlTab.js
@@ -156,35 +156,45 @@ var ctrlTab = {
   get showAllButton () {
     delete this.showAllButton;
     return this.showAllButton = document.getElementById("ctrlTab-showAll");
   },
   get previews () {
     delete this.previews;
     return this.previews = this.panel.getElementsByClassName("ctrlTab-preview");
   },
+  get maxTabPreviews () {
+    delete this.maxTabPreviews;
+    return this.maxTabPreviews = this.previews.length - 1;
+  },
+  get canvasWidth () {
+    delete this.canvasWidth;
+    return this.canvasWidth = Math.ceil(screen.availWidth * .85 / this.maxTabPreviews);
+  },
+  get canvasHeight () {
+    delete this.canvasHeight;
+    return this.canvasHeight = Math.round(this.canvasWidth * tabPreviews.aspectRatio);
+  },
   get keys () {
     var keys = {};
     ["close", "find", "selectAll"].forEach(function (key) {
       keys[key] = document.getElementById("key_" + key)
                           .getAttribute("key")
                           .toLocaleLowerCase().charCodeAt(0);
     });
     delete this.keys;
     return this.keys = keys;
   },
   _selectedIndex: 0,
   get selected () this._selectedIndex < 0 ?
                     document.activeElement :
                     this.previews.item(this._selectedIndex),
   get isOpen   () this.panel.state == "open" || this.panel.state == "showing" || this._timer,
   get tabCount () this.tabList.length,
-  get tabPreviewCount () Math.min(this.previews.length - 1, this.tabCount),
-  get canvasWidth () Math.ceil(screen.availWidth * .85 / this.tabPreviewCount),
-  get canvasHeight () Math.round(this.canvasWidth * tabPreviews.aspectRatio),
+  get tabPreviewCount () Math.min(this.maxTabPreviews, this.tabCount),
 
   get tabList () {
     return this._recentlyUsedTabs;
   },
 
   init: function ctrlTab_init() {
     if (!this._recentlyUsedTabs) {
       tabPreviews.init();