Bug 1354332 - Update the tab bar layout when the UI density changes. r?johannh
MozReview-Commit-ID: 1HGVirulaE3
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -5690,16 +5690,17 @@ var gUIDensity = {
if (tree) {
// Tree items don't update their styles without changing some property on the
// parent tree element, like background-color or border. See bug 1407399.
tree.style.border = "1px";
tree.style.border = "";
}
TabsInTitlebar.updateAppearance(true);
+ gBrowser.tabContainer.uiDensityChanged();
},
};
var gHomeButton = {
prefDomain: "browser.startup.homepage",
observe(aSubject, aTopic, aPrefName) {
if (aTopic != "nsPref:changed" || aPrefName != this.prefDomain)
return;
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -6818,31 +6818,42 @@
if (this.hasAttribute("using-closing-tabs-spacer")) {
this.removeAttribute("using-closing-tabs-spacer");
this._closingTabsSpacer.style.width = 0;
}
]]></body>
</method>
+ <method name="uiDensityChanged">
+ <body><![CDATA[
+ this._positionPinnedTabs();
+ this._updateCloseButtons();
+ this._handleTabSelect(true);
+ ]]></body>
+ </method>
+
<field name="_lastNumPinned">0</field>
<field name="_pinnedTabsLayoutCache">null</field>
<method name="_positionPinnedTabs">
<body><![CDATA[
var numPinned = this.tabbrowser._numPinnedTabs;
var doPosition = this.getAttribute("overflow") == "true" &&
numPinned > 0;
if (doPosition) {
this.setAttribute("positionpinnedtabs", "true");
let layoutData = this._pinnedTabsLayoutCache;
- if (!layoutData) {
+ let uiDensity = document.documentElement.getAttribute("uidensity");
+ if (!layoutData ||
+ layoutData.uiDensity != uiDensity) {
let arrowScrollbox = this.arrowScrollbox;
layoutData = this._pinnedTabsLayoutCache = {
+ uiDensity,
pinnedTabWidth: this.childNodes[0].getBoundingClientRect().width,
scrollButtonWidth: arrowScrollbox._scrollButtonDown.getBoundingClientRect().width
};
}
let width = 0;
for (let i = numPinned - 1; i >= 0; i--) {
let tab = this.childNodes[i];