Bug 1444530 - Set --tab-min-width in the tabs binding rather than gBrowser.init. r=gijs
MozReview-Commit-ID: E4EJKerJAng
--- 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;