Bug 1446762 - Update the lwt header image on resolution change. r?MattN
This was previously implemented using the resize event, and was wrongly removed in
bug 1438573.
MozReview-Commit-ID: ATZdPgoOGRF
--- a/toolkit/modules/LightweightThemeConsumer.jsm
+++ b/toolkit/modules/LightweightThemeConsumer.jsm
@@ -57,16 +57,18 @@ function LightweightThemeConsumer(aDocum
this._doc = aDocument;
this._win = aDocument.defaultView;
Services.obs.addObserver(this, "lightweight-theme-styling-update");
var temp = {};
ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
this._update(temp.LightweightThemeManager.currentThemeForDisplay);
+
+ this._win.addEventListener("resolutionchange", this);
this._win.addEventListener("unload", this, { once: true });
}
LightweightThemeConsumer.prototype = {
_lastData: null,
// Whether the active lightweight theme should be shown on the window.
_enabled: true,
// Whether a lightweight theme is enabled.
@@ -102,18 +104,24 @@ LightweightThemeConsumer.prototype = {
return;
}
this._update(parsedData);
},
handleEvent(aEvent) {
switch (aEvent.type) {
+ case "resolutionchange":
+ if (this._active) {
+ this._update(this._lastData);
+ }
+ break;
case "unload":
Services.obs.removeObserver(this, "lightweight-theme-styling-update");
+ this._win.removeEventListener("resolutionchange", this);
this._win = this._doc = null;
break;
}
},
_update(aData) {
if (!aData) {
aData = { headerURL: "", footerURL: "", textcolor: "", accentcolor: "" };