Bug 1452629 - Part 2 - Avoid redundant button label elements in the "download" widget. r=mak
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Tue, 28 Aug 2018 15:57:52 +0100
changeset 492149 de4eb68568a092a775de2c285b169f6e922eaa1a
parent 492148 58fc7f243f7605a4408454da153e40e27ecc3e81
child 492150 4aca3cccf16f9989d2f153797e6df77edcb0ce88
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1452629
milestone64.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 1452629 - Part 2 - Avoid redundant button label elements in the "download" widget. r=mak Differential Revision: https://phabricator.services.mozilla.com/D4447
browser/components/downloads/DownloadsViewUI.jsm
browser/components/downloads/content/download.xml
browser/components/downloads/content/downloadsStrings.inc.xul
browser/components/downloads/jar.mn
browser/themes/shared/downloads/allDownloadsView.inc.css
browser/themes/shared/downloads/downloads.inc.css
--- a/browser/components/downloads/DownloadsViewUI.jsm
+++ b/browser/components/downloads/DownloadsViewUI.jsm
@@ -24,26 +24,29 @@ XPCOMUtils.defineLazyModuleGetters(this,
   OS: "resource://gre/modules/osfile.jsm",
   PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
 });
 
 var gDownloadElementButtons = {
   cancel: {
     commandName: "downloadsCmd_cancel",
     l10nId: "download-cancel",
+    descriptionL10nId: "download-cancel-description",
     iconClass: "downloadIconCancel",
   },
   retry: {
     commandName: "downloadsCmd_retry",
     l10nId: "download-retry",
+    descriptionL10nId: "download-retry-description",
     iconClass: "downloadIconRetry",
   },
   show: {
     commandName: "downloadsCmd_show",
     l10nId: "download-show",
+    descriptionL10nId: "download-show-description",
     iconClass: "downloadIconShow",
   },
   subviewOpenOrRemoveFile: {
     commandName: "downloadsCmd_showBlockedInfo",
     l10nId: "download-open-or-remove-file",
     iconClass: "downloadIconSubviewArrow",
   },
   askOpenOrRemoveFile: {
@@ -190,21 +193,26 @@ this.DownloadsViewUI.DownloadElementShel
            this.element.ownerDocument.getAnonymousElementByAttribute(
                                          this.element, "anonid",
                                          "progressmeter");
     }
     return this.__progressElement;
   },
 
   showButton(type) {
-    let { commandName, l10nId, iconClass } = gDownloadElementButtons[type];
+    let { commandName, l10nId, descriptionL10nId,
+          iconClass } = gDownloadElementButtons[type];
 
     this.buttonCommandName = commandName;
     let labelAttribute = this.isPanel ? "buttonarialabel" : "buttontooltiptext";
     this.element.setAttribute(labelAttribute, this.string(l10nId));
+    if (this.isPanel && descriptionL10nId) {
+      this.element.setAttribute("buttonHoverStatus",
+                                this.string(descriptionL10nId));
+    }
     this.element.setAttribute("buttonclass", "downloadButton " + iconClass);
     this.element.removeAttribute("buttonhidden");
   },
 
   hideButton() {
     this.element.setAttribute("buttonhidden", "true");
   },
 
--- a/browser/components/downloads/content/download.xml
+++ b/browser/components/downloads/content/download.xml
@@ -56,32 +56,19 @@
                            crop="end"
                            xbl:inherits="value=fullStatus,tooltiptext=fullStatus"/>
           <xul:description class="downloadDetails downloadOpenFile"
                            crop="end"
                            value="&openFile.label;"/>
           <xul:description class="downloadDetails downloadShowMoreInfo"
                            crop="end"
                            value="&showMoreInformation.label;"/>
-          <xul:stack class="downloadButtonLabels">
-            <xul:description class="downloadDetails downloadShow"
-                             crop="end"
-#ifdef XP_MACOSX
-                             value="&cmd.showMac.label;"
-#else
-                             value="&cmd.show.label;"
-#endif
-                             />
-            <xul:description class="downloadDetails downloadCancel"
-                             crop="end"
-                             value="&cancelDownload.label;"/>
-            <xul:description class="downloadDetails downloadRetry"
-                             crop="end"
-                             value="&retryDownload.label;"/>
-          </xul:stack>
+          <xul:description class="downloadDetails downloadDetailsButtonHover"
+                           crop="end"
+                           xbl:inherits="value=buttonHoverStatus"/>
         </xul:vbox>
       </xul:hbox>
       <xul:toolbarseparator />
       <xul:button class="downloadButton"
                   xbl:inherits="class=buttonclass,aria-label=buttonarialabel,tooltiptext=buttontooltiptext"
                   oncommand="DownloadsView.onDownloadButton(event);"/>
     </content>
   </binding>
