Bug 1446762 - Update the lwt header image on resolution change. r=MattN
authorDão Gottwald <dao@mozilla.com>
Fri, 20 Apr 2018 14:21:00 +0200
changeset 414795 3a2fedfeaa96466c02529523706c3ce084f8e502
parent 414794 d625d007d1249a1ce8f9cca281f57931882f2e13
child 414796 aa4d27576edb23166c05d3ae8d91a1007bcd0d36
push id33878
push userapavel@mozilla.com
push dateSat, 21 Apr 2018 09:30:31 +0000
treeherdermozilla-central@6a2fca281629 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1446762, 1438573
milestone61.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 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
toolkit/modules/LightweightThemeConsumer.jsm
--- a/toolkit/modules/LightweightThemeConsumer.jsm
+++ b/toolkit/modules/LightweightThemeConsumer.jsm
@@ -63,16 +63,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.
@@ -108,18 +110,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: "" };