Bug 1694229 - Separate Enter/Exit Widget Events from Mouse Button events r=smaug

If we don't do this, then just moving the mouse over a window experiencing a
slow script will cause it to show the notification. We could try to
deserialize the message inside nsContentUtils::IsMessageCriticalInputEvent, but
that seems overcomplicated compared to just adding a new message which proxies
to the original message handlers.

Differential Revision: https://phabricator.services.mozilla.com/D106016
This commit is contained in:
Doug Thayer 2021-02-25 04:14:12 +00:00
Родитель a9fbe5527c
Коммит 6b8f6949b2
5 изменённых файлов: 45 добавлений и 4 удалений

Просмотреть файл

@ -10019,6 +10019,7 @@ bool nsContentUtils::IsMessageInputEvent(const IPC::Message& aMsg) {
switch (aMsg.type()) { switch (aMsg.type()) {
case mozilla::dom::PBrowser::Msg_RealMouseMoveEvent__ID: case mozilla::dom::PBrowser::Msg_RealMouseMoveEvent__ID:
case mozilla::dom::PBrowser::Msg_RealMouseButtonEvent__ID: case mozilla::dom::PBrowser::Msg_RealMouseButtonEvent__ID:
case mozilla::dom::PBrowser::Msg_RealMouseEnterExitWidgetEvent__ID:
case mozilla::dom::PBrowser::Msg_RealKeyEvent__ID: case mozilla::dom::PBrowser::Msg_RealKeyEvent__ID:
case mozilla::dom::PBrowser::Msg_MouseWheelEvent__ID: case mozilla::dom::PBrowser::Msg_MouseWheelEvent__ID:
case mozilla::dom::PBrowser::Msg_RealTouchEvent__ID: case mozilla::dom::PBrowser::Msg_RealTouchEvent__ID:

Просмотреть файл

@ -1679,6 +1679,19 @@ mozilla::ipc::IPCResult BrowserChild::RecvNormalPriorityRealMouseButtonEvent(
return RecvRealMouseButtonEvent(aEvent, aGuid, aInputBlockId); return RecvRealMouseButtonEvent(aEvent, aGuid, aInputBlockId);
} }
mozilla::ipc::IPCResult BrowserChild::RecvRealMouseEnterExitWidgetEvent(
const WidgetMouseEvent& aEvent, const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) {
return RecvRealMouseButtonEvent(aEvent, aGuid, aInputBlockId);
}
mozilla::ipc::IPCResult
BrowserChild::RecvNormalPriorityRealMouseEnterExitWidgetEvent(
const WidgetMouseEvent& aEvent, const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId) {
return RecvRealMouseButtonEvent(aEvent, aGuid, aInputBlockId);
}
// In case handling repeated mouse wheel takes much time, we skip firing current // In case handling repeated mouse wheel takes much time, we skip firing current
// wheel event if it may be coalesced to the next one. // wheel event if it may be coalesced to the next one.
bool BrowserChild::MaybeCoalesceWheelEvent(const WidgetWheelEvent& aEvent, bool BrowserChild::MaybeCoalesceWheelEvent(const WidgetWheelEvent& aEvent,

Просмотреть файл

@ -329,6 +329,13 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
const mozilla::WidgetMouseEvent& aEvent, const ScrollableLayerGuid& aGuid, const mozilla::WidgetMouseEvent& aEvent, const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId); const uint64_t& aInputBlockId);
mozilla::ipc::IPCResult RecvRealMouseEnterExitWidgetEvent(
const mozilla::WidgetMouseEvent& aEvent, const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId);
mozilla::ipc::IPCResult RecvNormalPriorityRealMouseEnterExitWidgetEvent(
const mozilla::WidgetMouseEvent& aEvent, const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId);
MOZ_CAN_RUN_SCRIPT_BOUNDARY MOZ_CAN_RUN_SCRIPT_BOUNDARY
mozilla::ipc::IPCResult RecvRealDragEvent(const WidgetDragEvent& aEvent, mozilla::ipc::IPCResult RecvRealDragEvent(const WidgetDragEvent& aEvent,
const uint32_t& aDragAction, const uint32_t& aDragAction,

Просмотреть файл

@ -1462,10 +1462,10 @@ void BrowserParent::SendRealMouseEvent(WidgetMouseEvent& aEvent) {
localEvent.mMessage = eMouseEnterIntoWidget; localEvent.mMessage = eMouseEnterIntoWidget;
DebugOnly<bool> ret = DebugOnly<bool> ret =
isInputPriorityEventEnabled isInputPriorityEventEnabled
? SendRealMouseButtonEvent(localEvent, guid, blockId) ? SendRealMouseEnterExitWidgetEvent(localEvent, guid, blockId)
: SendNormalPriorityRealMouseButtonEvent(localEvent, guid, blockId); : SendNormalPriorityRealMouseEnterExitWidgetEvent(localEvent, guid,
NS_WARNING_ASSERTION( blockId);
ret, "SendRealMouseButtonEvent(eMouseEnterIntoWidget) failed"); NS_WARNING_ASSERTION(ret, "SendRealMouseEnterExitWidgetEvent() failed");
MOZ_ASSERT(!ret || localEvent.HasBeenPostedToRemoteProcess()); MOZ_ASSERT(!ret || localEvent.HasBeenPostedToRemoteProcess());
} }
@ -1500,6 +1500,18 @@ void BrowserParent::SendRealMouseEvent(WidgetMouseEvent& aEvent) {
return; return;
} }
if (eMouseEnterIntoWidget == aEvent.mMessage ||
eMouseExitFromWidget == aEvent.mMessage) {
DebugOnly<bool> ret =
isInputPriorityEventEnabled
? SendRealMouseEnterExitWidgetEvent(aEvent, guid, blockId)
: SendNormalPriorityRealMouseEnterExitWidgetEvent(aEvent, guid,
blockId);
NS_WARNING_ASSERTION(ret, "SendRealMouseEnterExitWidgetEvent() failed");
MOZ_ASSERT(!ret || aEvent.HasBeenPostedToRemoteProcess());
return;
}
DebugOnly<bool> ret = DebugOnly<bool> ret =
isInputPriorityEventEnabled isInputPriorityEventEnabled
? SendRealMouseButtonEvent(aEvent, guid, blockId) ? SendRealMouseButtonEvent(aEvent, guid, blockId)

Просмотреть файл

@ -792,6 +792,14 @@ child:
ScrollableLayerGuid aGuid, ScrollableLayerGuid aGuid,
uint64_t aInputBlockId); uint64_t aInputBlockId);
[Priority=input]
async RealMouseEnterExitWidgetEvent(WidgetMouseEvent event,
ScrollableLayerGuid aGuid,
uint64_t aInputBlockId);
async NormalPriorityRealMouseEnterExitWidgetEvent(WidgetMouseEvent event,
ScrollableLayerGuid aGuid,
uint64_t aInputBlockId);
[Priority=input] [Priority=input]
async RealKeyEvent(WidgetKeyboardEvent event); async RealKeyEvent(WidgetKeyboardEvent event);
async NormalPriorityRealKeyEvent(WidgetKeyboardEvent event); async NormalPriorityRealKeyEvent(WidgetKeyboardEvent event);