--- a/browser/components/downloads/content/downloadsStrings.inc.xul
+++ b/browser/components/downloads/content/downloadsStrings.inc.xul
@@ -1,15 +1,19 @@
 # Don't add new strings here, use properties files instead. This file won't be
 # necessary anymore once localization is converted to Fluent (bug 1452637).
 
 <stringbundleset id="downloadsStrings"
   string-download-cancel="&cmd.cancel.label;"
+  string-download-cancel-description="&cancelDownload.label;"
   string-download-open-or-remove-file="&cmd.chooseOpen.label;"
   string-download-remove-file="&cmd.removeFile.label;"
   string-download-remove-file-or-allow="&cmd.chooseUnblock.label;"
   string-download-retry="&cmd.retry.label;"
+  string-download-retry-description="&retryDownload.label;"
 #ifdef XP_MACOSX
   string-download-show="&cmd.showMac.label;"
+  string-download-show-description="&cmd.showMac.label;"
 #else
   string-download-show="&cmd.show.label;"
+  string-download-show-description="&cmd.show.label;"
 #endif
 />
--- a/browser/components/downloads/jar.mn
+++ b/browser/components/downloads/jar.mn
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 browser.jar:
-*       content/browser/downloads/download.xml           (content/download.xml)
+        content/browser/downloads/download.xml           (content/download.xml)
         content/browser/downloads/downloads.css          (content/downloads.css)
         content/browser/downloads/downloads.js           (content/downloads.js)
         content/browser/downloads/indicator.js           (content/indicator.js)
         content/browser/downloads/allDownloadsView.js    (content/allDownloadsView.js)
 *       content/browser/downloads/contentAreaDownloadsView.xul (content/contentAreaDownloadsView.xul)
         content/browser/downloads/contentAreaDownloadsView.js  (content/contentAreaDownloadsView.js)
         content/browser/downloads/contentAreaDownloadsView.css (content/contentAreaDownloadsView.css)
--- a/browser/themes/shared/downloads/allDownloadsView.inc.css
+++ b/browser/themes/shared/downloads/allDownloadsView.inc.css
@@ -59,17 +59,17 @@
      progress bar can be vertically centered. */
   margin: 4px 0 calc(1em / 0.95 - 1em);
 }
 
 .downloadDetailsNormal,
 .downloadDetailsHover,
 .downloadOpenFile,
 .downloadShowMoreInfo,
-.downloadButtonLabels {
+.downloadDetailsButtonHover {
   display: none;
 }
 
 .downloadButton {
   -moz-appearance: none;
   -moz-box-align: center;
   background: transparent;
   min-width: 0;
--- a/browser/themes/shared/downloads/downloads.inc.css
+++ b/browser/themes/shared/downloads/downloads.inc.css
@@ -197,33 +197,33 @@
 @item@:hover > .downloadMainArea > .downloadContainer > .downloadDetailsNormal,
 @item@:not(:hover) > .downloadMainArea > .downloadContainer > .downloadDetailsHover {
   display: none;
 }
 
 /* When hovering the action button in particular, instead of the usual hover
    message we display the command associated with the button. */
 @item@.downloadHoveringButton > .downloadMainArea > .downloadContainer > .downloadDetailsHover,
-@item@:not(.downloadHoveringButton) > .downloadMainArea > .downloadContainer > .downloadButtonLabels {
+@item@:not(.downloadHoveringButton) > .downloadMainArea > .downloadContainer > .downloadDetailsButtonHover {
   display: none;
 }
 
 /* When hovering the main area of a finished download whose target exists,
    instead of the usual hover message we display the "Open File" command. */
 @itemFinished@[exists] > .downloadMainArea:hover > .downloadContainer > .downloadDetailsHover,
 @itemNotFinished@ > .downloadMainArea > .downloadContainer > .downloadOpenFile,
 @item@:not([exists]) > .downloadMainArea > .downloadContainer > .downloadOpenFile,
 .downloadMainArea:not(:hover) > .downloadContainer > .downloadOpenFile {
   display: none;
 }
 
 /* When hovering items blocked by Application Reputation, instead of the other
    hover messages we display the "Show more information" label. */
 @item@[verdict] > .downloadMainArea > .downloadContainer > .downloadDetailsHover,
-@item@[verdict] > .downloadMainArea > .downloadContainer > .downloadButtonLabels,
+@item@[verdict] > .downloadMainArea > .downloadContainer > .downloadDetailsButtonHover,
 @item@:not([verdict]) > .downloadMainArea > .downloadContainer > .downloadShowMoreInfo,
 @item@:not(:hover) > .downloadMainArea > .downloadContainer > .downloadShowMoreInfo {
   display: none;
 }
 
 @item@[verdict] > toolbarseparator {
   visibility: hidden;
 }