Bug 1734238 - Wheel event should be dispatched to the remote target that requests the pointer lock; r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D127810
This commit is contained in:
Edgar Chen 2021-10-07 14:13:50 +00:00
parent 57ac363238
commit 92b7c2a045
2 changed files with 14 additions and 0 deletions

View File

@ -1524,6 +1524,10 @@ void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
return;
}
case eWheelEventClass: {
if (BrowserParent* pointerLockedRemote =
PointerLockManager::GetLockedRemoteTarget()) {
remote = pointerLockedRemote;
}
remote->SendMouseWheelEvent(*aEvent->AsWheelEvent());
return;
}

View File

@ -85,6 +85,16 @@ async function start() {
}, { once: true });
});
// Mouse wheel event should be dispatched to locked element.
synthesizeWheel(iframe, 10, 10, { deltaY: 3.0, deltaMode: WheelEvent.DOM_DELTA_LINE });
await new Promise((aResolve) => {
document.addEventListener("wheel", function(e) {
info("Got wheel");
is(e.target, target, "event.target");
aResolve();
}, { once: true });
});
// Pointer lock requested in iframe should be rejected.
let win = iframe.contentWindow;
win.focus()