forked from mirrors/gecko-dev
Backed out changeset 564ba45d2ceb (bug 1891221) for causing mochitest-plain failures on test_coalesce_mousewheel.html. CLOSED TREE
This commit is contained in:
parent
87d684a3e6
commit
71cf445291
4 changed files with 9 additions and 129 deletions
|
|
@ -583,7 +583,6 @@ EventStateManager::EventStateManager()
|
|||
mGestureDownPoint(0, 0),
|
||||
mGestureModifiers(0),
|
||||
mGestureDownButtons(0),
|
||||
mGestureDownButton(0),
|
||||
mPresContext(nullptr),
|
||||
mShouldAlwaysUseLineDeltas(false),
|
||||
mShouldAlwaysUseLineDeltasInitialized(false),
|
||||
|
|
@ -2274,13 +2273,6 @@ void EventStateManager::FireContextClick() {
|
|||
event.mClickCount = 1;
|
||||
FillInEventFromGestureDown(&event);
|
||||
|
||||
// we need to forget the clicking content and click count for the
|
||||
// following eMouseUp event when click-holding context menus
|
||||
LastMouseDownInfo& mouseDownInfo = GetLastMouseDownInfo(event.mButton);
|
||||
mouseDownInfo.mLastMouseDownContent = nullptr;
|
||||
mouseDownInfo.mClickCount = 0;
|
||||
mouseDownInfo.mLastMouseDownInputControlType = Nothing();
|
||||
|
||||
// stop selection tracking, we're in control now
|
||||
if (mCurrentTarget) {
|
||||
RefPtr<nsFrameSelection> frameSel = mCurrentTarget->GetFrameSelection();
|
||||
|
|
@ -2295,15 +2287,10 @@ void EventStateManager::FireContextClick() {
|
|||
AutoHandlingUserInputStatePusher userInpStatePusher(true, &event);
|
||||
|
||||
// dispatch to DOM
|
||||
RefPtr<nsIContent> gestureDownContent = mGestureDownContent;
|
||||
RefPtr<nsPresContext> presContext = mPresContext;
|
||||
|
||||
// The contextmenu event handled by PresShell will apply to elements (not
|
||||
// all nodes) correctly and will be dispatched to EventStateManager for
|
||||
// further handling preventing click event and stopping tracking drag
|
||||
// gesture.
|
||||
if (RefPtr<PresShell> presShell = presContext->GetPresShell()) {
|
||||
presShell->HandleEvent(mCurrentTarget, &event, false, &status);
|
||||
}
|
||||
EventDispatcher::Dispatch(gestureDownContent, presContext, &event,
|
||||
nullptr, &status);
|
||||
|
||||
// We don't need to dispatch to frame handling because no frames
|
||||
// watch eContextMenu except for nsMenuFrame and that's only for
|
||||
|
|
@ -2312,8 +2299,10 @@ void EventStateManager::FireContextClick() {
|
|||
}
|
||||
}
|
||||
|
||||
// stop tracking a drag whatever the event has been handled or not.
|
||||
StopTrackingDragGesture(true);
|
||||
// now check if the event has been handled. If so, stop tracking a drag
|
||||
if (status == nsEventStatus_eConsumeNoDefault) {
|
||||
StopTrackingDragGesture(true);
|
||||
}
|
||||
|
||||
KillClickHoldTimer();
|
||||
|
||||
|
|
@ -2353,7 +2342,6 @@ void EventStateManager::BeginTrackingDragGesture(nsPresContext* aPresContext,
|
|||
}
|
||||
mGestureModifiers = inDownEvent->mModifiers;
|
||||
mGestureDownButtons = inDownEvent->mButtons;
|
||||
mGestureDownButton = inDownEvent->mButton;
|
||||
|
||||
if (inDownEvent->mMessage != eMouseTouchDrag &&
|
||||
StaticPrefs::ui_click_hold_context_menus()) {
|
||||
|
|
@ -2427,9 +2415,6 @@ void EventStateManager::FillInEventFromGestureDown(WidgetMouseEvent* aEvent) {
|
|||
mGestureDownPoint - aEvent->mWidget->WidgetToScreenOffset();
|
||||
aEvent->mModifiers = mGestureModifiers;
|
||||
aEvent->mButtons = mGestureDownButtons;
|
||||
if (aEvent->mMessage == eContextMenu) {
|
||||
aEvent->mButton = mGestureDownButton;
|
||||
}
|
||||
}
|
||||
|
||||
void EventStateManager::MaybeFirePointerCancel(WidgetInputEvent* aEvent) {
|
||||
|
|
@ -3808,6 +3793,8 @@ nsresult EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
|||
// we need to forget the clicking content and click count for the
|
||||
// following eMouseUp event.
|
||||
if (mouseEvent->mClickEventPrevented) {
|
||||
RefPtr<EventStateManager> esm =
|
||||
ESMFromContentOrThis(aOverrideClickTarget);
|
||||
switch (mouseEvent->mButton) {
|
||||
case MouseButton::ePrimary:
|
||||
case MouseButton::eSecondary:
|
||||
|
|
|
|||
|
|
@ -1338,7 +1338,6 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
|
|||
// State of keys when the original gesture-down happened
|
||||
Modifiers mGestureModifiers;
|
||||
uint16_t mGestureDownButtons;
|
||||
int16_t mGestureDownButton;
|
||||
|
||||
LastMouseDownInfo mLastLeftMouseDownInfo;
|
||||
LastMouseDownInfo mLastMiddleMouseDownInfo;
|
||||
|
|
|
|||
|
|
@ -342,9 +342,6 @@ support-files = ["!/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
|
|||
run-if = ["os == 'win'"] # Only Windows 1809+ supports pen input synthesis
|
||||
support-files = ["!/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js"]
|
||||
|
||||
["test_click_hold_context_menus.html"]
|
||||
skip-if = ["os == 'mac'"]
|
||||
|
||||
["test_click_on_reframed_generated_text.html"]
|
||||
|
||||
["test_click_on_restyled_element.html"]
|
||||
|
|
|
|||
|
|
@ -1,103 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=1891221 -->
|
||||
<head>
|
||||
<title>Test for Bug 1891221</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script src="/tests/SimpleTest/SpecialPowers.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<script type="application/javascript">
|
||||
"use strict";
|
||||
const kIsAndroid = navigator.userAgent.includes("Android");
|
||||
|
||||
add_task(async function test_click_hold_context_menus_events_and_target() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["test.events.async.enabled", true],
|
||||
["ui.click_hold_context_menus", true],
|
||||
["ui.click_hold_context_menus.delay", 100],
|
||||
],
|
||||
});
|
||||
await SimpleTest.promiseFocus();
|
||||
await SpecialPowers.contentTransformsReceived(window);
|
||||
|
||||
let seq = [];
|
||||
|
||||
const target = document.getElementById("target");
|
||||
|
||||
target.addEventListener("mousedown", e => {
|
||||
seq.push("mousedown");
|
||||
});
|
||||
|
||||
// Fenix's contextMenu is not part of geckoview UI
|
||||
// So mouseup event will be dispatched to content directly.
|
||||
var upPromise;
|
||||
if (kIsAndroid) {
|
||||
upPromise = new Promise(resolve => {
|
||||
target.addEventListener("mouseup", e => {
|
||||
seq.push("mouseup");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// This should never happen
|
||||
target.addEventListener("click", e => {
|
||||
ok(false, "click shouldn't be dispatched");
|
||||
seq.push("click");
|
||||
});
|
||||
|
||||
const promise = new Promise(resolve => {
|
||||
target.addEventListener("contextmenu", e => {
|
||||
is(e.target, target, "Target should be the clickable element");
|
||||
is(e.explicitOriginalTarget, target.childNodes[0], "explicitOriginalTarget should be text node");
|
||||
seq.push("contextmenu");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
synthesizeMouse(
|
||||
target,
|
||||
10,
|
||||
10,
|
||||
{ type: "mousedown" },
|
||||
);
|
||||
|
||||
// ensure contextmenu before mouseup.
|
||||
await promise;
|
||||
|
||||
synthesizeMouse(
|
||||
target,
|
||||
10,
|
||||
10,
|
||||
{ type: "mouseup" },
|
||||
);
|
||||
|
||||
if (kIsAndroid) {
|
||||
await upPromise;
|
||||
}
|
||||
|
||||
|
||||
const keyDownPromise = new Promise(resolve => {
|
||||
window.addEventListener("keydown", e => {
|
||||
seq.push("keydown");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
synthesizeKey("VK_ESCAPE", {}, window);
|
||||
await keyDownPromise;
|
||||
|
||||
if (kIsAndroid) {
|
||||
is(seq.toString(), ["mousedown", "contextmenu", "mouseup", "keydown"].toString(), "Seq should match");
|
||||
} else {
|
||||
is(seq.toString(), ["mousedown", "contextmenu", "keydown"].toString(), "Seq should match");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a id="target" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1891221">Mozilla Bug 1891221</a>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in a new issue