зеркало из https://github.com/mozilla/gecko-dev.git
Bug 333831 - Reimplement click-and-hold access to the back and forward session history menus. r=mconnor, uir=beltzner.
This commit is contained in:
Родитель
6155ecee0e
Коммит
a46dd9fa5d
|
@ -119,6 +119,10 @@ var gFormFillEnabled = true;
|
||||||
var gURLBarAutoFillPrefListener = null;
|
var gURLBarAutoFillPrefListener = null;
|
||||||
var gAutoHideTabbarPrefListener = null;
|
var gAutoHideTabbarPrefListener = null;
|
||||||
|
|
||||||
|
#ifdef XP_MACOSX
|
||||||
|
var gClickAndHoldTimer = null;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We can avoid adding multiple load event listeners and save some time by adding
|
* We can avoid adding multiple load event listeners and save some time by adding
|
||||||
* one listener that calls all real handlers.
|
* one listener that calls all real handlers.
|
||||||
|
@ -195,6 +199,58 @@ function UpdateBackForwardButtons()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XP_MACOSX
|
||||||
|
/**
|
||||||
|
* Click-and-Hold implementation for the Back and Forward buttons
|
||||||
|
* XXXmano: should this live in toolbarbutton.xml?
|
||||||
|
*/
|
||||||
|
function ClickAndHoldMouseDownCallback(aButton)
|
||||||
|
{
|
||||||
|
aButton.open = true;
|
||||||
|
gClickAndHoldTimer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ClickAndHoldMouseDown(aEvent)
|
||||||
|
{
|
||||||
|
if (aEvent.target.getAttribute("anonid") != "button")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var button = aEvent.target.parentNode.parentNode;
|
||||||
|
if (!button.disabled)
|
||||||
|
gClickAndHoldTimer = setTimeout(ClickAndHoldMouseDownCallback, 500, button);
|
||||||
|
}
|
||||||
|
|
||||||
|
function MayStopClickAndHoldTimer(aEvent)
|
||||||
|
{
|
||||||
|
// Note passing null here is a no-op
|
||||||
|
clearTimeout(gClickAndHoldTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetClickAndHoldHandlers()
|
||||||
|
{
|
||||||
|
function _addClickAndHoldListenersOnElement(aElm)
|
||||||
|
{
|
||||||
|
aElm.addEventListener("mousedown",
|
||||||
|
ClickAndHoldMouseDown,
|
||||||
|
false);
|
||||||
|
aElm.addEventListener("mouseup",
|
||||||
|
MayStopClickAndHoldTimer,
|
||||||
|
false);
|
||||||
|
aElm.addEventListener("mouseout",
|
||||||
|
MayStopClickAndHoldTimer,
|
||||||
|
false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The click-and-hold area does not include the dropmarkers of the buttons
|
||||||
|
var backButton = document.getAnonymousElementByAttribute
|
||||||
|
(document.getElementById("back-button"), "anonid", "button");
|
||||||
|
var forwardButton = document.getAnonymousElementByAttribute
|
||||||
|
(document.getElementById("forward-button"), "anonid", "button");
|
||||||
|
_addClickAndHoldListenersOnElement(backButton);
|
||||||
|
_addClickAndHoldListenersOnElement(forwardButton);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef MOZ_PLACES
|
#ifndef MOZ_PLACES
|
||||||
function UpdateBookmarkAllTabsMenuitem()
|
function UpdateBookmarkAllTabsMenuitem()
|
||||||
{
|
{
|
||||||
|
@ -1015,6 +1071,13 @@ function delayedStartup()
|
||||||
document.getElementById("textfieldDirection-separator").hidden = false;
|
document.getElementById("textfieldDirection-separator").hidden = false;
|
||||||
document.getElementById("textfieldDirection-swap").hidden = false;
|
document.getElementById("textfieldDirection-swap").hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XP_MACOSX
|
||||||
|
// Setup click-and-hold gestures access to the session history
|
||||||
|
// menus if global click-and-hold isn't turned on
|
||||||
|
if (!getBoolPref("ui.click_hold_context_menus", false))
|
||||||
|
SetClickAndHoldHandlers();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
function BrowserShutdown()
|
function BrowserShutdown()
|
||||||
|
|
|
@ -163,7 +163,7 @@
|
||||||
<toolbarbutton id="back-button" type="menu-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
<toolbarbutton id="back-button" type="menu-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||||
chromedir="&locale.dir;"
|
chromedir="&locale.dir;"
|
||||||
label="&backCmd.label;"
|
label="&backCmd.label;"
|
||||||
oncommand="BrowserBack(event)"
|
oncommand="if (!this.open) BrowserBack(event)"
|
||||||
onclick="checkForMiddleClick(this, event);"
|
onclick="checkForMiddleClick(this, event);"
|
||||||
context="backMenu"
|
context="backMenu"
|
||||||
tooltiptext="&backButton.tooltip;">
|
tooltiptext="&backButton.tooltip;">
|
||||||
|
@ -177,7 +177,7 @@
|
||||||
<toolbarbutton id="forward-button" type="menu-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
<toolbarbutton id="forward-button" type="menu-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||||
chromedir="&locale.dir;"
|
chromedir="&locale.dir;"
|
||||||
label="&forwardCmd.label;"
|
label="&forwardCmd.label;"
|
||||||
oncommand="BrowserForward(event)"
|
oncommand="if (!this.open) BrowserForward(event)"
|
||||||
onclick="checkForMiddleClick(this, event);"
|
onclick="checkForMiddleClick(this, event);"
|
||||||
context="forwardMenu"
|
context="forwardMenu"
|
||||||
tooltiptext="&forwardButton.tooltip;">
|
tooltiptext="&forwardButton.tooltip;">
|
||||||
|
|
|
@ -274,7 +274,8 @@ menubutton:not([disabled="true"]):hover:active {
|
||||||
#back-button {
|
#back-button {
|
||||||
-moz-image-region: rect(0px 32px 32px 0px);
|
-moz-image-region: rect(0px 32px 32px 0px);
|
||||||
}
|
}
|
||||||
#back-button[buttondown="true"] {
|
#back-button[buttondown="true"],
|
||||||
|
#back-button[open="true"] {
|
||||||
-moz-image-region: rect(32px 32px 64px 0px);
|
-moz-image-region: rect(32px 32px 64px 0px);
|
||||||
}
|
}
|
||||||
#back-button[disabled="true"] {
|
#back-button[disabled="true"] {
|
||||||
|
@ -284,7 +285,8 @@ menubutton:not([disabled="true"]):hover:active {
|
||||||
#forward-button {
|
#forward-button {
|
||||||
-moz-image-region: rect(0px 64px 32px 32px);
|
-moz-image-region: rect(0px 64px 32px 32px);
|
||||||
}
|
}
|
||||||
#forward-button[buttondown="true"] {
|
#forward-button[buttondown="true"],
|
||||||
|
#forward-button[open="true"] {
|
||||||
-moz-image-region: rect(32px 64px 64px 32px);
|
-moz-image-region: rect(32px 64px 64px 32px);
|
||||||
}
|
}
|
||||||
#forward-button[disabled="true"] {
|
#forward-button[disabled="true"] {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче