Commit 92b7c2a0 authored by Edgar Chen's avatar Edgar Chen
Browse files

Bug 1734238 - Wheel event should be dispatched to the remote target that...

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
parent 57ac3632
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1524,6 +1524,10 @@ void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
      return;
    }
    case eWheelEventClass: {
      if (BrowserParent* pointerLockedRemote =
              PointerLockManager::GetLockedRemoteTarget()) {
        remote = pointerLockedRemote;
      }
      remote->SendMouseWheelEvent(*aEvent->AsWheelEvent());
      return;
    }
+10 −0
Original line number Diff line number Diff line
@@ -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()