diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index d416c22bd32b..a09b92872dbe 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -1407,9 +1407,9 @@ public: static already_AddRefed GetDragSession(); /* - * Initialize and set the dataTransfer field of an nsDragEvent. + * Initialize and set the dataTransfer field of an WidgetDragEvent. */ - static nsresult SetDataTransferInEvent(nsDragEvent* aDragEvent); + static nsresult SetDataTransferInEvent(mozilla::WidgetDragEvent* aDragEvent); // filters the drag and drop action to fit within the effects allowed and // returns it. @@ -1420,7 +1420,7 @@ public: * an ancestor of the document for the source of the drag. */ static bool CheckForSubFrameDrop(nsIDragSession* aDragSession, - nsDragEvent* aDropEvent); + mozilla::WidgetDragEvent* aDropEvent); /** * Return true if aURI is a local file URI (i.e. file://). diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index 8e4c87fb678a..c57d8316dab6 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -4979,7 +4979,7 @@ nsContentUtils::GetDragSession() /* static */ nsresult -nsContentUtils::SetDataTransferInEvent(nsDragEvent* aDragEvent) +nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent) { if (aDragEvent->dataTransfer || !aDragEvent->mFlags.mIsTrusted) return NS_OK; @@ -5081,7 +5081,8 @@ nsContentUtils::FilterDropEffect(uint32_t aAction, uint32_t aEffectAllowed) /* static */ bool -nsContentUtils::CheckForSubFrameDrop(nsIDragSession* aDragSession, nsDragEvent* aDropEvent) +nsContentUtils::CheckForSubFrameDrop(nsIDragSession* aDragSession, + WidgetDragEvent* aDropEvent) { nsCOMPtr target = do_QueryInterface(aDropEvent->originalTarget); if (!target) { diff --git a/content/events/src/nsDOMDragEvent.cpp b/content/events/src/nsDOMDragEvent.cpp index 97c2a13880cd..e28918378351 100644 --- a/content/events/src/nsDOMDragEvent.cpp +++ b/content/events/src/nsDOMDragEvent.cpp @@ -15,7 +15,7 @@ nsDOMDragEvent::nsDOMDragEvent(mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, WidgetInputEvent* aEvent) : nsDOMMouseEvent(aOwner, aPresContext, aEvent ? aEvent : - new nsDragEvent(false, 0, nullptr)) + new WidgetDragEvent(false, 0, nullptr)) { if (aEvent) { mEventIsInternal = false; @@ -32,7 +32,7 @@ nsDOMDragEvent::~nsDOMDragEvent() { if (mEventIsInternal) { if (mEvent->eventStructType == NS_DRAG_EVENT) - delete static_cast(mEvent); + delete static_cast(mEvent); mEvent = nullptr; } } @@ -62,7 +62,7 @@ nsDOMDragEvent::InitDragEvent(const nsAString & aType, NS_ENSURE_SUCCESS(rv, rv); if (mEventIsInternal && mEvent) { - nsDragEvent* dragEvent = static_cast(mEvent); + WidgetDragEvent* dragEvent = static_cast(mEvent); dragEvent->dataTransfer = aDataTransfer; } @@ -88,7 +88,7 @@ nsDOMDragEvent::GetDataTransfer() return nullptr; } - nsDragEvent* dragEvent = static_cast(mEvent); + WidgetDragEvent* dragEvent = static_cast(mEvent); // for synthetic events, just use the supplied data transfer object even if null if (!mEventIsInternal) { nsresult rv = nsContentUtils::SetDataTransferInEvent(dragEvent); @@ -101,7 +101,7 @@ nsDOMDragEvent::GetDataTransfer() nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult, mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, - nsDragEvent *aEvent) + WidgetDragEvent* aEvent) { nsDOMDragEvent* event = new nsDOMDragEvent(aOwner, aPresContext, aEvent); return CallQueryInterface(event, aInstancePtrResult); diff --git a/content/events/src/nsDOMDragEvent.h b/content/events/src/nsDOMDragEvent.h index ac9abe4a1442..5ace30c64398 100644 --- a/content/events/src/nsDOMDragEvent.h +++ b/content/events/src/nsDOMDragEvent.h @@ -55,6 +55,6 @@ public: nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult, mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, - nsDragEvent* aEvent); + mozilla::WidgetDragEvent* aEvent); #endif // nsDOMDragEvent_h__ diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index 96a29b7e18c0..ccd433993777 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -147,7 +147,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent) nullptr; break; case NS_DRAG_EVENT: - static_cast(tmp->mEvent)->dataTransfer = nullptr; + static_cast(tmp->mEvent)->dataTransfer = nullptr; static_cast(tmp->mEvent)->relatedTarget = nullptr; break; @@ -189,7 +189,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent) case NS_DRAG_EVENT: NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->dataTransfer"); cb.NoteXPCOMChild( - static_cast(tmp->mEvent)->dataTransfer); + static_cast(tmp->mEvent)->dataTransfer); NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget"); cb.NoteXPCOMChild( static_cast(tmp->mEvent)->relatedTarget); @@ -559,9 +559,8 @@ nsDOMEvent::DuplicatePrivateData() } case NS_DRAG_EVENT: { - nsDragEvent* oldDragEvent = static_cast(mEvent); - nsDragEvent* dragEvent = - new nsDragEvent(false, msg, nullptr); + WidgetDragEvent* oldDragEvent = static_cast(mEvent); + WidgetDragEvent* dragEvent = new WidgetDragEvent(false, msg, nullptr); dragEvent->AssignDragEventData(*oldDragEvent, true); newEvent = dragEvent; break; diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp index f26478059395..ca50c8b2b9ff 100644 --- a/content/events/src/nsEventDispatcher.cpp +++ b/content/events/src/nsEventDispatcher.cpp @@ -722,7 +722,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner, static_cast(aEvent)); case NS_DRAG_EVENT: return NS_NewDOMDragEvent(aDOMEvent, aOwner, aPresContext, - static_cast(aEvent)); + static_cast(aEvent)); case NS_TEXT_EVENT: return NS_NewDOMTextEvent(aDOMEvent, aOwner, aPresContext, static_cast(aEvent)); diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 96cdb621c954..51f363960f3f 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -1928,12 +1928,12 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext, nsCOMPtr widget = mCurrentTarget->GetNearestWidget(); // get the widget from the target frame - nsDragEvent startEvent(aEvent->mFlags.mIsTrusted, - NS_DRAGDROP_START, widget); + WidgetDragEvent startEvent(aEvent->mFlags.mIsTrusted, + NS_DRAGDROP_START, widget); FillInEventFromGestureDown(&startEvent); - nsDragEvent gestureEvent(aEvent->mFlags.mIsTrusted, - NS_DRAGDROP_GESTURE, widget); + WidgetDragEvent gestureEvent(aEvent->mFlags.mIsTrusted, + NS_DRAGDROP_GESTURE, widget); FillInEventFromGestureDown(&gestureEvent); startEvent.dataTransfer = gestureEvent.dataTransfer = dataTransfer; @@ -1961,7 +1961,7 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext, nsEventDispatcher::Dispatch(targetContent, aPresContext, &startEvent, nullptr, &status); - nsDragEvent* event = &startEvent; + WidgetDragEvent* event = &startEvent; if (status != nsEventStatus_eConsumeNoDefault) { status = nsEventStatus_eIgnore; nsEventDispatcher::Dispatch(targetContent, aPresContext, &gestureEvent, nullptr, @@ -2086,7 +2086,7 @@ nsEventStateManager::DetermineDragTarget(nsPresContext* aPresContext, bool nsEventStateManager::DoDefaultDragStart(nsPresContext* aPresContext, - nsDragEvent* aDragEvent, + WidgetDragEvent* aDragEvent, nsDOMDataTransfer* aDataTransfer, nsIContent* aDragTarget, nsISelection* aSelection) @@ -3253,7 +3253,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, nsCOMPtr initialDataTransfer; dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer)); - nsDragEvent *dragEvent = (nsDragEvent*)aEvent; + WidgetDragEvent *dragEvent = static_cast(aEvent); // collect any changes to moz cursor settings stored in the event's // data transfer. @@ -3348,8 +3348,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext, getter_AddRefs(targetContent)); nsCOMPtr widget = mCurrentTarget->GetNearestWidget(); - nsDragEvent event(aEvent->mFlags.mIsTrusted, - NS_DRAGDROP_DRAGDROP, widget); + WidgetDragEvent event(aEvent->mFlags.mIsTrusted, + NS_DRAGDROP_DRAGDROP, widget); nsMouseEvent* mouseEvent = static_cast(aEvent); event.refPoint = mouseEvent->refPoint; @@ -4275,7 +4275,7 @@ nsEventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext, nsWeakFrame& aTargetFrame) { nsEventStatus status = nsEventStatus_eIgnore; - nsDragEvent event(aEvent->mFlags.mIsTrusted, aMsg, aEvent->widget); + WidgetDragEvent event(aEvent->mFlags.mIsTrusted, aMsg, aEvent->widget); event.refPoint = aEvent->refPoint; event.modifiers = ((nsMouseEvent*)aEvent)->modifiers; event.buttons = ((nsMouseEvent*)aEvent)->buttons; @@ -4308,7 +4308,7 @@ nsEventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext, } void -nsEventStateManager::UpdateDragDataTransfer(nsDragEvent* dragEvent) +nsEventStateManager::UpdateDragDataTransfer(WidgetDragEvent* dragEvent) { NS_ASSERTION(dragEvent, "drag event is null in UpdateDragDataTransfer!"); if (!dragEvent->dataTransfer) diff --git a/content/events/src/nsEventStateManager.h b/content/events/src/nsEventStateManager.h index 7f0941ad3db2..f65e4db01c36 100644 --- a/content/events/src/nsEventStateManager.h +++ b/content/events/src/nsEventStateManager.h @@ -292,7 +292,7 @@ protected: * Update the initial drag session data transfer with any changes that occur * on cloned data transfer objects used for events. */ - void UpdateDragDataTransfer(nsDragEvent* dragEvent); + void UpdateDragDataTransfer(mozilla::WidgetDragEvent* dragEvent); nsresult SetClickCount(nsPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus); nsresult CheckForAndDispatchClick(nsPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus); @@ -691,10 +691,10 @@ protected: * aSelection - the selection to be dragged */ bool DoDefaultDragStart(nsPresContext* aPresContext, - nsDragEvent* aDragEvent, - nsDOMDataTransfer* aDataTransfer, - nsIContent* aDragTarget, - nsISelection* aSelection); + mozilla::WidgetDragEvent* aDragEvent, + nsDOMDataTransfer* aDataTransfer, + nsIContent* aDragTarget, + nsISelection* aSelection); bool IsTrackingDragGesture ( ) const { return mGestureDownContent != nullptr; } /** diff --git a/dom/interfaces/events/nsIDOMEvent.idl b/dom/interfaces/events/nsIDOMEvent.idl index adf84e550113..a585fc2d4fe2 100644 --- a/dom/interfaces/events/nsIDOMEvent.idl +++ b/dom/interfaces/events/nsIDOMEvent.idl @@ -262,7 +262,7 @@ nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult, mozilla::dom::EventTarget* aOwner, nsPresContext* aPresContext, - nsDragEvent* aEvent); + mozilla::WidgetDragEvent* aEvent); nsresult NS_NewDOMClipboardEvent(nsIDOMEvent** aInstancePtrResult, mozilla::dom::EventTarget* aOwner, diff --git a/editor/libeditor/text/nsPlaintextDataTransfer.cpp b/editor/libeditor/text/nsPlaintextDataTransfer.cpp index 2269b4b27dfb..8bc66218ae1e 100644 --- a/editor/libeditor/text/nsPlaintextDataTransfer.cpp +++ b/editor/libeditor/text/nsPlaintextDataTransfer.cpp @@ -182,7 +182,8 @@ nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent) NS_ENSURE_TRUE(sourceNode, NS_ERROR_FAILURE); } - nsDragEvent* dragEventInternal = static_cast(aDropEvent->GetInternalNSEvent()); + WidgetDragEvent* dragEventInternal = + static_cast(aDropEvent->GetInternalNSEvent()); if (nsContentUtils::CheckForSubFrameDrop(dragSession, dragEventInternal)) { // Don't allow drags from subframe documents with different origins than // the drop destination. diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 46b8a4b73c4e..565c3c40673f 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -2554,7 +2554,7 @@ nsTreeBodyFrame::GetCursor(const nsPoint& aPoint, static uint32_t GetDropEffect(nsGUIEvent* aEvent) { NS_ASSERTION(aEvent->eventStructType == NS_DRAG_EVENT, "wrong event type"); - nsDragEvent* dragEvent = static_cast(aEvent); + WidgetDragEvent* dragEvent = static_cast(aEvent); nsContentUtils::SetDataTransferInEvent(dragEvent); uint32_t action = 0; @@ -2700,7 +2700,7 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext, // The dataTransfer was initialized by the call to GetDropEffect above. bool canDropAtNewLocation = false; - nsDragEvent* dragEvent = static_cast(aEvent); + WidgetDragEvent* dragEvent = static_cast(aEvent); mView->CanDrop(mSlots->mDropRow, mSlots->mDropOrient, dragEvent->dataTransfer, &canDropAtNewLocation); @@ -2732,7 +2732,7 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext, } NS_ASSERTION(aEvent->eventStructType == NS_DRAG_EVENT, "wrong event type"); - nsDragEvent* dragEvent = static_cast(aEvent); + WidgetDragEvent* dragEvent = static_cast(aEvent); nsContentUtils::SetDataTransferInEvent(dragEvent); mView->Drop(mSlots->mDropRow, mSlots->mDropOrient, dragEvent->dataTransfer); diff --git a/widget/EventForwards.h b/widget/EventForwards.h index 2695ee850c60..db60b1197aa5 100644 --- a/widget/EventForwards.h +++ b/widget/EventForwards.h @@ -106,7 +106,6 @@ class InternalMutationEvent; typedef mozilla::WidgetEvent nsEvent; typedef mozilla::WidgetGUIEvent nsGUIEvent; typedef mozilla::WidgetMouseEvent nsMouseEvent; -typedef mozilla::WidgetDragEvent nsDragEvent; typedef mozilla::WidgetMouseScrollEvent nsMouseScrollEvent; namespace mozilla { diff --git a/widget/MouseEvents.h b/widget/MouseEvents.h index f5d5188f4557..1373027da5d5 100644 --- a/widget/MouseEvents.h +++ b/widget/MouseEvents.h @@ -425,7 +425,6 @@ typedef WidgetWheelEvent WheelEvent; // TODO: Remove following typedefs typedef mozilla::WidgetMouseEvent nsMouseEvent; -typedef mozilla::WidgetDragEvent nsDragEvent; typedef mozilla::WidgetMouseScrollEvent nsMouseScrollEvent; #endif // mozilla_MouseEvents_h__ diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index cb439dc708fd..69bad8854a2e 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -5500,7 +5500,7 @@ static int32_t RoundUp(double aDouble) } // set up gecko event - nsDragEvent geckoEvent(true, aMessage, mGeckoChild); + WidgetDragEvent geckoEvent(true, aMessage, mGeckoChild); nsCocoaUtils::InitInputEvent(geckoEvent, [NSApp currentEvent]); // Use our own coordinates in the gecko event. diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 17c2161b576d..bf591dff706f 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -3258,7 +3258,7 @@ void nsWindow::DispatchDragEvent(uint32_t aMsg, const nsIntPoint& aRefPoint, guint aTime) { - nsDragEvent event(true, aMsg, this); + WidgetDragEvent event(true, aMsg, this); if (aMsg == NS_DRAGDROP_OVER) { InitDragEvent(event); @@ -5561,7 +5561,7 @@ theme_changed_cb (GtkSettings *settings, GParamSpec *pspec, nsWindow *data) // These are all of our drag and drop operations void -nsWindow::InitDragEvent(nsDragEvent &aEvent) +nsWindow::InitDragEvent(WidgetDragEvent &aEvent) { // set the keyboard modifiers guint modifierState = KeymapWrapper::GetCurrentModifierState(); diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index 3371dd606604..1c3f2d9e2185 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -424,7 +424,7 @@ private: gchar* mTransparencyBitmap; // all of our DND stuff - void InitDragEvent (nsDragEvent &aEvent); + void InitDragEvent(mozilla::WidgetDragEvent& aEvent); float mLastMotionPressure; diff --git a/widget/os2/nsWindow.cpp b/widget/os2/nsWindow.cpp index 29de290fb8a3..e675602efe40 100644 --- a/widget/os2/nsWindow.cpp +++ b/widget/os2/nsWindow.cpp @@ -3097,7 +3097,7 @@ bool nsWindow::DispatchCommandEvent(uint32_t aEventCommand) bool nsWindow::DispatchDragDropEvent(uint32_t aMsg) { - nsDragEvent event(true, aMsg, this); + WidgetDragEvent event(true, aMsg, this); InitEvent(event); event.InitBasicModifiers(isKeyDown(VK_CTRL), diff --git a/widget/windows/nsNativeDragTarget.cpp b/widget/windows/nsNativeDragTarget.cpp index d64cc271e312..b6e58f6ddf5b 100644 --- a/widget/windows/nsNativeDragTarget.cpp +++ b/widget/windows/nsNativeDragTarget.cpp @@ -19,6 +19,7 @@ #include "mozilla/MouseEvents.h" +using namespace mozilla; using namespace mozilla::widget; /* Define Class IDs */ @@ -155,7 +156,7 @@ void nsNativeDragTarget::DispatchDragDropEvent(uint32_t aEventType, POINTL aPT) { nsEventStatus status; - nsDragEvent event(true, aEventType, mWidget); + WidgetDragEvent event(true, aEventType, mWidget); nsWindow * win = static_cast(mWidget); win->InitEvent(event); diff --git a/widget/xpwidgets/nsBaseDragService.cpp b/widget/xpwidgets/nsBaseDragService.cpp index 885ad0fdb7eb..5f5bebcbf68e 100644 --- a/widget/xpwidgets/nsBaseDragService.cpp +++ b/widget/xpwidgets/nsBaseDragService.cpp @@ -370,7 +370,7 @@ nsBaseDragService::FireDragEventAtSource(uint32_t aMsg) nsCOMPtr presShell = doc->GetShell(); if (presShell) { nsEventStatus status = nsEventStatus_eIgnore; - nsDragEvent event(true, aMsg, nullptr); + WidgetDragEvent event(true, aMsg, nullptr); event.inputSource = mInputSource; if (aMsg == NS_DRAGDROP_END) { event.refPoint.x = mEndDragPoint.x;