зеркало из https://github.com/mozilla/pjs.git
Bug 335675 - Shortcomings of the click-and-hold implementation of bug 333831. patch from Simon Bnzli <zeniko@gmail.com>, r=me.
This commit is contained in:
Родитель
89257db6ee
Коммит
a5febf48d8
|
@ -216,10 +216,11 @@ function ClickAndHoldMouseDownCallback(aButton)
|
|||
|
||||
function ClickAndHoldMouseDown(aEvent)
|
||||
{
|
||||
if (aEvent.target.getAttribute("anonid") != "button")
|
||||
if (aEvent.button != 0 || aEvent.target.getAttribute("anonid") != "button")
|
||||
return;
|
||||
|
||||
var button = aEvent.target.parentNode.parentNode;
|
||||
// relying on button.xml#menu-button-base internals for improved theme compatibility
|
||||
var button = aEvent.target._menubuttonParent;
|
||||
if (!button.disabled)
|
||||
gClickAndHoldTimer = setTimeout(ClickAndHoldMouseDownCallback, 500, button);
|
||||
}
|
||||
|
@ -230,6 +231,12 @@ function MayStopClickAndHoldTimer(aEvent)
|
|||
clearTimeout(gClickAndHoldTimer);
|
||||
}
|
||||
|
||||
function ClickAndHoldStopEvent(aEvent)
|
||||
{
|
||||
if (aEvent.target._menubuttonParent.open)
|
||||
aEvent.stopPropagation();
|
||||
}
|
||||
|
||||
function SetClickAndHoldHandlers()
|
||||
{
|
||||
function _addClickAndHoldListenersOnElement(aElm)
|
||||
|
@ -243,15 +250,26 @@ function SetClickAndHoldHandlers()
|
|||
aElm.addEventListener("mouseout",
|
||||
MayStopClickAndHoldTimer,
|
||||
false);
|
||||
|
||||
// don't propagate onclick and oncommand events after
|
||||
// click-and-hold opened the drop-down menu
|
||||
aElm.addEventListener("command",
|
||||
ClickAndHoldStopEvent,
|
||||
false);
|
||||
aElm.addEventListener("click",
|
||||
ClickAndHoldStopEvent,
|
||||
false);
|
||||
}
|
||||
|
||||
// The click-and-hold area does not include the dropmarkers of the buttons
|
||||
var backButton = document.getAnonymousElementByAttribute
|
||||
(document.getElementById("back-button"), "anonid", "button");
|
||||
if (backButton)
|
||||
_addClickAndHoldListenersOnElement(backButton);
|
||||
var forwardButton = document.getAnonymousElementByAttribute
|
||||
(document.getElementById("forward-button"), "anonid", "button");
|
||||
_addClickAndHoldListenersOnElement(backButton);
|
||||
_addClickAndHoldListenersOnElement(forwardButton);
|
||||
if (forwardButton)
|
||||
_addClickAndHoldListenersOnElement(forwardButton);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -3296,6 +3314,12 @@ function BrowserToolboxCustomizeDone(aToolboxChanged)
|
|||
document.getElementById("Browser:Reload").getAttribute("disabled") == "true";
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// make sure to re-enable click-and-hold
|
||||
if (!getBoolPref("ui.click_hold_context_menus", false))
|
||||
SetClickAndHoldHandlers();
|
||||
#endif
|
||||
|
||||
#ifndef MOZ_PLACES
|
||||
// fix up the personal toolbar folder
|
||||
var bt = document.getElementById("bookmarks-ptf");
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
<toolbarbutton id="back-button" type="menu-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||
chromedir="&locale.dir;"
|
||||
label="&backCmd.label;"
|
||||
oncommand="if (!this.open) BrowserBack(event)"
|
||||
oncommand="BrowserBack(event)"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
context="backMenu"
|
||||
tooltiptext="&backButton.tooltip;">
|
||||
|
@ -177,7 +177,7 @@
|
|||
<toolbarbutton id="forward-button" type="menu-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
|
||||
chromedir="&locale.dir;"
|
||||
label="&forwardCmd.label;"
|
||||
oncommand="if (!this.open) BrowserForward(event)"
|
||||
oncommand="BrowserForward(event)"
|
||||
onclick="checkForMiddleClick(this, event);"
|
||||
context="forwardMenu"
|
||||
tooltiptext="&forwardButton.tooltip;">
|
||||
|
|
Загрузка…
Ссылка в новой задаче