Bug 1444530 - Set --tab-min-width in the tabs binding rather than gBrowser.init. r=Gijs
authorDão Gottwald <dao@mozilla.com>
Sat, 10 Mar 2018 12:13:47 +0100
changeset 462538 c97c9a7a66da925f0193df9175674f383eb1db28
parent 462527 0817a733d45a48800e68c9e2a5035fd17bfcdee2
child 462539 6379a27eb701e6e455c039d222e58019360af344
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1444530
milestone60.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 1444530 - Set --tab-min-width in the tabs binding rather than gBrowser.init. r=Gijs MozReview-Commit-ID: E4EJKerJAng
browser/base/content/tabbrowser.js
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -140,18 +140,16 @@ window._gBrowser = {
     /**
      * List of browsers whose docshells must be active in order for print preview
      * to work.
      */
     this._printPreviewBrowsers = new Set();
 
     this._switcher = null;
 
-    this._tabMinWidthLimit = 50;
-
     this._soundPlayingAttrRemovalTimer = 0;
 
     this._hoverTabTimer = null;
 
     this.mCurrentBrowser = this.initialBrowser;
     this.mCurrentBrowser.permanentKey = {};
 
     Services.obs.addObserver(this, "contextual-identity-updated");
@@ -235,23 +233,16 @@ window._gBrowser = {
     XPCOMUtils.defineLazyPreferenceGetter(this, "schedulePressureDefaultCount",
       "browser.schedulePressure.defaultCount", 3);
     XPCOMUtils.defineLazyPreferenceGetter(this, "tabWarmingEnabled",
       "browser.tabs.remote.warmup.enabled", false);
     XPCOMUtils.defineLazyPreferenceGetter(this, "tabWarmingMax",
       "browser.tabs.remote.warmup.maxTabs", 3);
     XPCOMUtils.defineLazyPreferenceGetter(this, "tabWarmingUnloadDelay" /* ms */,
       "browser.tabs.remote.warmup.unloadDelayMs", 2000);
-    XPCOMUtils.defineLazyPreferenceGetter(this, "tabMinWidthPref",
-      "browser.tabs.tabMinWidth", this._tabMinWidthLimit,
-      (pref, prevValue, newValue) => this.tabMinWidth = newValue,
-      newValue => Math.max(newValue, this._tabMinWidthLimit),
-    );
-
-    this.tabMinWidth = this.tabMinWidthPref;
 
     this._setupEventListeners();
   },
 
   get visibleTabs() {
     if (!this._visibleTabs)
       this._visibleTabs = Array.filter(this.tabs,
         tab => !tab.hidden && !tab.closing);
@@ -447,21 +438,16 @@ window._gBrowser = {
   set userTypedValue(val) {
     return this.mCurrentBrowser.userTypedValue = val;
   },
 
   get userTypedValue() {
     return this.mCurrentBrowser.userTypedValue;
   },
 
-  set tabMinWidth(val) {
-    this.tabContainer.style.setProperty("--tab-min-width", val + "px");
-    return val;
-  },
-
   isFindBarInitialized(aTab) {
     return (aTab || this.selectedTab)._findBar != undefined;
   },
 
   getFindBar(aTab) {
     if (!aTab)
       aTab = this.selectedTab;
 
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -120,16 +120,27 @@
           tab.setAttribute("onerror", "this.removeAttribute('image');");
 
           window.addEventListener("resize", this);
           window.addEventListener("DOMContentLoaded", this);
 
           Services.prefs.addObserver("privacy.userContext", this);
           this.observe(null, "nsPref:changed", "privacy.userContext.enabled");
 
+          XPCOMUtils.defineLazyPreferenceGetter(this, "_tabMinWidthPref",
+            "browser.tabs.tabMinWidth", null,
+            (pref, prevValue, newValue) => this._tabMinWidth = newValue,
+            newValue => {
+              const LIMIT = 50;
+              return Math.max(newValue, LIMIT);
+            },
+          );
+
+          this._tabMinWidth = this._tabMinWidthPref;
+
           this._setPositionalAttributes();
 
           CustomizableUI.addListener(this);
           this._updateNewTabVisibility();
         ]]>
       </constructor>
 
       <destructor>
@@ -167,16 +178,23 @@
       </field>
 
       <property name="tabbrowser" readonly="true">
         <getter>
           return window.gBrowser;
         </getter>
       </property>
 
+      <property name="_tabMinWidth">
+        <setter>
+          this.style.setProperty("--tab-min-width", val + "px");
+          return val;
+        </setter>
+      </property>
+
       <property name="restoreTabsButtonWrapperWidth" readonly="true">
         <getter>
           if (!this._restoreTabsButtonWrapperWidth) {
             this._restoreTabsButtonWrapperWidth = this.windowUtils
               .getBoundsWithoutFlushing(this.restoreTabsButton.parentNode)
               .width;
           }
           return this._restoreTabsButtonWrapperWidth;