зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1653949 - Part 1: Change mExitFrom in WidgetMouseEvent to be Maybe<ExitFrom>; r=smaug
mExitFrom now contains a value only when mMessage is eMouseExitFromWidget Differential Revision: https://phabricator.services.mozilla.com/D88225
This commit is contained in:
Родитель
9a9397ca2d
Коммит
363e80d673
|
@ -7820,7 +7820,7 @@ nsresult nsContentUtils::SendMouseEvent(
|
|||
if (!widget) return NS_ERROR_FAILURE;
|
||||
|
||||
EventMessage msg;
|
||||
WidgetMouseEvent::ExitFrom exitFrom = WidgetMouseEvent::eChild;
|
||||
Maybe<WidgetMouseEvent::ExitFrom> exitFrom;
|
||||
bool contextMenuKey = false;
|
||||
if (aType.EqualsLiteral("mousedown")) {
|
||||
msg = eMouseDown;
|
||||
|
@ -7832,9 +7832,10 @@ nsresult nsContentUtils::SendMouseEvent(
|
|||
msg = eMouseEnterIntoWidget;
|
||||
} else if (aType.EqualsLiteral("mouseout")) {
|
||||
msg = eMouseExitFromWidget;
|
||||
exitFrom = Some(WidgetMouseEvent::eChild);
|
||||
} else if (aType.EqualsLiteral("mousecancel")) {
|
||||
msg = eMouseExitFromWidget;
|
||||
exitFrom = WidgetMouseEvent::eTopLevel;
|
||||
exitFrom = Some(WidgetMouseEvent::eTopLevel);
|
||||
} else if (aType.EqualsLiteral("mouselongtap")) {
|
||||
msg = eMouseLongTap;
|
||||
} else if (aType.EqualsLiteral("contextmenu")) {
|
||||
|
|
|
@ -649,7 +649,7 @@ nsresult EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
// If the event is not a top-level window exit, then it's not
|
||||
// really an exit --- we may have traversed widget boundaries but
|
||||
// we're still in our toplevel window.
|
||||
if (mouseEvent->mExitFrom != WidgetMouseEvent::eTopLevel) {
|
||||
if (mouseEvent->mExitFrom.value() != WidgetMouseEvent::eTopLevel) {
|
||||
// Treat it as a synthetic move so we don't generate spurious
|
||||
// "exit" or "move" events. Any necessary "out" or "over" events
|
||||
// will be generated by GenerateMouseEnterExit
|
||||
|
@ -1327,6 +1327,7 @@ void EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
|
|||
UniquePtr<WidgetMouseEvent> mouseExitEvent =
|
||||
CreateMouseOrPointerWidgetEvent(mouseEvent, eMouseExitFromWidget,
|
||||
mouseEvent->mRelatedTarget);
|
||||
mouseExitEvent->mExitFrom = Some(WidgetMouseEvent::eChild);
|
||||
oldRemote->SendRealMouseEvent(*mouseExitEvent);
|
||||
}
|
||||
|
||||
|
@ -4223,7 +4224,7 @@ nsIFrame* EventStateManager::DispatchMouseOrPointerEvent(
|
|||
UniquePtr<WidgetMouseEvent> remoteEvent =
|
||||
CreateMouseOrPointerWidgetEvent(aMouseEvent, eMouseExitFromWidget,
|
||||
relatedContent);
|
||||
remoteEvent->mExitFrom = WidgetMouseEvent::eTopLevel;
|
||||
remoteEvent->mExitFrom = Some(WidgetMouseEvent::eTopLevel);
|
||||
|
||||
// mCurrentTarget is set to the new target, so we must reset it to the
|
||||
// old target and then dispatch a cross-process event. (mCurrentTarget
|
||||
|
|
|
@ -6980,9 +6980,9 @@ nsresult PresShell::EventHandler::HandleEventUsingCoordinates(
|
|||
}
|
||||
|
||||
WidgetMouseEvent* mouseEvent = aGUIEvent->AsMouseEvent();
|
||||
bool isWindowLevelMouseExit =
|
||||
(aGUIEvent->mMessage == eMouseExitFromWidget) &&
|
||||
(mouseEvent && mouseEvent->mExitFrom == WidgetMouseEvent::eTopLevel);
|
||||
bool isWindowLevelMouseExit = (aGUIEvent->mMessage == eMouseExitFromWidget) &&
|
||||
(mouseEvent && mouseEvent->mExitFrom.value() ==
|
||||
WidgetMouseEvent::eTopLevel);
|
||||
|
||||
// Get the frame at the event point. However, don't do this if we're
|
||||
// capturing and retargeting the event because the captured frame will
|
||||
|
|
|
@ -197,7 +197,6 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
|||
WidgetMouseEvent()
|
||||
: mReason(eReal),
|
||||
mContextMenuTrigger(eNormal),
|
||||
mExitFrom(eChild),
|
||||
mIgnoreRootScrollFrame(false),
|
||||
mClickCount(0),
|
||||
mUseLegacyNonPrimaryDispatch(false) {}
|
||||
|
@ -207,7 +206,6 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
|||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID),
|
||||
mReason(aReason),
|
||||
mContextMenuTrigger(eNormal),
|
||||
mExitFrom(eChild),
|
||||
mIgnoreRootScrollFrame(false),
|
||||
mClickCount(0),
|
||||
mUseLegacyNonPrimaryDispatch(false) {}
|
||||
|
@ -221,7 +219,6 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
|||
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, eMouseEventClass),
|
||||
mReason(aReason),
|
||||
mContextMenuTrigger(aContextMenuTrigger),
|
||||
mExitFrom(eChild),
|
||||
mIgnoreRootScrollFrame(false),
|
||||
mClickCount(0),
|
||||
mUseLegacyNonPrimaryDispatch(false) {
|
||||
|
@ -269,10 +266,10 @@ class WidgetMouseEvent : public WidgetMouseEventBase,
|
|||
// other reasons (typically, a click of right mouse button).
|
||||
ContextMenuTrigger mContextMenuTrigger;
|
||||
|
||||
// mExitFrom is valid only when mMessage is eMouseExitFromWidget.
|
||||
// mExitFrom contains a value only when mMessage is eMouseExitFromWidget.
|
||||
// This indicates if the mouse cursor exits from a top level widget or
|
||||
// a child widget.
|
||||
ExitFrom mExitFrom;
|
||||
Maybe<ExitFrom> mExitFrom;
|
||||
|
||||
// Whether the event should ignore scroll frame bounds during dispatch.
|
||||
bool mIgnoreRootScrollFrame;
|
||||
|
|
|
@ -3159,9 +3159,9 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
|
|||
EventMessage msg = aEnter ? eMouseEnterIntoWidget : eMouseExitFromWidget;
|
||||
WidgetMouseEvent event(true, msg, mGeckoChild, WidgetMouseEvent::eReal);
|
||||
event.mRefPoint = mGeckoChild->CocoaPointsToDevPixels(localEventLocation);
|
||||
|
||||
event.mExitFrom = aExitFrom;
|
||||
|
||||
if (event.mMessage == eMouseExitFromWidget) {
|
||||
event.mExitFrom = Some(aExitFrom);
|
||||
}
|
||||
nsEventStatus status; // ignored
|
||||
mGeckoChild->DispatchEvent(&event, status);
|
||||
}
|
||||
|
|
|
@ -3199,9 +3199,9 @@ void nsWindow::OnLeaveNotifyEvent(GdkEventCrossing* aEvent) {
|
|||
event.mRefPoint = GdkEventCoordsToDevicePixels(aEvent->x, aEvent->y);
|
||||
event.AssignEventTime(GetWidgetEventTime(aEvent->time));
|
||||
|
||||
event.mExitFrom = is_top_level_mouse_exit(mGdkWindow, aEvent)
|
||||
? WidgetMouseEvent::eTopLevel
|
||||
: WidgetMouseEvent::eChild;
|
||||
event.mExitFrom = Some(is_top_level_mouse_exit(mGdkWindow, aEvent)
|
||||
? WidgetMouseEvent::eTopLevel
|
||||
: WidgetMouseEvent::eChild);
|
||||
|
||||
LOG(("OnLeaveNotify: %p\n", (void*)this));
|
||||
|
||||
|
|
|
@ -244,7 +244,11 @@ struct ParamTraits<mozilla::WidgetMouseEvent> {
|
|||
WriteParam(aMsg, static_cast<paramType::ReasonType>(aParam.mReason));
|
||||
WriteParam(aMsg, static_cast<paramType::ContextMenuTriggerType>(
|
||||
aParam.mContextMenuTrigger));
|
||||
WriteParam(aMsg, static_cast<paramType::ExitFromType>(aParam.mExitFrom));
|
||||
WriteParam(aMsg, aParam.mExitFrom.isSome());
|
||||
if (aParam.mExitFrom.isSome()) {
|
||||
WriteParam(
|
||||
aMsg, static_cast<paramType::ExitFromType>(aParam.mExitFrom.value()));
|
||||
}
|
||||
WriteParam(aMsg, aParam.mClickCount);
|
||||
}
|
||||
|
||||
|
@ -253,20 +257,24 @@ struct ParamTraits<mozilla::WidgetMouseEvent> {
|
|||
bool rv;
|
||||
paramType::ReasonType reason = 0;
|
||||
paramType::ContextMenuTriggerType contextMenuTrigger = 0;
|
||||
paramType::ExitFromType exitFrom = 0;
|
||||
bool hasExitFrom = false;
|
||||
rv = ReadParam(aMsg, aIter,
|
||||
static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter,
|
||||
static_cast<mozilla::WidgetPointerHelper*>(aResult)) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mIgnoreRootScrollFrame) &&
|
||||
ReadParam(aMsg, aIter, &reason) &&
|
||||
ReadParam(aMsg, aIter, &contextMenuTrigger) &&
|
||||
ReadParam(aMsg, aIter, &exitFrom) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mClickCount);
|
||||
ReadParam(aMsg, aIter, &contextMenuTrigger);
|
||||
aResult->mReason = static_cast<paramType::Reason>(reason);
|
||||
aResult->mContextMenuTrigger =
|
||||
static_cast<paramType::ContextMenuTrigger>(contextMenuTrigger);
|
||||
aResult->mExitFrom = static_cast<paramType::ExitFrom>(exitFrom);
|
||||
rv = rv && ReadParam(aMsg, aIter, &hasExitFrom);
|
||||
if (hasExitFrom) {
|
||||
paramType::ExitFromType exitFrom = 0;
|
||||
rv = rv && ReadParam(aMsg, aIter, &exitFrom);
|
||||
aResult->mExitFrom = Some(static_cast<paramType::ExitFrom>(exitFrom));
|
||||
}
|
||||
rv = rv && ReadParam(aMsg, aIter, &aResult->mClickCount);
|
||||
return rv;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -4555,8 +4555,9 @@ bool nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam,
|
|||
}
|
||||
break;
|
||||
case eMouseExitFromWidget:
|
||||
event.mExitFrom = IsTopLevelMouseExit(mWnd) ? WidgetMouseEvent::eTopLevel
|
||||
: WidgetMouseEvent::eChild;
|
||||
event.mExitFrom =
|
||||
Some(IsTopLevelMouseExit(mWnd) ? WidgetMouseEvent::eTopLevel
|
||||
: WidgetMouseEvent::eChild);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче