Bug 1362207 - Remove the dropdown menu from the footer of the Downloads Panel. r=mak
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Fri, 05 May 2017 15:37:00 +0100
changeset 357036 0931839a3e5bb8393c95854f75f0b1e5098703e3
parent 357035 0d874a2e610d932751d5d13f2d199912a2831f53
child 357037 0f9d66b6a6d90cc1b51f356601ad08178354ea19
push id90023
push userpaolo.mozmail@amadzone.org
push dateMon, 08 May 2017 15:38:08 +0000
treeherdermozilla-inbound@0931839a3e5b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1362207
milestone55.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 1362207 - Remove the dropdown menu from the footer of the Downloads Panel. r=mak MozReview-Commit-ID: CFrHklbB7TK
browser/app/profile/firefox.js
browser/components/downloads/DownloadsCommon.jsm
browser/components/downloads/content/downloads.css
browser/components/downloads/content/downloads.js
browser/components/downloads/content/downloadsOverlay.xul
browser/components/downloads/test/browser/browser.ini
browser/components/downloads/test/browser/browser_downloads_panel_footer.js
browser/locales/en-US/chrome/browser/downloads/downloads.dtd
browser/themes/shared/downloads/downloads.inc.css
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -355,22 +355,16 @@ pref("browser.download.loglevel", "Error
 // feedback from their action.
 pref("browser.download.saveLinkAsFilenameTimeout", 4000);
 
 pref("browser.download.useDownloadDir", true);
 pref("browser.download.folderList", 1);
 pref("browser.download.manager.addToRecentDocs", true);
 pref("browser.download.manager.resumeOnWakeDelay", 10000);
 
-#ifdef RELEASE_OR_BETA
-pref("browser.download.showPanelDropmarker", false);
-#else
-pref("browser.download.showPanelDropmarker", true);
-#endif
-
 // This allows disabling the animated notifications shown by
 // the Downloads Indicator when a download starts or completes.
 pref("browser.download.animateNotifications", true);
 
 // This records whether or not the panel has been shown at least once.
 pref("browser.download.panel.shown", false);
 
 #ifndef XP_MACOSX
--- a/browser/components/downloads/DownloadsCommon.jsm
+++ b/browser/components/downloads/DownloadsCommon.jsm
@@ -121,17 +121,16 @@ var PrefObserver = {
       });
     }
   },
 };
 
 PrefObserver.register({
   // prefName: defaultValue
   animateNotifications: true,
-  showPanelDropmarker: true,
 });
 
 
 // DownloadsCommon
 
 /**
  * This object is exposed directly to the consumers of this JavaScript module,
  * and provides shared methods for all the instances of the user interface.
@@ -231,23 +230,16 @@ this.DownloadsCommon = {
    * Indicates whether we should show visual notification on the indicator
    * when a download event is triggered.
    */
   get animateNotifications() {
     return PrefObserver.animateNotifications;
   },
 
   /**
-   * Indicates whether we should show the dropmarker in the Downloads Panel.
-   */
-  get showPanelDropmarker() {
-    return PrefObserver.showPanelDropmarker;
-  },
-
-  /**
    * Get access to one of the DownloadsData or PrivateDownloadsData objects,
    * depending on the privacy status of the window in question.
    *
    * @param aWindow
    *        The browser window which owns the download button.
    */
   getData(aWindow) {
     if (PrivateBrowsingUtils.isContentWindowPrivate(aWindow)) {
--- a/browser/components/downloads/content/downloads.css
+++ b/browser/components/downloads/content/downloads.css
@@ -8,35 +8,29 @@ richlistitem[type="download"] {
   -moz-binding: url('chrome://browser/content/downloads/download.xml#download');
 }
 
 richlistitem[type="download"]:not([selected]) button {
   /* Only focus buttons in the selected item. */
   -moz-user-focus: none;
 }
 
-.downloadsHideDropmarker > #downloadsFooterButtonsSplitter,
-.downloadsHideDropmarker > #downloadsFooterDropmarker {
-  display: none;
-}
-
 richlistitem[type="download"].download-state[state="1"]:not([exists]) > .downloadButtonArea,
 richlistitem[type="download"].download-state[state="1"]:not([exists]) > toolbarseparator {
   display: none;
 }
 
 #downloadsSummary:not([inprogress]) > vbox > #downloadsSummaryProgress,
 #downloadsSummary:not([inprogress]) > vbox > #downloadsSummaryDetails,
 #downloadsFooter:not([showingsummary]) #downloadsSummary {
   display: none;
 }
 
