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:
Jonathan Wilde 2013-07-15 10:58:26 -07:00
Родитель 83ae573f9f
Коммит 3df1d5c676
1 изменённых файлов: 23 добавлений и 7 удалений

Просмотреть файл

@ -338,6 +338,7 @@ function MenuPopup(aPanel, aPopup) {
this._panel = aPanel; this._panel = aPanel;
this._popup = aPopup; this._popup = aPopup;
this._wantTypeBehind = false; this._wantTypeBehind = false;
this._willReshowPopup = false;
window.addEventListener('MozAppbarShowing', this, false); window.addEventListener('MozAppbarShowing', this, false);
} }
@ -346,9 +347,19 @@ MenuPopup.prototype = {
get _commands() { return this._popup.childNodes[0]; }, get _commands() { return this._popup.childNodes[0]; },
show: function (aPositionOptions) { show: function (aPositionOptions) {
if (this._visible) if (this._visible) {
return; 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("keypress", this, true);
window.addEventListener("mousedown", this, true); window.addEventListener("mousedown", this, true);
Elements.stack.addEventListener("PopupChanged", this, false); Elements.stack.addEventListener("PopupChanged", this, false);
@ -362,9 +373,12 @@ MenuPopup.prototype = {
self._panel.removeEventListener("transitionend", arguments.callee); self._panel.removeEventListener("transitionend", arguments.callee);
self._panel.removeAttribute("showingfrom"); self._panel.removeAttribute("showingfrom");
let eventName = self._willReshowPopup ? "popupmoved" : "popupshown";
let event = document.createEvent("Events"); let event = document.createEvent("Events");
event.initEvent("popupshown", true, false); event.initEvent(eventName, true, false);
document.dispatchEvent(event); self._panel.dispatchEvent(event);
self._willReshowPopup = false;
}); });
let popupFrom = !aPositionOptions.bottomAligned ? "above" : "below"; let popupFrom = !aPositionOptions.bottomAligned ? "above" : "below";
@ -393,9 +407,11 @@ MenuPopup.prototype = {
self._popup.style.maxWidth = "none"; self._popup.style.maxWidth = "none";
self._popup.style.maxHeight = "none"; self._popup.style.maxHeight = "none";
let event = document.createEvent("Events"); if (!self._willReshowPopup) {
event.initEvent("popuphidden", true, false); let event = document.createEvent("Events");
document.dispatchEvent(event); event.initEvent("popuphidden", true, false);
self._panel.dispatchEvent(event);
}
}); });
this._panel.setAttribute("hiding", "true"); this._panel.setAttribute("hiding", "true");