Bug 1273094 - only trigger TabsInTitlebar.init() after the tabbrowser has updated the visibility of the tabs toolbar, r?mikedeboer
MozReview-Commit-ID: 2NOPYqbq4Zp
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -984,17 +984,16 @@ var gBrowserInit = {
gURLBar.setAttribute("enablehistory", "false");
goSetCommandEnabled("cmd_newNavigatorTab", false);
}
// Misc. inits.
TabletModeUpdater.init();
CombinedStopReload.init();
gPrivateBrowsingUI.init();
- TabsInTitlebar.init();
if (window.matchMedia("(-moz-os-version: windows-win8)").matches &&
window.matchMedia("(-moz-windows-default-theme)").matches) {
let windowFrameColor = Cu.import("resource:///modules/Windows8WindowFrameColor.jsm", {})
.Windows8WindowFrameColor.get();
// Formula from W3C's WCAG 2.0 spec's color ratio and relative luminance,
// section 1.3.4, http://www.w3.org/TR/WCAG20/ .
@@ -5080,22 +5079,26 @@ var TabletModeUpdater = {
}
},
observe(subject, topic, data) {
this.update(data == "tablet-mode");
},
update(isInTabletMode) {
+ let wasInTabletMode =
+ document.documentElement.getAttribute("tabletmode") == "true";
if (isInTabletMode) {
document.documentElement.setAttribute("tabletmode", "true");
} else {
document.documentElement.removeAttribute("tabletmode");
}
- TabsInTitlebar.updateAppearance(true);
+ if (wasInTabletMode != isInTabletMode) {
+ TabsInTitlebar.updateAppearance(true);
+ }
},
};
var gTabletModePageCounter = {
enabled: false,
inc() {
this.enabled = AppConstants.isPlatformAndVersionAtLeast("win", "10.0");
if (!this.enabled) {
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -5359,16 +5359,17 @@
</method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body><![CDATA[
switch (aEvent.type) {
case "load":
this.updateVisibility();
+ TabsInTitlebar.init();
break;
case "resize":
if (aEvent.target != window)
break;
TabsInTitlebar.updateAppearance();
var width = this.mTabstrip.boxObject.width;