-#downloadsFooter[showingdropdown] > stack > #downloadsSummary,
 #downloadsFooter[showingsummary] > stack:hover > #downloadsSummary,
-#downloadsFooter[showingsummary]:not([showingdropdown]) > stack:not(:hover) > #downloadsFooterButtons {
+#downloadsFooter[showingsummary] > stack:not(:hover) > #downloadsFooterButtons {
   /* If we used "visibility: hidden;" then the mouseenter event of
      #downloadsHistory wouldn't be triggered immediately, and the hover styling
      of the button would not apply until the mouse is moved again.
 
      "-moz-user-focus: ignore;" prevents the elements with "opacity: 0;" from
      being focused with the keyboard. */
   opacity: 0;
   -moz-user-focus: ignore;
--- a/browser/components/downloads/content/downloads.js
+++ b/browser/components/downloads/content/downloads.js
@@ -219,24 +219,16 @@ const DownloadsPanel = {
 
     if (this.isPanelShowing) {
       DownloadsCommon.log("Panel is already showing - focusing instead.");
       this._focusPanel();
       return;
     }
 
     this.initialize(() => {
-      let downloadsFooterButtons =
-        document.getElementById("downloadsFooterButtons");
-      if (DownloadsCommon.showPanelDropmarker) {
-        downloadsFooterButtons.classList.remove("downloadsHideDropmarker");
-      } else {
-        downloadsFooterButtons.classList.add("downloadsHideDropmarker");
-      }
-
       // Delay displaying the panel because this function will sometimes be
       // called while another window is closing (like the window for selecting
       // whether to save or open the file), and that would cause the panel to
       // close immediately.
       setTimeout(() => this._openPopupIfDataReady(), 0);
     });
 
     DownloadsCommon.log("Waiting for the downloads panel to appear.");
@@ -382,55 +374,30 @@ const DownloadsPanel = {
 
     // Allow the anchor to be hidden.
     DownloadsButton.releaseAnchor();
 
     // Allow the panel to be reopened.
     this._state = this.kStateHidden;
   },
 
-  onFooterPopupShowing(aEvent) {
-    let itemClearList = document.getElementById("downloadsDropdownItemClearList");
-    if (DownloadsCommon.getData(window).canRemoveFinished) {
-      itemClearList.removeAttribute("hidden");
-    } else {
-      itemClearList.setAttribute("hidden", "true");
-    }
-    DownloadsViewController.updateCommands();
-
-    document.getElementById("downloadsFooter")
-      .setAttribute("showingdropdown", true);
-  },
-
-  onFooterPopupHidden(aEvent) {
-    document.getElementById("downloadsFooter")
-      .removeAttribute("showingdropdown");
-  },
-
   // Related operations
 
   /**
    * Shows or focuses the user interface dedicated to downloads history.
    */
   showDownloadsHistory() {
     DownloadsCommon.log("Showing download history.");
     // Hide the panel before showing another window, otherwise focus will return
     // to the browser window when the panel closes automatically.
     this.hidePanel();
 
     BrowserDownloadsUI();
   },
 
-  openDownloadsFolder() {
-    Downloads.getPreferredDownloadsDirectory().then(downloadsPath => {
-      DownloadsCommon.showDirectory(new FileUtils.File(downloadsPath));
-    }).catch(Cu.reportError);
-    this.hidePanel();
-  },
-
   // Internal functions
 
   /**
    * Attach event listeners to a panel element. These listeners should be
    * removed in _unattachEventListeners. This is called automatically after the
    * panel has successfully loaded.
    */
   _attachEventListeners() {
--- a/browser/components/downloads/content/downloadsOverlay.xul
+++ b/browser/components/downloads/content/downloadsOverlay.xul
@@ -149,33 +149,16 @@
               </hbox>
               <hbox id="downloadsFooterButtons">
                 <button id="downloadsHistory"
                         class="downloadsPanelFooterButton"
                         label="&downloadsHistory.label;"
                         accesskey="&downloadsHistory.accesskey;"
                         flex="1"
                         oncommand="DownloadsPanel.showDownloadsHistory();"/>
-                <toolbarseparator id="downloadsFooterButtonsSplitter"
-                        class="downloadsDropmarkerSplitter"/>
-                <button id="downloadsFooterDropmarker"
-                        class="downloadsPanelFooterButton downloadsDropmarker"
-                        type="menu">
-                  <menupopup id="downloadSubPanel"
-                             onpopupshowing="DownloadsPanel.onFooterPopupShowing(event);"
-                             onpopuphidden="DownloadsPanel.onFooterPopupHidden(event);"
-                             position="after_end">
-                    <menuitem id="downloadsDropdownItemClearList"
-                              command="downloadsCmd_clearList"
-                              label="&cmd.clearList2.label;"/>
-                    <menuitem id="downloadsDropdownItemOpenDownloadsFolder"
-                              oncommand="DownloadsPanel.openDownloadsFolder();"
-                              label="&openDownloadsFolder.label;"/>
-                  </menupopup>
-                </button>
               </hbox>
             </stack>
           </vbox>
         </panelview>
 
         <panelview id="downloadsPanel-blockedSubview"
                    orient="vertical"
                    flex="1">
--- a/browser/components/downloads/test/browser/browser.ini
+++ b/browser/components/downloads/test/browser/browser.ini
@@ -7,10 +7,9 @@ skip-if = os == "linux" # Bug 949434
 [browser_overflow_anchor.js]
 skip-if = os == "linux" # Bug 952422
 [browser_confirm_unblock_download.js]
 [browser_iframe_gone_mid_download.js]
 [browser_indicatorDrop.js]
 [browser_libraryDrop.js]
 [browser_downloads_panel_block.js]
 skip-if = true # Bug 1352792
-[browser_downloads_panel_footer.js]
 [browser_downloads_panel_height.js]
deleted file mode 100644
--- a/browser/components/downloads/test/browser/browser_downloads_panel_footer.js
+++ /dev/null
@@ -1,95 +0,0 @@
-"use strict";
-
-function *task_openDownloadsSubPanel() {
-  let downloadSubPanel = document.getElementById("downloadSubPanel");
-  let popupShownPromise = BrowserTestUtils.waitForEvent(downloadSubPanel, "popupshown");
-
-  let downloadsDropmarker = document.getElementById("downloadsFooterDropmarker");
-  EventUtils.synthesizeMouseAtCenter(downloadsDropmarker, {}, window);
-
-  yield popupShownPromise;
-}
-
-add_task(function* test_openDownloadsFolder() {
-  yield SpecialPowers.pushPrefEnv({"set": [["browser.download.showPanelDropmarker", true]]});
-  yield task_openPanel();
-
-  yield task_openDownloadsSubPanel();
-
-  yield new Promise(resolve => {
-    sinon.stub(DownloadsCommon, "showDirectory", file => {
-      resolve(Downloads.getPreferredDownloadsDirectory().then(downloadsPath => {
-        is(file.path, downloadsPath, "Check the download folder path.");
-      }));
-    });
-
-    let itemOpenDownloadsFolder =
-      document.getElementById("downloadsDropdownItemOpenDownloadsFolder");
-    EventUtils.synthesizeMouseAtCenter(itemOpenDownloadsFolder, {}, window);
-  });
-
-  yield task_resetState();
-});
-
-add_task(function* test_clearList() {
-  const kTestCases = [{
-    downloads: [
-      { state: DownloadsCommon.DOWNLOAD_NOTSTARTED },
-      { state: DownloadsCommon.DOWNLOAD_FINISHED },
-      { state: DownloadsCommon.DOWNLOAD_FAILED },
-      { state: DownloadsCommon.DOWNLOAD_CANCELED },
-    ],
-    expectClearListShown: true,
-    expectedItemNumber: 0,
-  }, {
-    downloads: [
-      { state: DownloadsCommon.DOWNLOAD_NOTSTARTED },
-      { state: DownloadsCommon.DOWNLOAD_FINISHED },
-      { state: DownloadsCommon.DOWNLOAD_FAILED },
-      { state: DownloadsCommon.DOWNLOAD_PAUSED },
-      { state: DownloadsCommon.DOWNLOAD_CANCELED },
-    ],
-    expectClearListShown: true,
-    expectedItemNumber: 1,
-  }, {
-    downloads: [
-      { state: DownloadsCommon.DOWNLOAD_PAUSED },
-    ],
-    expectClearListShown: false,
-    expectedItemNumber: 1,
-  }];
-
-  for (let testCase of kTestCases) {
-    yield verify_clearList(testCase);
-  }
-});
-
-function *verify_clearList(testCase) {
-  let downloads = testCase.downloads;
-  yield task_addDownloads(downloads);
-
-  yield task_openPanel();
-  is(DownloadsView._downloads.length, downloads.length,
-    "Expect the number of download items");
-
-  yield task_openDownloadsSubPanel();
-
-  let itemClearList = document.getElementById("downloadsDropdownItemClearList");
-  let itemNumberPromise = BrowserTestUtils.waitForCondition(() => {
-    return DownloadsView._downloads.length === testCase.expectedItemNumber;
-  });
-  if (testCase.expectClearListShown) {
-    isnot("true", itemClearList.getAttribute("hidden"),
-      "Should show Clear Preview Panel button");
-    EventUtils.synthesizeMouseAtCenter(itemClearList, {}, window);
-  } else {
-    is("true", itemClearList.getAttribute("hidden"),
-      "Should not show Clear Preview Panel button");
-  }
-
-  yield itemNumberPromise;
-  is(DownloadsView._downloads.length, testCase.expectedItemNumber,
-    "Download items remained.");
-
-  yield task_resetState();
-}
--- a/browser/locales/en-US/chrome/browser/downloads/downloads.dtd
+++ b/browser/locales/en-US/chrome/browser/downloads/downloads.dtd
@@ -129,17 +129,21 @@
 <!-- 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 openDownloadsFolder.label       "Open Downloads Folder">
+<!-- LOCALIZATION NOTE (openDownloadsFolder.label):
+     This command is not currently available in the user interface, but the
+     string was preserved by bug 1362207 to be used in a future version.
+     -->
+<!ENTITY openDownloadsFolder.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.
      -->
--- a/browser/themes/shared/downloads/downloads.inc.css
+++ b/browser/themes/shared/downloads/downloads.inc.css
@@ -92,64 +92,24 @@
   padding: 0;
 }
 
 #downloadsHistory {
   padding-inline-start: 10px;
   padding-inline-end: 10px;
 }
 
