mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 920425 part.25 Use mozilla::WidgetEvent::AsDragEvent() r=smaug
This commit is contained in:
parent
5ece396e0f
commit
fb017e86d4
@ -13,7 +13,7 @@ using namespace mozilla;
|
||||
|
||||
nsDOMDragEvent::nsDOMDragEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetInputEvent* aEvent)
|
||||
WidgetDragEvent* aEvent)
|
||||
: nsDOMMouseEvent(aOwner, aPresContext, aEvent ? aEvent :
|
||||
new WidgetDragEvent(false, 0, nullptr))
|
||||
{
|
||||
@ -54,8 +54,7 @@ nsDOMDragEvent::InitDragEvent(const nsAString & aType,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mEventIsInternal && mEvent) {
|
||||
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(mEvent);
|
||||
dragEvent->dataTransfer = aDataTransfer;
|
||||
mEvent->AsDragEvent()->dataTransfer = aDataTransfer;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -80,7 +79,7 @@ nsDOMDragEvent::GetDataTransfer()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(mEvent);
|
||||
WidgetDragEvent* dragEvent = mEvent->AsDragEvent();
|
||||
// for synthetic events, just use the supplied data transfer object even if null
|
||||
if (!mEventIsInternal) {
|
||||
nsresult rv = nsContentUtils::SetDataTransferInEvent(dragEvent);
|
||||
|
@ -17,7 +17,7 @@ class nsDOMDragEvent : public nsDOMMouseEvent,
|
||||
public:
|
||||
nsDOMDragEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetInputEvent* aEvent);
|
||||
mozilla::WidgetDragEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
@ -146,11 +146,12 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent)
|
||||
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget =
|
||||
nullptr;
|
||||
break;
|
||||
case NS_DRAG_EVENT:
|
||||
static_cast<WidgetDragEvent*>(tmp->mEvent)->dataTransfer = nullptr;
|
||||
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget =
|
||||
nullptr;
|
||||
case NS_DRAG_EVENT: {
|
||||
WidgetDragEvent* dragEvent = tmp->mEvent->AsDragEvent();
|
||||
dragEvent->dataTransfer = nullptr;
|
||||
dragEvent->relatedTarget = nullptr;
|
||||
break;
|
||||
}
|
||||
case NS_CLIPBOARD_EVENT:
|
||||
tmp->mEvent->AsClipboardEvent()->clipboardData = nullptr;
|
||||
break;
|
||||
@ -184,14 +185,14 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent)
|
||||
cb.NoteXPCOMChild(
|
||||
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget);
|
||||
break;
|
||||
case NS_DRAG_EVENT:
|
||||
case NS_DRAG_EVENT: {
|
||||
WidgetDragEvent* dragEvent = tmp->mEvent->AsDragEvent();
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->dataTransfer");
|
||||
cb.NoteXPCOMChild(
|
||||
static_cast<WidgetDragEvent*>(tmp->mEvent)->dataTransfer);
|
||||
cb.NoteXPCOMChild(dragEvent->dataTransfer);
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
|
||||
cb.NoteXPCOMChild(
|
||||
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget);
|
||||
cb.NoteXPCOMChild(dragEvent->relatedTarget);
|
||||
break;
|
||||
}
|
||||
case NS_CLIPBOARD_EVENT:
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->clipboardData");
|
||||
cb.NoteXPCOMChild(tmp->mEvent->AsClipboardEvent()->clipboardData);
|
||||
@ -553,7 +554,7 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
case NS_DRAG_EVENT:
|
||||
{
|
||||
WidgetDragEvent* oldDragEvent = static_cast<WidgetDragEvent*>(mEvent);
|
||||
WidgetDragEvent* oldDragEvent = mEvent->AsDragEvent();
|
||||
WidgetDragEvent* dragEvent = new WidgetDragEvent(false, msg, nullptr);
|
||||
dragEvent->AssignDragEventData(*oldDragEvent, true);
|
||||
newEvent = dragEvent;
|
||||
|
@ -721,7 +721,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
static_cast<WidgetWheelEvent*>(aEvent));
|
||||
case NS_DRAG_EVENT:
|
||||
return NS_NewDOMDragEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<WidgetDragEvent*>(aEvent));
|
||||
aEvent->AsDragEvent());
|
||||
case NS_TEXT_EVENT:
|
||||
return NS_NewDOMTextEvent(aDOMEvent, aOwner, aPresContext,
|
||||
aEvent->AsTextEvent());
|
||||
|
@ -3501,7 +3501,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
nsCOMPtr<nsIDOMDataTransfer> initialDataTransfer;
|
||||
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
|
||||
|
||||
WidgetDragEvent *dragEvent = static_cast<WidgetDragEvent*>(aEvent);
|
||||
WidgetDragEvent *dragEvent = aEvent->AsDragEvent();
|
||||
|
||||
// collect any changes to moz cursor settings stored in the event's
|
||||
// data transfer.
|
||||
|
@ -182,9 +182,8 @@ nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
|
||||
NS_ENSURE_TRUE(sourceNode, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
WidgetDragEvent* dragEventInternal =
|
||||
static_cast<WidgetDragEvent*>(aDropEvent->GetInternalNSEvent());
|
||||
if (nsContentUtils::CheckForSubFrameDrop(dragSession, dragEventInternal)) {
|
||||
if (nsContentUtils::CheckForSubFrameDrop(dragSession,
|
||||
aDropEvent->GetInternalNSEvent()->AsDragEvent())) {
|
||||
// Don't allow drags from subframe documents with different origins than
|
||||
// the drop destination.
|
||||
if (srcdomdoc && !IsSafeToInsertData(srcdomdoc))
|
||||
|
@ -2554,7 +2554,7 @@ nsTreeBodyFrame::GetCursor(const nsPoint& aPoint,
|
||||
static uint32_t GetDropEffect(WidgetGUIEvent* aEvent)
|
||||
{
|
||||
NS_ASSERTION(aEvent->eventStructType == NS_DRAG_EVENT, "wrong event type");
|
||||
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(aEvent);
|
||||
WidgetDragEvent* dragEvent = aEvent->AsDragEvent();
|
||||
nsContentUtils::SetDataTransferInEvent(dragEvent);
|
||||
|
||||
uint32_t action = 0;
|
||||
@ -2700,9 +2700,9 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
|
||||
// The dataTransfer was initialized by the call to GetDropEffect above.
|
||||
bool canDropAtNewLocation = false;
|
||||
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(aEvent);
|
||||
mView->CanDrop(mSlots->mDropRow, mSlots->mDropOrient,
|
||||
dragEvent->dataTransfer, &canDropAtNewLocation);
|
||||
aEvent->AsDragEvent()->dataTransfer,
|
||||
&canDropAtNewLocation);
|
||||
|
||||
if (canDropAtNewLocation) {
|
||||
// Invalidate row at the new location.
|
||||
@ -2732,7 +2732,7 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
NS_ASSERTION(aEvent->eventStructType == NS_DRAG_EVENT, "wrong event type");
|
||||
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(aEvent);
|
||||
WidgetDragEvent* dragEvent = aEvent->AsDragEvent();
|
||||
nsContentUtils::SetDataTransferInEvent(dragEvent);
|
||||
|
||||
mView->Drop(mSlots->mDropRow, mSlots->mDropOrient, dragEvent->dataTransfer);
|
||||
|
Loading…
Reference in New Issue
Block a user