Bug 1457218 - Part 1 - Don't inherit from "menu-button-base" in the "download-subview-toolbarbutton" binding. r=bgrins
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Thu, 30 Aug 2018 10:28:01 +0100
changeset 482361 ce10788000f5738e176f486548e81c87d7a1c08f
parent 482360 18c0aff587fa935a8149f83d58664e77c35e598a
child 482362 e2d52cbf726d7b4dfb778ab90d47d408e71128e8
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewersbgrins
bugs1457218
milestone63.0a1
Bug 1457218 - Part 1 - Don't inherit from "menu-button-base" in the "download-subview-toolbarbutton" binding. r=bgrins Differential Revision: https://phabricator.services.mozilla.com/D4529
browser/components/downloads/DownloadsSubview.jsm
browser/components/downloads/content/download.xml
browser/components/downloads/content/downloads.css
--- a/browser/components/downloads/DownloadsSubview.jsm
+++ b/browser/components/downloads/DownloadsSubview.jsm
@@ -365,16 +365,25 @@ DownloadsSubview.Button = class extends 
     super();
     this.download = download;
 
     this.element = document.createElement("toolbarbutton");
     this.element._shell = this;
 
     this.element.classList.add("subviewbutton", "subviewbutton-iconic", "download",
       "download-state");
+
+    let hover = event => {
+      if (event.originalTarget.classList.contains("action-button")) {
+        this.element.classList.toggle("downloadHoveringButton",
+                                      event.type == "mouseover");
+      }
+    };
+    this.element.addEventListener("mouseover", hover);
+    this.element.addEventListener("mouseout", hover);
   }
 
   get browserWindow() {
     return this.element.ownerGlobal;
   }
 
   async refresh() {
     if (this._targetFileChecked)
--- a/browser/components/downloads/content/download.xml
+++ b/browser/components/downloads/content/download.xml
@@ -106,19 +106,18 @@
         <xul:button class="downloadButton downloadShowBlockedInfo"
                     tooltiptext="&cmd.chooseUnblock.label;"
                     oncommand="DownloadsView.onDownloadCommand(event, 'downloadsCmd_showBlockedInfo');"/>
       </xul:stack>
     </content>
   </binding>
 
   <binding id="download-subview-toolbarbutton"
-           extends="chrome://global/content/bindings/button.xml#menu-button-base">
+           extends="chrome://global/content/bindings/button.xml#button-base">
     <content>
-      <children includes="observes|template|menupopup|panel|tooltip"/>
       <xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,label,consumeanchor"/>
       <xul:vbox class="toolbarbutton-text" flex="1">
         <xul:label crop="end" xbl:inherits="value=label,accesskey,crop,wrap"/>
         <xul:label class="status-text status-full" crop="end" xbl:inherits="value=fullStatus"/>
         <xul:label class="status-text status-open" crop="end" xbl:inherits="value=openLabel"/>
         <xul:label class="status-text status-retry" crop="end" xbl:inherits="value=retryLabel"/>
         <xul:label class="status-text status-show" crop="end" xbl:inherits="value=showLabel"/>
       </xul:vbox>
--- a/browser/components/downloads/content/downloads.css
+++ b/browser/components/downloads/content/downloads.css
@@ -225,20 +225,20 @@
 
 /* When a Download is _not_ hovered, display the full status message. */
 .subviewbutton.download:not(:hover) > .toolbarbutton-text > .status-full,
 /* When a Download is hovered when the file doesn't exist and cannot be retried,
    keep showing the full status message. */
 .subviewbutton.download:hover:-moz-any(:not([openLabel]),:not([exists])):not([retryLabel]) > .toolbarbutton-text > .status-full,
 /* When a Download is hovered and the it can be retried, but the action button
    is _not_ hovered, keep showing the full status message. */
-.subviewbutton.download:hover[retryLabel]:not([buttonover]) > .toolbarbutton-text > .status-full,
+.subviewbutton.download:hover[retryLabel]:not(.downloadHoveringButton) > .toolbarbutton-text > .status-full,
 /* When a Download is hovered and the file can be opened, but the action button
    is _not_ hovered, show the 'Open File' status label. */
-.subviewbutton.download:hover[openLabel][exists]:not([buttonover]) > .toolbarbutton-text > .status-open,
+.subviewbutton.download:hover[openLabel][exists]:not(.downloadHoveringButton) > .toolbarbutton-text > .status-open,
 /* When a Download is hovered - its action button explicitly - and it can be
    retried, show the 'Retry Download' label. */
-.subviewbutton.download:hover[retryLabel][buttonover] > .toolbarbutton-text > .status-retry,
+.subviewbutton.download:hover[retryLabel].downloadHoveringButton > .toolbarbutton-text > .status-retry,
 /* When a Download is hovered - its action button explicitly - and the file can
    be shown in the OS's shell, show the 'Open Containing Folder' label. */
-.subviewbutton.download:hover[openLabel][exists][buttonover] > .toolbarbutton-text > .status-show {
+.subviewbutton.download:hover[openLabel][exists].downloadHoveringButton > .toolbarbutton-text > .status-show {
   display: inline;
 }