mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
Bug 856264 - Defect - if context menu visible, tapping and holding another link will not produce new context menu. r=jmathies
--HG-- extra : rebase_source : 20cb8c50b490bdbc13001974f37eb6409e735c09
This commit is contained in:
parent
83ae573f9f
commit
3df1d5c676
@ -338,6 +338,7 @@ function MenuPopup(aPanel, aPopup) {
|
||||
this._panel = aPanel;
|
||||
this._popup = aPopup;
|
||||
this._wantTypeBehind = false;
|
||||
this._willReshowPopup = false;
|
||||
|
||||
window.addEventListener('MozAppbarShowing', this, false);
|
||||
}
|
||||
@ -346,9 +347,19 @@ MenuPopup.prototype = {
|
||||
get _commands() { return this._popup.childNodes[0]; },
|
||||
|
||||
show: function (aPositionOptions) {
|
||||
if (this._visible)
|
||||
return;
|
||||
if (this._visible) {
|
||||
this._willReshowPopup = true;
|
||||
let self = this;
|
||||
this._panel.addEventListener("transitionend", function () {
|
||||
self._show(aPositionOptions);
|
||||
self._panel.removeEventListener("transitionend", arguments.callee);
|
||||
});
|
||||
} else {
|
||||
this._show(aPositionOptions);
|
||||
}
|
||||
},
|
||||
|
||||
_show: function (aPositionOptions) {
|
||||
window.addEventListener("keypress", this, true);
|
||||
window.addEventListener("mousedown", this, true);
|
||||
Elements.stack.addEventListener("PopupChanged", this, false);
|
||||
@ -362,9 +373,12 @@ MenuPopup.prototype = {
|
||||
self._panel.removeEventListener("transitionend", arguments.callee);
|
||||
self._panel.removeAttribute("showingfrom");
|
||||
|
||||
let eventName = self._willReshowPopup ? "popupmoved" : "popupshown";
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent("popupshown", true, false);
|
||||
document.dispatchEvent(event);
|
||||
event.initEvent(eventName, true, false);
|
||||
self._panel.dispatchEvent(event);
|
||||
|
||||
self._willReshowPopup = false;
|
||||
});
|
||||
|
||||
let popupFrom = !aPositionOptions.bottomAligned ? "above" : "below";
|
||||
@ -393,9 +407,11 @@ MenuPopup.prototype = {
|
||||
self._popup.style.maxWidth = "none";
|
||||
self._popup.style.maxHeight = "none";
|
||||
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent("popuphidden", true, false);
|
||||
document.dispatchEvent(event);
|
||||
if (!self._willReshowPopup) {
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent("popuphidden", true, false);
|
||||
self._panel.dispatchEvent(event);
|
||||
}
|
||||
});
|
||||
|
||||
this._panel.setAttribute("hiding", "true");
|
||||
|
Loading…
Reference in New Issue
Block a user