Backed out changeset f26ae19477f5 (bug 1347182) due to too many regressions. r=backout draft
authorMike de Boer <mdeboer@mozilla.com>
Tue, 20 Jun 2017 16:29:49 +0200
changeset 597356 02f78784a216863e6c001e946c626b4297928f0c
parent 597264 7a6baa6cca3292e8099e652b64d27e74df560874
child 634224 1a56c1ab7a3af7ae5f850273c677e041311b901c
push id64925
push usermdeboer@mozilla.com
push dateTue, 20 Jun 2017 14:35:02 +0000
reviewersbackout
bugs1347182
milestone56.0a1
backs outf26ae19477f52ee5467b358d1bdbf4607d63d99b
Backed out changeset f26ae19477f5 (bug 1347182) due to too many regressions. r=backout MozReview-Commit-ID: DD7RrNgl4dk
browser/base/content/browser.css
toolkit/components/extensions/ext-theme.js
toolkit/components/extensions/schemas/theme.json
toolkit/components/extensions/test/browser/browser.ini
toolkit/components/extensions/test/browser/browser_ext_themes_toolbars.js
toolkit/modules/LightweightThemeConsumer.jsm
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -7,35 +7,29 @@
 @namespace svg url("http://www.w3.org/2000/svg");
 
 :root {
   --identity-popup-expander-width: 38px;
   --panelui-subview-transition-duration: 150ms;
   --lwt-additional-images: none;
   --lwt-background-alignment: right top;
   --lwt-background-tiling: no-repeat;
-  --lwt-toolbar-color: inherit;
 }
 
 :root:-moz-lwtheme {
   color: var(--lwt-text-color) !important;
 }
 
 :root:-moz-lwtheme:not([customization-lwtheme]) {
   background-color: var(--lwt-accent-color) !important;
   background-image: var(--lwt-header-image), var(--lwt-additional-images) !important;
   background-position: var(--lwt-background-alignment) !important;
   background-repeat: var(--lwt-background-tiling) !important;
 }
 
-#navigator-toolbox > toolbar,
-findbar {
-  background: var(--lwt-toolbar-color) !important;
-}
-
 #main-window:not([chromehidden~="toolbar"]) {
 %ifdef XP_MACOSX
   min-width: 335px;
 %else
   min-width: 300px;
 %endif
 }
 
--- a/toolkit/components/extensions/ext-theme.js
+++ b/toolkit/components/extensions/ext-theme.js
@@ -59,19 +59,16 @@ class Theme {
     // Lightweight themes require all properties to be defined.
     if (this.lwtStyles.headerURL &&
         this.lwtStyles.accentcolor &&
         this.lwtStyles.textcolor) {
       LightweightThemeManager.fallbackThemeData = this.lwtStyles;
       Services.obs.notifyObservers(null,
         "lightweight-theme-styling-update",
         JSON.stringify(this.lwtStyles));
-    } else {
-      this.logger.warn("Your theme doesn't include one of the following required " +
-        "properties: 'headerURL', 'accentcolor' or 'textcolor'");
     }
   }
 
   /**
    * Helper method for loading colors found in the extension's manifest.
    *
    * @param {Object} colors Dictionary mapping color properties to values.
    */
