зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1298313 - Revert the third patch from bug 1256339 because it broke long-press context menus in non-e10s mode. r=backout
MozReview-Commit-ID: FZEbH0TlY8L
This commit is contained in:
Родитель
ed976e566d
Коммит
fd9d34fba8
|
@ -83,9 +83,7 @@ addEventListener("blur", function(event) {
|
|||
LoginManagerContent.onUsernameInput(event);
|
||||
});
|
||||
|
||||
var gLastContextMenuEvent = null; // null or a WeakReference to a contextmenu event
|
||||
var handleContentContextMenu = function (event) {
|
||||
gLastContextMenuEvent = null;
|
||||
let defaultPrevented = event.defaultPrevented;
|
||||
if (!Services.prefs.getBoolPref("dom.event.contextmenu.enabled")) {
|
||||
let plugin = null;
|
||||
|
@ -100,36 +98,8 @@ var handleContentContextMenu = function (event) {
|
|||
defaultPrevented = false;
|
||||
}
|
||||
|
||||
if (defaultPrevented) {
|
||||
if (defaultPrevented)
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.mozInputSource == Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH) {
|
||||
// If this was triggered by touch, then we don't want to show the actual
|
||||
// context menu until we get the APZ:LongTapUp notification. However, we
|
||||
// will need the |event| object when we get that notification, so we save
|
||||
// it in a WeakReference. That way it won't leak things if we never get
|
||||
// the APZ:LongTapUp notification (which is quite possible).
|
||||
gLastContextMenuEvent = Cu.getWeakReference(event);
|
||||
return;
|
||||
}
|
||||
|
||||
// For non-touch-derived contextmenu events, we can handle it right away.
|
||||
showContentContextMenu(event);
|
||||
}
|
||||
|
||||
var showContentContextMenu = function (event) {
|
||||
if (event == null) {
|
||||
// If we weren't given an event, then this is being invoked from the
|
||||
// APZ:LongTapUp observer, and the contextmenu event is stashed in
|
||||
// gLastContextMenuEvent.
|
||||
event = (gLastContextMenuEvent ? gLastContextMenuEvent.get() : null);
|
||||
gLastContextMenuEvent = null;
|
||||
if (event == null) {
|
||||
// Still no event? We can't do anything, bail out.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let addonInfo = {};
|
||||
let subject = {
|
||||
|
@ -247,11 +217,6 @@ Cc["@mozilla.org/eventlistenerservice;1"]
|
|||
.getService(Ci.nsIEventListenerService)
|
||||
.addSystemEventListener(global, "contextmenu", handleContentContextMenu, false);
|
||||
|
||||
Services.obs.addObserver(showContentContextMenu, "APZ:LongTapUp", false);
|
||||
addEventListener("unload", () => {
|
||||
Services.obs.removeObserver(showContentContextMenu, "APZ:LongTapUp")
|
||||
}, false);
|
||||
|
||||
// Values for telemtery bins: see TLS_ERROR_REPORT_UI in Histograms.json
|
||||
const TLS_ERROR_REPORT_TELEMETRY_UI_SHOWN = 0;
|
||||
const TLS_ERROR_REPORT_TELEMETRY_EXPANDED = 1;
|
||||
|
|
|
@ -5211,14 +5211,6 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
|
|||
|
||||
case WM_CONTEXTMENU:
|
||||
{
|
||||
// If the context menu is brought up by a touch long-press, then
|
||||
// the APZ code is responsble for dealing with this, so we don't
|
||||
// need to do anything.
|
||||
if (mAPZC && MOUSE_INPUT_SOURCE() == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// if the context menu is brought up from the keyboard, |lParam|
|
||||
// will be -1.
|
||||
LPARAM pos;
|
||||
|
|
Загрузка…
Ссылка в новой задаче