SubMenu changes draft
authorSean Lee <selee@mozilla.com>
Tue, 12 Jul 2016 16:41:57 +0800 (2016-07-12)
changeset 386946 74d6c91956f60ec74e72aa4b4f72c274f69104d7
parent 386945 2b2112c551847dbe95b1a3388e607bcf521f99bb
child 386947 204406989d6707fb11fc4139e816048901f70732
push id22860
push userbmo:selee@mozilla.com
push dateWed, 13 Jul 2016 03:57:55 +0000 (2016-07-13)
milestone50.0a1
SubMenu changes MozReview-Commit-ID: 8hDeFiAsTHJ
browser/components/downloads/content/downloads.css
browser/components/downloads/content/downloads.js
browser/components/downloads/content/downloadsOverlay.xul
browser/locales/en-US/chrome/browser/downloads/downloads.dtd
--- a/browser/components/downloads/content/downloads.css
+++ b/browser/components/downloads/content/downloads.css
@@ -14,45 +14,69 @@ richlistitem[type="download"]:not([selec
 }
 
 richlistitem[type="download"].download-state[state="1"]:not([exists]) .downloadShow {
   display: none;
 }
 
 #downloadsSummary:not([inprogress]) > vbox > #downloadsSummaryProgress,
 #downloadsSummary:not([inprogress]) > vbox > #downloadsSummaryDetails,
-#downloadsFooter[showingsummary] > #downloadsHistory,
+#downloadsFooter[showingsummary] > #downloadsSimpleSummary,
 #downloadsFooter:not([showingsummary]) > #downloadsSummary {
   display: none;
 }
 
 #downloadFooterSubPanelButton {
   margin: 0;
   list-style-image: url("chrome://browser/skin/downloads/button_more.svg");
   filter: url("chrome://browser/skin/filters.svg#fill");
   fill: rgb(133, 133, 133);
   -moz-image-region: rect(0px, 16px, 16px, 0px);
   -moz-appearance: none;
   min-width: 0;
-  width: 57px;
+  width: 56px;
+}
+
+#downloadsSimpleSummary {
+  font-size: 11px;
 }
 
-#downloadFooterSubPanelButton:hover {
+#downloadsSimpleSummary:hover {
+  fill: rgb(0, 0, 0);
+  color: rgb(0, 0, 0);
+  background-color: #e2e2e2;
+}
+
+#downloadsSimpleSummary:focus {
   fill: rgb(255, 255, 255);
+  color: rgb(255, 255, 255);
+  background-color: #1677d9;
 }
 
 #downloadFooterSubPanelButton:before {
   content: '';
   border-left: 1px solid #eee000;
   color: #000eee;
   display: inline-block;
   width: 4px;
   height: 30px;
 }
 
+#downloadSubPanel {
+  text-align: center;
+  width: 280px;
+  -moz-appearance: none;
+  /*background-color: white;*/
+}
+
+#downloadSubPanel * {
+  -moz-appearance: none;
+  /*background-color: white;*/
+}
+
 /*** Downloads View ***/
 
 /**
  * The downloads richlistbox may list thousands of items, and it turns out
  * XBL binding attachment, and even more so detachment, is a performance hog.
  * This hack makes sure we don't apply any binding to inactive items (inactive
  * items are history downloads that haven't been in the visible area).
  * We can do this because the richlistbox implementation does not interact
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -708,16 +708,17 @@ const DownloadsView = {
       DownloadsCommon.log("Removing the panel's hasdownloads attribute.");
       DownloadsPanel.panel.removeAttribute("hasdownloads");
     }
 
     // If we've got some hidden downloads, we should activate the
     // DownloadsSummary. The DownloadsSummary will determine whether or not
     // it's appropriate to actually display the summary.
     DownloadsSummary.active = hiddenCount > 0;
+    DownloadsSummary.showingClearAboveDownloadsItem = count > 0;
   },
 
   /**
    * Element corresponding to the list of downloads.
    */
   get richListBox() {
     delete this.richListBox;
     return this.richListBox = document.getElementById("downloadsListBox");
@@ -1292,16 +1293,20 @@ const DownloadsSummary = {
    * Returns the active state of the downloads summary.
    */
   get active() {
     return this._active;
   },
 
   _active: false,
 
+  set showingClearAboveDownloadsItem(aShowingItem) {
+    document.getElementById("clearAboveDownloadsButton").setAttribute("hidden", !aShowingItem);
+  },
+
   /**
    * Sets whether or not we show the progress bar.
    *
    * @param aShowingProgress
    *        True if we should show the progress bar.
    */
   set showingProgress(aShowingProgress) {
     if (aShowingProgress) {
--- a/browser/components/downloads/content/downloadsOverlay.xul
+++ b/browser/components/downloads/content/downloadsOverlay.xul
@@ -142,28 +142,32 @@
                                min="0"
                                max="100"
                                mode="normal" />
                 <description id="downloadsSummaryDetails"
                              style="width: &downloadDetails.width;"
                              crop="end"/>
               </vbox>
             </hbox>
-            <stack class="plain">
+            <stack class="plain" id="downloadsSimpleSummary">
               <button id="downloadsHistory"
                       class="plain"
                       label="&downloadsHistory.label;"
                       accesskey="&downloadsHistory.accesskey;"
                       oncommand="DownloadsPanel.showDownloadsHistory();"/>
               <menupopup id="downloadSubPanel" position="after_end">
-                <menuitem label="Clear Above Downloads"/>
-                <menuitem label="Open Downloads Folder"/>
+                <menuitem id="clearAboveDownloadsButton"
+                          hidden="true"
+                          label="&clearAboveDownloadsButton.label;"/>
+                <menuitem id="openDownloadsFolderButton"
+                          label="&openDownloadsFolderButton.label;"/>
               </menupopup>
 
               <button id="downloadFooterSubPanelButton"
+                      accesskey="&downloadsHistory.accesskey;"
                       type="panel"
                       popup="downloadSubPanel"
                       align="center"
                       right="0"/>
             </stack>
           </vbox>
         </panelview>
 
--- a/browser/locales/en-US/chrome/browser/downloads/downloads.dtd
+++ b/browser/locales/en-US/chrome/browser/downloads/downloads.dtd
@@ -104,16 +104,22 @@
 <!-- LOCALIZATION NOTE (downloadsHistory.label, downloadsHistory.accesskey):
      This string is shown at the bottom of the Downloads Panel when all the
      downloads fit in the available space, or when there are no downloads in
      the panel at all.
      -->
 <!ENTITY downloadsHistory.label           "Show All Downloads">
 <!ENTITY downloadsHistory.accesskey       "S">
 
+<!ENTITY downloadFooterSubPanelButton.accesskey       "P">
+
+<!ENTITY clearAboveDownloadsButton.label       "Clear Above Downloads">
+
+<!ENTITY openDownloadsFolderButton.label       "Open Downloads Folder">
+
 <!ENTITY clearDownloadsButton.label       "Clear Downloads">
 <!ENTITY clearDownloadsButton.tooltip     "Clears completed, canceled and failed downloads">
 
 <!-- LOCALIZATION NOTE (downloadsListEmpty.label):
      This string is shown when there are no items in the Downloads view, when it
      is displayed inside a browser tab.
      -->
 <!ENTITY downloadsListEmpty.label         "There are no downloads.">