-#downloadsPanel[hasdownloads] #downloadsFooterButtons:not(.downloadsHideDropmarker) > #downloadsHistory {
-  padding-inline-start: 68px;
-}
-
-toolbarseparator.downloadsDropmarkerSplitter {
-  margin: 7px 0;
-}
-
 @item@ > toolbarseparator {
   margin: 10px 0;
 }
 
-@item@:hover > toolbarseparator,
-#downloadsFooter:hover toolbarseparator.downloadsDropmarkerSplitter,
-#downloadsFooter[showingdropdown] toolbarseparator {
+@item@:hover > toolbarseparator {
   margin: 0;
 }
 
-.downloadsDropmarker {
-  padding: 0 21px;
-}
-
-.downloadsDropmarker > .button-box > hbox {
-  display: none;
-}
-
-.downloadsDropmarker > .button-box > .button-menu-dropmarker {
-  /* This is to override the linux !important */
-  -moz-appearance: none !important;
-  display: -moz-box;
-  padding: 0;
-  margin: 0;
-}
-
-.downloadsDropmarker > .button-box > .button-menu-dropmarker > .dropmarker-icon {
-  width: 16px;
-  height: 16px;
-  list-style-image: url("chrome://global/skin/icons/menubutton-dropmarker.svg");
-  filter: url("chrome://global/skin/filters.svg#fill");
-  fill: currentColor;
-}
-
-/* Override default icon size which is too small for this dropdown */
-.downloadsDropmarker > .button-box > .button-menu-dropmarker {
-  width: 16px;
-  height: 16px;
-}
-
 #downloadsSummary {
   -moz-user-focus: normal;
 }
 
 #downloadsSummary > .downloadTypeIcon {
   list-style-image: url("chrome://browser/skin/downloads/download-summary.svg");
 }