Bug 1459066 - Overflow menu WebExtension subview header should use the default browser styling instead of the extension's styling. r=mixedpuppy, a=RyanVM DEVEDITION_61_0b5_BUILD1 DEVEDITION_61_0b5_RELEASE FENNEC_61_0b5_BUILD1 FENNEC_61_0b5_RELEASE FIREFOX_61_0b5_BUILD1 FIREFOX_61_0b5_RELEASE
authorJared Wein <jwein@mozilla.com>
Mon, 07 May 2018 13:06:46 -0400
changeset 797154 d8660eabf305ef55d7e867aaf9138f9c7336e5ff
parent 797153 bd0e456ced8c5a23eca1d3f46c6f8007ac0b1ee3
child 797155 faca56ce3e18e54c973615d09c42a43890d962cd
push id110422
push userbmo:khudson@mozilla.com
push dateFri, 18 May 2018 18:23:40 +0000
reviewersmixedpuppy, RyanVM
bugs1459066
milestone61.0
Bug 1459066 - Overflow menu WebExtension subview header should use the default browser styling instead of the extension's styling. r=mixedpuppy, a=RyanVM MozReview-Commit-ID: EtQ6VS5OH0e
browser/components/extensions/ExtensionPopups.jsm
browser/components/extensions/test/browser/browser_ext_popup_background.js
browser/themes/shared/browser.inc.css
--- a/browser/components/extensions/ExtensionPopups.jsm
+++ b/browser/components/extensions/ExtensionPopups.jsm
@@ -355,17 +355,19 @@ class BasePopup {
     // Panels inherit the applied theme (light, dark, etc) and there is a high
     // likelihood that most extension authors will not have tested with a dark theme.
     // If they have not set a background-color, we force it to white to ensure visibility
     // of the extension content. Passing `null` should be treated the same as no argument,
     // which is why we can't use default parameters here.
     if (!background) {
       background = "#fff";
     }
-    this.panel.style.setProperty("--arrowpanel-background", background);
+    if (this.panel.id != "widget-overflow") {
+      this.panel.style.setProperty("--arrowpanel-background", background);
+    }
     if (background == "#fff") {
       // Set a usable default color that work with the default background-color.
       this.panel.style.setProperty("--arrowpanel-border-color", "hsla(210,4%,10%,.15)");
     }
     this.background = background;
   }
 }
 
--- a/browser/components/extensions/test/browser/browser_ext_popup_background.js
+++ b/browser/components/extensions/test/browser/browser_ext_popup_background.js
@@ -5,17 +5,30 @@
 
 async function testPanel(browser, standAlone, initial_background) {
   let panel = getPanelForNode(browser);
   let arrowContent = document.getAnonymousElementByAttribute(panel, "class", "panel-arrowcontent");
   let arrow = document.getAnonymousElementByAttribute(panel, "anonid", "arrow");
 
   let checkArrow = (background = null) => {
     if (background == null || !standAlone) {
-      ok(!arrow.style.hasOwnProperty("fill"), "Arrow fill should be the default one");
+      if (standAlone) {
+        is(getComputedStyle(arrow).fill,
+           "rgb(255, 255, 255)", "Arrow fill should be set to #fff when no background is supplied and popup is standAlone");
+      } else {
+        let default_background =
+          getComputedStyle(document.documentElement).getPropertyValue("--arrowpanel-background");
+        // Need to apply the color to a node and get the computed value
+        // to resolve CSS named colors such as -moz-field.
+        let span = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
+        span.style.color = default_background;
+        let default_background_computed = getComputedStyle(span).color;
+
+        is(getComputedStyle(arrow).fill, default_background_computed, "Arrow fill should be the default one");
+      }
       return;
     }
 
     is(getComputedStyle(arrowContent).backgroundColor, background, "Arrow content should have correct background");
     is(getComputedStyle(arrow).fill, background, "Arrow should have correct background");
   };
 
   function getBackground(browser) {
--- a/browser/themes/shared/browser.inc.css
+++ b/browser/themes/shared/browser.inc.css
@@ -147,8 +147,12 @@
 
 /* End private browsing and accessibility indicators */
 
 /* Force background for datepicker popup to white so themes don't override it */
 #DateTimePickerPanel[active="true"] > .panel-arrowcontainer > .panel-arrowbox,
 #DateTimePickerPanel[active="true"] > .panel-arrowcontainer > .panel-arrowcontent {
   --arrowpanel-background: #fff;
 }
+
+#widget-overflow .webextension-popup-browser {
+  background: #fff;
+}