mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1686045
- Part 2: Allow popups from mousedown and pointerdown events; r=smaug
We allow popups on middle button for mouse events, pointer event should just be consistent with mouse event. Differential Revision: https://phabricator.services.mozilla.com/D101508
This commit is contained in:
parent
00dc0793aa
commit
a25490d52a
@ -323,7 +323,8 @@ PopupBlocker::PopupControlState PopupBlocker::GetEventPopupControlState(
|
|||||||
break;
|
break;
|
||||||
case ePointerEventClass:
|
case ePointerEventClass:
|
||||||
if (aEvent->IsTrusted() &&
|
if (aEvent->IsTrusted() &&
|
||||||
aEvent->AsPointerEvent()->mButton == MouseButton::ePrimary) {
|
(aEvent->AsPointerEvent()->mButton == MouseButton::ePrimary ||
|
||||||
|
aEvent->AsPointerEvent()->mButton == MouseButton::eMiddle)) {
|
||||||
switch (aEvent->mMessage) {
|
switch (aEvent->mMessage) {
|
||||||
case ePointerUp:
|
case ePointerUp:
|
||||||
if (PopupAllowedForEvent("pointerup")) {
|
if (PopupAllowedForEvent("pointerup")) {
|
||||||
|
@ -63,12 +63,12 @@ let target = document.getElementById("target");
|
|||||||
|
|
||||||
add_task(function testMouseDownUpMove() {
|
add_task(function testMouseDownUpMove() {
|
||||||
// Left button
|
// Left button
|
||||||
sendMouseEvent(target, "mousedown", LEFT_BUTTON, "mousedown", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousedown", LEFT_BUTTON, "mousedown", checkAllowOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", LEFT_BUTTON, "mousemove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", LEFT_BUTTON, "mousemove", checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mouseup", LEFT_BUTTON, "mouseup", checkAllowOpenPopup);
|
sendMouseEvent(target, "mouseup", LEFT_BUTTON, "mouseup", checkAllowOpenPopup);
|
||||||
|
|
||||||
// Middle button
|
// Middle button
|
||||||
sendMouseEvent(target, "mousedown", MIDDLE_BUTTON, "mousedown", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousedown", MIDDLE_BUTTON, "mousedown", checkAllowOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", MIDDLE_BUTTON, "mousemove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", MIDDLE_BUTTON, "mousemove", checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mouseup", MIDDLE_BUTTON, "mouseup", checkAllowOpenPopup);
|
sendMouseEvent(target, "mouseup", MIDDLE_BUTTON, "mouseup", checkAllowOpenPopup);
|
||||||
|
|
||||||
|
@ -67,14 +67,14 @@
|
|||||||
add_task(function testPointerEventDefault() {
|
add_task(function testPointerEventDefault() {
|
||||||
// By default, only allow opening popup in the pointerup listener.
|
// By default, only allow opening popup in the pointerup listener.
|
||||||
// Left button
|
// Left button
|
||||||
sendMouseEvent(target, "mousedown", LEFT_BUTTON, "pointerdown", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousedown", LEFT_BUTTON, "pointerdown", checkAllowOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", LEFT_BUTTON, "pointermove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", LEFT_BUTTON, "pointermove", checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mouseup", LEFT_BUTTON, "pointerup", checkAllowOpenPopup);
|
sendMouseEvent(target, "mouseup", LEFT_BUTTON, "pointerup", checkAllowOpenPopup);
|
||||||
|
|
||||||
// Middle button
|
// Middle button
|
||||||
sendMouseEvent(target, "mousedown", MIDDLE_BUTTON, "pointerdown", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousedown", MIDDLE_BUTTON, "pointerdown", checkAllowOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", MIDDLE_BUTTON, "pointermove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", MIDDLE_BUTTON, "pointermove", checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mouseup", MIDDLE_BUTTON, "pointerup", checkBlockOpenPopup);
|
sendMouseEvent(target, "mouseup", MIDDLE_BUTTON, "pointerup", checkAllowOpenPopup);
|
||||||
|
|
||||||
// Right button
|
// Right button
|
||||||
sendMouseEvent(target, "mousedown", RIGHT_BUTTON, "pointerdown", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousedown", RIGHT_BUTTON, "pointerdown", checkBlockOpenPopup);
|
||||||
@ -92,9 +92,9 @@
|
|||||||
sendMouseEvent(target, "mouseup", LEFT_BUTTON, "pointerup", checkAllowOpenPopup);
|
sendMouseEvent(target, "mouseup", LEFT_BUTTON, "pointerup", checkAllowOpenPopup);
|
||||||
|
|
||||||
// Middle button
|
// Middle button
|
||||||
sendMouseEvent(target, "mousedown", MIDDLE_BUTTON, "pointerdown", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousedown", MIDDLE_BUTTON, "pointerdown", checkAllowOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", MIDDLE_BUTTON, "pointermove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", MIDDLE_BUTTON, "pointermove", checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mouseup", MIDDLE_BUTTON, "pointerup", checkBlockOpenPopup);
|
sendMouseEvent(target, "mouseup", MIDDLE_BUTTON, "pointerup", checkAllowOpenPopup);
|
||||||
|
|
||||||
// Right button
|
// Right button
|
||||||
sendMouseEvent(target, "mousedown", RIGHT_BUTTON, "pointerdown", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousedown", RIGHT_BUTTON, "pointerdown", checkBlockOpenPopup);
|
||||||
@ -112,9 +112,9 @@
|
|||||||
sendMouseEvent(target, "mouseup", LEFT_BUTTON, "pointerup", checkAllowOpenPopup);
|
sendMouseEvent(target, "mouseup", LEFT_BUTTON, "pointerup", checkAllowOpenPopup);
|
||||||
|
|
||||||
// Middle button
|
// Middle button
|
||||||
sendMouseEvent(target, "mousedown", MIDDLE_BUTTON, "pointerdown", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousedown", MIDDLE_BUTTON, "pointerdown", checkAllowOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", MIDDLE_BUTTON, "pointermove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", MIDDLE_BUTTON, "pointermove", checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mouseup", MIDDLE_BUTTON, "pointerup", checkBlockOpenPopup);
|
sendMouseEvent(target, "mouseup", MIDDLE_BUTTON, "pointerup", checkAllowOpenPopup);
|
||||||
|
|
||||||
// Right button
|
// Right button
|
||||||
sendMouseEvent(target, "mousedown", RIGHT_BUTTON, "pointerdown", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousedown", RIGHT_BUTTON, "pointerdown", checkBlockOpenPopup);
|
||||||
|
@ -998,7 +998,7 @@ pref("dom.disable_window_move_resize", false);
|
|||||||
|
|
||||||
pref("dom.allow_scripts_to_close_windows", false);
|
pref("dom.allow_scripts_to_close_windows", false);
|
||||||
|
|
||||||
pref("dom.popup_allowed_events", "change click dblclick auxclick mouseup pointerup notificationclick reset submit touchend contextmenu");
|
pref("dom.popup_allowed_events", "change click dblclick auxclick mousedown mouseup pointerdown pointerup notificationclick reset submit touchend contextmenu");
|
||||||
|
|
||||||
pref("dom.serviceWorkers.disable_open_click_delay", 1000);
|
pref("dom.serviceWorkers.disable_open_click_delay", 1000);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user