Bug 1304617 - Avoid using the ordinal attribute for positioning the Hide / Show Recently Bookmarked menu items. r=mak a=ritu
authorDão Gottwald <dao@mozilla.com>
Thu, 13 Oct 2016 18:47:52 +0200
changeset 358397 0daf6c7927101a76eddf87790bf3e23eb00f0660
parent 358396 8e4ecd97f08cb097ad7e34263f4bbe8daf3ff395
child 358398 c969b37d09730bac645e6fa34c12dcaa9a89f9ad
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak, ritu
bugs1304617
milestone51.0a2
Bug 1304617 - Avoid using the ordinal attribute for positioning the Hide / Show Recently Bookmarked menu items. r=mak a=ritu
browser/base/content/browser-places.js
browser/base/content/browser.xul
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -1398,19 +1398,28 @@ var BookmarkingUI = {
       // Update the menu when a bookmark has been removed.
       // The native menubar on Mac doesn't support live update, so this won't
       // work there.
       this._populateRecentBookmarks(aHeaderItem, aExtraCSSClass);
     };
 
     let updatePlacesContextMenu = (shouldHidePrefUI = false) => {
       let prefEnabled = !shouldHidePrefUI && Services.prefs.getBoolPref(this.RECENTLY_BOOKMARKED_PREF);
-      document.getElementById("placesContext_showRecentlyBookmarked").hidden = shouldHidePrefUI || prefEnabled;
-      document.getElementById("placesContext_hideRecentlyBookmarked").hidden = shouldHidePrefUI || !prefEnabled;
-      document.getElementById("placesContext_recentlyBookmarkedSeparator").hidden = shouldHidePrefUI;
+      let showItem = document.getElementById("placesContext_showRecentlyBookmarked");
+      let hideItem = document.getElementById("placesContext_hideRecentlyBookmarked");
+      let separator = document.getElementById("placesContext_recentlyBookmarkedSeparator");
+      showItem.hidden = shouldHidePrefUI || prefEnabled;
+      hideItem.hidden = shouldHidePrefUI || !prefEnabled;
+      separator.hidden = shouldHidePrefUI;
+      if (!shouldHidePrefUI) {
+        // Move to the bottom of the menu.
+        separator.parentNode.appendChild(separator);
+        showItem.parentNode.appendChild(showItem);
+        hideItem.parentNode.appendChild(hideItem);
+      }
     };
 
     let onPlacesContextMenuShowing = event => {
       if (event.target == event.currentTarget) {
         let triggerPopup = event.target.triggerNode;
         while (triggerPopup && triggerPopup.localName != "menupopup") {
           triggerPopup = triggerPopup.parentNode;
         }
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -350,33 +350,30 @@
                               gContextMenu = null;
                               updateEditUIVisibility();">
 #include browser-context.inc
     </menupopup>
 
     <menupopup id="placesContext">
       <menuseparator id="placesContext_recentlyBookmarkedSeparator"
                      ignoreitem="true"
-                     ordinal="2"
                      hidden="true"/>
       <menuitem id="placesContext_hideRecentlyBookmarked"
                 label="&hideRecentlyBookmarked.label;"
                 accesskey="&hideRecentlyBookmarked.accesskey;"
                 oncommand="BookmarkingUI.hideRecentlyBookmarked();"
                 closemenu="single"
                 ignoreitem="true"
-                ordinal="2"
                 hidden="true"/>
       <menuitem id="placesContext_showRecentlyBookmarked"
                 label="&showRecentlyBookmarked.label;"
                 accesskey="&showRecentlyBookmarked.accesskey;"
                 oncommand="BookmarkingUI.showRecentlyBookmarked();"
                 closemenu="single"
                 ignoreitem="true"
-                ordinal="2"
                 hidden="true"/>
     </menupopup>
 
     <panel id="ctrlTab-panel" hidden="true" norestorefocus="true" level="top">
       <hbox>
         <button class="ctrlTab-preview" flex="1"/>
         <button class="ctrlTab-preview" flex="1"/>
         <button class="ctrlTab-preview" flex="1"/>