@@ -92,19 +89,16 @@ class Theme {
         case "accentcolor":
         case "frame":
           this.lwtStyles.accentcolor = cssColor;
           break;
         case "textcolor":
         case "tab_text":
           this.lwtStyles.textcolor = cssColor;
           break;
-        case "toolbar":
-          this.lwtStyles.toolbarColor = cssColor;
-          break;
       }
     }
   }
 
   /**
    * Helper method for loading images found in the extension's manifest.
    *
    * @param {Object} images Dictionary mapping image properties to values.
--- a/toolkit/components/extensions/schemas/theme.json
+++ b/toolkit/components/extensions/schemas/theme.json
@@ -59,20 +59,16 @@
                 "items": {
                   "type": "number"
                 },
                 "optional": true
               },
               "textcolor": {
                 "type": "string",
                 "optional": true
-              },
-              "toolbar": {
-                "type": "string",
-                "optional": true
               }
             },
             "additionalProperties": { "$ref": "UnrecognizedProperty" }
           },
           "icons": {
             "type": "object",
             "optional": true,
             "properties": {
--- a/toolkit/components/extensions/test/browser/browser.ini
+++ b/toolkit/components/extensions/test/browser/browser.ini
@@ -1,11 +1,10 @@
 [DEFAULT]
 support-files =
   head.js
 
-[browser_ext_management_themes.js]
 [browser_ext_themes_chromeparity.js]
 [browser_ext_themes_dynamic_updates.js]
 [browser_ext_themes_lwtsupport.js]
 [browser_ext_themes_multiple_backgrounds.js]
 [browser_ext_themes_persistence.js]
-[browser_ext_themes_toolbars.js]
+[browser_ext_management_themes.js]
deleted file mode 100644
--- a/toolkit/components/extensions/test/browser/browser_ext_themes_toolbars.js
+++ /dev/null
@@ -1,50 +0,0 @@
-"use strict";
-
-// This test checks whether applied WebExtension themes that attempt to change
-// the background color of toolbars are applied properly.
-
-add_task(async function setup() {
-  await SpecialPowers.pushPrefEnv({
-    set: [["extensions.webextensions.themes.enabled", true]],
-  });
-});
-
-add_task(async function test_support_toolbar_property() {
-  const TOOLBAR_COLOR = "#ff00ff";
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      "theme": {
-        "images": {
-          "headerURL": "image1.png",
-        },
-        "colors": {
-          "accentcolor": ACCENT_COLOR,
-          "textcolor": TEXT_COLOR,
-          "toolbar": TOOLBAR_COLOR,
-        },
-      },
-    },
-    files: {
-      "image1.png": BACKGROUND,
-    },
-  });
-
-  await extension.startup();
-
-  gFindBar.onFindCommand();
-  let promise = gFindBar._startFindDeferred ? gFindBar._startFindDeferred.promise : Promise.resolve();
-  await promise;
-
-  let toolbars = [gFindBar, ...document.getElementsByTagName("toolbar")].filter(toolbar => {
-    let bounds = toolbar.getBoundingClientRect();
-    return bounds.width > 0 && bounds.height > 0;
-  });
-
-  info(`Checking toolbar background colors for ${toolbars.length} toolbars.`);
-  for (let toolbar of toolbars) {
-    Assert.equal(window.getComputedStyle(toolbar).backgroundColor,
-      "rgb(" + hexToRGB(TOOLBAR_COLOR).join(", ") + ")", "Toolbar color should be set.");
-  }
-
-  await extension.unload();
-});
--- a/toolkit/modules/LightweightThemeConsumer.jsm
+++ b/toolkit/modules/LightweightThemeConsumer.jsm
@@ -8,22 +8,16 @@ const {utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/AppConstants.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeImageOptimizer",
   "resource://gre/modules/addons/LightweightThemeImageOptimizer.jsm");
 
-const kCSSVarsMap = new Map([
-  ["--lwt-background-alignment", "backgroundsAlignment"],
-  ["--lwt-background-tiling", "backgroundsTiling"],
-  ["--lwt-toolbar-color", "toolbarColor"]
-]);
-
 this.LightweightThemeConsumer =
  function LightweightThemeConsumer(aDocument) {
   this._doc = aDocument;
   this._win = aDocument.defaultView;
 
   let screen = this._win.screen;
   this._lastScreenWidth = screen.width;
   this._lastScreenHeight = screen.height;
@@ -136,17 +130,18 @@ LightweightThemeConsumer.prototype = {
       }
     } else {
       root.removeAttribute("lwthemeicons");
     }
 
     _setImage(root, active, "--lwt-header-image", aData.headerURL);
     _setImage(root, active, "--lwt-footer-image", aData.footerURL);
     _setImage(root, active, "--lwt-additional-images", aData.additionalBackgrounds);
-    _setProperties(root, active, aData);
+    _setProperty(root, active, "--lwt-background-alignment", aData.backgroundsAlignment);
+    _setProperty(root, active, "--lwt-background-tiling", aData.backgroundsTiling);
 
     if (active && aData.footerURL)
       root.setAttribute("lwthemefooter", "true");
     else
       root.removeAttribute("lwthemefooter");
 
     // On OS X, we extend the lightweight theme into the titlebar, which means setting
     // the chromemargin attribute. Some XUL applications already draw in the titlebar,
@@ -184,19 +179,13 @@ function _setImage(aRoot, aActive, aVari
 function _setProperty(root, active, variableName, value) {
   if (active && value) {
     root.style.setProperty(variableName, value);
   } else {
     root.style.removeProperty(variableName);
   }
 }
 
-function _setProperties(root, active, vars) {
-  for (let [cssVarName, varsKey] of kCSSVarsMap) {
-    _setProperty(root, active, cssVarName, vars[varsKey]);
-  }
-}
-
 function _parseRGB(aColorString) {
   var rgb = aColorString.match(/^rgba?\((\d+), (\d+), (\d+)/);
   rgb.shift();
   return rgb.map(x => parseInt(x));
 }