Bug 1406625 - Remove leftover code and styling for <toolbarbutton type="menu-button">
MozReview-Commit-ID: 8wBsluIMZHq
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -1673,18 +1673,16 @@ var CustomizableUIInternal = {
// whether we're in an input container (text field)
let inInput = false;
// whether we're in a popup/context menu
let inMenu = false;
// whether we're in a toolbarbutton/toolbaritem
let inItem = false;
// whether the current menuitem has a valid closemenu attribute
let menuitemCloseMenu = "auto";
- // whether the toolbarbutton/item has a valid closemenu attribute.
- let closemenu = "auto";
// While keeping track of that, we go from the original target back up,
// to the panel if we have to. We bail as soon as we find an input,
// a toolbarbutton/item, or the panel:
while (true && target) {
// Skip out of iframes etc:
if (target.nodeType == target.DOCUMENT_NODE) {
if (!target.defaultView) {
@@ -1700,21 +1698,16 @@ var CustomizableUIInternal = {
break;
}
}
let tagName = target.localName;
inInput = tagName == "input" || tagName == "textbox";
inItem = tagName == "toolbaritem" || tagName == "toolbarbutton";
let isMenuItem = tagName == "menuitem";
inMenu = inMenu || isMenuItem;
- if (inItem && target.hasAttribute("closemenu")) {
- let closemenuVal = target.getAttribute("closemenu");
- closemenu = (closemenuVal == "single" || closemenuVal == "none") ?
- closemenuVal : "auto";
- }
if (isMenuItem && target.hasAttribute("closemenu")) {
let closemenuVal = target.getAttribute("closemenu");
menuitemCloseMenu = (closemenuVal == "single" || closemenuVal == "none") ?
closemenuVal : "auto";
}
// Break out of the loop immediately for disabled items, as we need to
// keep the menu open in that case.
@@ -1748,27 +1741,16 @@ var CustomizableUIInternal = {
// Otherwise, we're probably fine to close the panel
return false;
}
// If we're not in a menu, and we *are* in a type="menu" toolbarbutton,
// we'll now interact with the menu
if (inItem && target.getAttribute("type") == "menu") {
return true;
}
- // If we're not in a menu, and we *are* in a type="menu-button" toolbarbutton,
- // it depends whether we're in the dropmarker or the 'real' button:
- if (inItem && target.getAttribute("type") == "menu-button") {
- // 'real' button (which has a single action):
- if (target.getAttribute("anonid") == "button") {
- return closemenu != "none";
- }
- // otherwise, this is the outer button, and the user will now
- // interact with the menu:
- return true;
- }
return inInput || !inItem;
},
hidePanelForNode(aNode) {
let panel = this._getPanelForNode(aNode);
if (panel) {
panel.hidePopup();
}
--- a/browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
+++ b/browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
@@ -18,61 +18,16 @@ add_task(async function plain_button() {
await document.getElementById("nav-bar").overflowable.show();
let hiddenAgain = promiseOverflowHidden(window);
EventUtils.synthesizeMouseAtCenter(button, {});
await hiddenAgain;
CustomizableUI.removeWidgetFromArea(button.id);
button.remove();
});
-/* Clicking a menu button should close the panel, opening the popup shouldn't. */
-add_task(async function menu_button_popup() {
- menuButton = document.createElement("toolbarbutton");
- menuButton.setAttribute("type", "menu-button");
- menuButton.id = "browser_940307_menubutton";
- menuButton.setAttribute("label", "Menu button");
-
- let menuPopup = document.createElement("menupopup");
- menuPopup.id = "browser_940307_menupopup";
-
- let menuItem = document.createElement("menuitem");
- menuItem.setAttribute("label", "Menu item");
- menuItem.id = "browser_940307_menuitem";
-
- menuPopup.appendChild(menuItem);
- menuButton.appendChild(menuPopup);
- gNavToolbox.palette.appendChild(menuButton);
- CustomizableUI.addWidgetToArea(menuButton.id, CustomizableUI.AREA_FIXED_OVERFLOW_PANEL);
-
- await waitForOverflowButtonShown();
-
- await document.getElementById("nav-bar").overflowable.show();
- let hiddenAgain = promiseOverflowHidden(window);
- let innerButton = document.getAnonymousElementByAttribute(menuButton, "anonid", "button");
- EventUtils.synthesizeMouseAtCenter(innerButton, {});
- await hiddenAgain;
-
- // Now click the dropmarker to show the menu
- await document.getElementById("nav-bar").overflowable.show();
- hiddenAgain = promiseOverflowHidden(window);
- let menuShown = promisePanelElementShown(window, menuPopup);
- let dropmarker = document.getAnonymousElementByAttribute(menuButton, "type", "menu-button");
- EventUtils.synthesizeMouseAtCenter(dropmarker, {});
- await menuShown;
- // Panel should stay open:
- ok(isOverflowOpen(), "Panel should still be open");
- let menuHidden = promisePanelElementHidden(window, menuPopup);
- // Then click the menu item to close all the things
- EventUtils.synthesizeMouseAtCenter(menuItem, {});
- await menuHidden;
- await hiddenAgain;
- CustomizableUI.removeWidgetFromArea(menuButton.id);
- menuButton.remove();
-});
-
add_task(async function searchbar_in_panel() {
CustomizableUI.addWidgetToArea("search-container",
CustomizableUI.AREA_FIXED_OVERFLOW_PANEL);
await waitForOverflowButtonShown();
await document.getElementById("nav-bar").overflowable.show();
--- a/browser/themes/shared/customizableui/customizeMode.inc.css
+++ b/browser/themes/shared/customizableui/customizeMode.inc.css
@@ -197,28 +197,26 @@ toolbarpaletteitem[notransition].panel-c
toolbarpaletteitem[notransition][place="toolbar"],
toolbarpaletteitem[notransition][place="palette"],
toolbarpaletteitem[notransition][place="panel"] {
transition: none;
}
toolbarpaletteitem > toolbarbutton > .toolbarbutton-icon,
toolbarpaletteitem > toolbarbutton > .toolbarbutton-badge-stack > .toolbarbutton-icon,
-toolbarpaletteitem > toolbaritem.panel-wide-item,
-toolbarpaletteitem > toolbarbutton[type="menu-button"] {
+toolbarpaletteitem > toolbaritem.panel-wide-item {
transition: transform var(--drag-drop-transition-duration) cubic-bezier(.6, 2, .75, 1.5) !important;
}
toolbarpaletteitem[mousedown] > toolbarbutton > .toolbarbutton-icon,
toolbarpaletteitem[mousedown] > toolbarbutton > .toolbarbutton-badge-stack > .toolbarbutton-icon {
transform: scale(1.3);
}
-toolbarpaletteitem[mousedown] > toolbaritem.panel-wide-item,
-toolbarpaletteitem[mousedown] > toolbarbutton[type="menu-button"] {
+toolbarpaletteitem[mousedown] > toolbaritem.panel-wide-item {
transform: scale(1.1);
}
/* Override the toolkit styling for items being dragged over. */
toolbarpaletteitem[place="toolbar"] {
border-left-width: 0;
border-right-width: 0;
margin-right: 0;