From 197941aadc7ee588752967b036c712780088ed43 Mon Sep 17 00:00:00 2001 From: Drew Willcoxon Date: Thu, 27 Apr 2017 18:17:29 -0700 Subject: [PATCH] Bug 1355322 - Add anchor button to urlbar for action menu. r=Gijs MozReview-Commit-ID: CajXNdGt9cZ --HG-- extra : rebase_source : 18df66d122108ebba769ed3cada7a8c0847b206f --- browser/base/content/browser.js | 34 +++++++++++++++++++ browser/base/content/browser.xul | 15 ++++++++ .../locales/en-US/chrome/browser/browser.dtd | 2 ++ browser/themes/shared/browser.inc.css | 16 ++++++++- browser/themes/shared/jar.inc.mn | 1 + browser/themes/shared/page-action.svg | 7 ++++ 6 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 browser/themes/shared/page-action.svg diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index f2eca5728a06..90b76fa5b6ae 100755 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -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) diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 077e64c49f5a..711418e0d86f 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -405,6 +405,16 @@ + + @@ -802,6 +812,11 @@ class="chromeclass-toolbar-additional" command="Browser:Stop" tooltip="dynamic-shortcut-tooltip"/> +