mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1878819 - Part 1. Add some drag event types to InputData. r=botond
To support fission for drag event on Android, I would like to add some drag event types to convert `InputData` to `WidgetEvent` easily. Differential Revision: https://phabricator.services.mozilla.com/D222393
This commit is contained in:
parent
a1d41aeabc
commit
6085cbbe1b
@ -25,6 +25,7 @@ using namespace dom;
|
||||
|
||||
template WidgetMouseEvent MouseInput::ToWidgetEvent(nsIWidget* aWidget) const;
|
||||
template WidgetPointerEvent MouseInput::ToWidgetEvent(nsIWidget* aWidget) const;
|
||||
template WidgetDragEvent MouseInput::ToWidgetEvent(nsIWidget* aWidget) const;
|
||||
|
||||
InputData::~InputData() = default;
|
||||
|
||||
@ -310,6 +311,18 @@ MouseInput::MouseInput(const WidgetMouseEventBase& aMouseEvent)
|
||||
case eDragEnd:
|
||||
mType = MOUSE_DRAG_END;
|
||||
break;
|
||||
case eDragEnter:
|
||||
mType = MOUSE_DRAG_ENTER;
|
||||
break;
|
||||
case eDragOver:
|
||||
mType = MOUSE_DRAG_OVER;
|
||||
break;
|
||||
case eDragExit:
|
||||
mType = MOUSE_DRAG_EXIT;
|
||||
break;
|
||||
case eDrop:
|
||||
mType = MOUSE_DROP;
|
||||
break;
|
||||
case eMouseEnterIntoWidget:
|
||||
mType = MOUSE_WIDGET_ENTER;
|
||||
break;
|
||||
@ -361,10 +374,13 @@ WidgetMouseOrPointerEvent MouseInput::ToWidgetEvent(nsIWidget* aWidget) const {
|
||||
std::is_same<WidgetMouseOrPointerEvent, WidgetPointerEvent>::value;
|
||||
const DebugOnly<bool> isMouseEvent =
|
||||
std::is_same<WidgetMouseOrPointerEvent, WidgetMouseEvent>::value;
|
||||
const DebugOnly<bool> isDragEvent =
|
||||
std::is_same<WidgetMouseOrPointerEvent, WidgetDragEvent>::value;
|
||||
MOZ_ASSERT(!IsPointerEventType() || isPointerEvent,
|
||||
"Please use ToWidgetEvent<WidgetPointerEvent>() for the instance");
|
||||
MOZ_ASSERT(IsPointerEventType() || isMouseEvent,
|
||||
"Please use ToWidgetEvent<WidgetMouseEvent>() for the instance");
|
||||
MOZ_ASSERT(IsPointerEventType() || isMouseEvent || isDragEvent,
|
||||
"Please use ToWidgetEvent<WidgetMouseEvent>() or "
|
||||
"ToWidgetEvent<WidgetDragEvent>() for the instance");
|
||||
|
||||
EventMessage msg = eVoidEvent;
|
||||
uint32_t clickCount = 0;
|
||||
@ -387,6 +403,18 @@ WidgetMouseOrPointerEvent MouseInput::ToWidgetEvent(nsIWidget* aWidget) const {
|
||||
case MOUSE_DRAG_END:
|
||||
msg = eDragEnd;
|
||||
break;
|
||||
case MOUSE_DRAG_ENTER:
|
||||
msg = eDragEnter;
|
||||
break;
|
||||
case MOUSE_DRAG_OVER:
|
||||
msg = eDragOver;
|
||||
break;
|
||||
case MOUSE_DRAG_EXIT:
|
||||
msg = eDragExit;
|
||||
break;
|
||||
case MOUSE_DROP:
|
||||
msg = eDrop;
|
||||
break;
|
||||
case MOUSE_WIDGET_ENTER:
|
||||
msg = eMouseEnterIntoWidget;
|
||||
break;
|
||||
|
@ -272,6 +272,10 @@ class MouseInput : public InputData {
|
||||
MOUSE_UP,
|
||||
MOUSE_DRAG_START,
|
||||
MOUSE_DRAG_END,
|
||||
MOUSE_DRAG_ENTER,
|
||||
MOUSE_DRAG_OVER,
|
||||
MOUSE_DRAG_EXIT,
|
||||
MOUSE_DROP,
|
||||
MOUSE_WIDGET_ENTER,
|
||||
MOUSE_WIDGET_EXIT,
|
||||
MOUSE_HITTEST,
|
||||
|
@ -471,7 +471,9 @@ class WidgetDragEvent : public WidgetMouseEvent {
|
||||
}
|
||||
|
||||
bool CanConvertToInputData() const {
|
||||
return mMessage == eDragStart || mMessage == eDragEnd;
|
||||
return mMessage == eDragStart || mMessage == eDragEnd ||
|
||||
mMessage == eDragEnter || mMessage == eDragOver ||
|
||||
mMessage == eDragExit || mMessage == eDrop;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user