Bug 1355322 - Add anchor button to urlbar for action menu. r=Gijs

MozReview-Commit-ID: CajXNdGt9cZ

--HG--
extra : rebase_source : 18df66d122108ebba769ed3cada7a8c0847b206f
This commit is contained in:
Drew Willcoxon 2017-04-27 18:17:29 -07:00
parent e1c8207fab
commit 197941aadc
6 changed files with 74 additions and 1 deletions

View File

@ -1604,6 +1604,8 @@ var gBrowserInit = {
}
});
gPageActionButton.init();
this.delayedStartupFinished = true;
Services.obs.notifyObservers(window, "browser-delayed-startup-finished");
@ -7756,6 +7758,38 @@ var gIdentityHandler = {
}
};
var gPageActionButton = {
get button() {
delete this.button;
return this.button = document.getElementById("urlbar-page-action-button");
},
get panel() {
delete this.panel;
return this.panel = document.getElementById("page-action-panel");
},
init() {
if (getBoolPref("browser.photon.structure.enabled")) {
this.button.hidden = false;
}
},
onEvent(event) {
event.stopPropagation();
if ((event.type == "click" && event.button != 0) ||
(event.type == "keypress" && event.charCode != KeyEvent.DOM_VK_SPACE &&
event.keyCode != KeyEvent.DOM_VK_RETURN)) {
return; // Left click, space or enter only
}
this.panel.hidden = false;
this.panel.openPopup(this.button, "bottomcenter topright");
},
};
function getNotificationBox(aWindow) {
var foundBrowser = gBrowser.getBrowserForDocument(aWindow.document);
if (foundBrowser)

View File

@ -405,6 +405,16 @@
</hbox>
</panel>
<panel id="page-action-panel"
role="group"
type="arrow"
hidden="true"
flip="slide"
position="bottomcenter topright"
noautofocus="true">
This space intentionally left blank.
</panel>
<!-- Bookmarks and history tooltip -->
<tooltip id="bhTooltip"/>
@ -802,6 +812,11 @@
class="chromeclass-toolbar-additional"
command="Browser:Stop"
tooltip="dynamic-shortcut-tooltip"/>
<toolbarbutton id="urlbar-page-action-button"
hidden="true"
class="chromeclass-toolbar-additional"
tooltiptext="&pageActionButton.tooltip;"
onclick="gPageActionButton.onEvent(event);"/>
</textbox>
</hbox>
</toolbaritem>

View File

@ -926,3 +926,5 @@ you can use these alternative items. Otherwise, their values should be empty. -
<!ENTITY updateRestart.cancelButton.label "Not Now">
<!ENTITY updateRestart.cancelButton.accesskey "N">
<!ENTITY updateRestart.panelUI.label "Restart &brandShorterName; to apply the update">
<!ENTITY pageActionButton.tooltip "Page actions">

View File

@ -31,4 +31,18 @@
#urlbar-zoom-button > .toolbarbutton-icon {
display: none;
}
}
/* Page action button */
#urlbar-page-action-button {
-moz-appearance: none;
border-style: none;
list-style-image: url("chrome://browser/skin/page-action.svg");
margin: 0;
padding: 0 6px;
fill: currentColor;
}
#urlbar-page-action-button > .toolbarbutton-icon {
width: 16px;
}

View File

@ -143,6 +143,7 @@
skin/classic/browser/compacttheme/urlbar-history-dropmarker.svg (../shared/compacttheme/urlbar-history-dropmarker.svg)
skin/classic/browser/urlbar-star.svg (../shared/urlbar-star.svg)
skin/classic/browser/urlbar-tab.svg (../shared/urlbar-tab.svg)
skin/classic/browser/page-action.svg (../shared/page-action.svg)
skin/classic/browser/menu-icons/new-window.svg (../shared/menu-icons/new-window.svg)
skin/classic/browser/menu-icons/print.svg (../shared/menu-icons/print.svg)
skin/classic/browser/menu-icons/private-window.svg (../shared/menu-icons/private-window.svg)

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<!-- 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/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
<path fill="context-fill" d="M2 6a2 2 0 1 0 2 2 2 2 0 0 0-2-2zm6 0a2 2 0 1 0 2 2 2 2 0 0 0-2-2zm6 0a2 2 0 1 0 2 2 2 2 0 0 0-2-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 439 B