Bug 920377 part.28 Get rid of nsDragEvent r=roc

This commit is contained in:
Masayuki Nakano 2013-10-01 16:23:02 +09:00
parent 3224fb4749
commit 3fa4d1fd4d
19 changed files with 47 additions and 47 deletions

View File

@ -1407,9 +1407,9 @@ public:
static already_AddRefed<nsIDragSession> 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://).

View File

@ -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<nsIContent> target = do_QueryInterface(aDropEvent->originalTarget);
if (!target) {

View File

@ -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<nsDragEvent*>(mEvent);
delete static_cast<WidgetDragEvent*>(mEvent);
mEvent = nullptr;
}
}
@ -62,7 +62,7 @@ nsDOMDragEvent::InitDragEvent(const nsAString & aType,
NS_ENSURE_SUCCESS(rv, rv);
if (mEventIsInternal && mEvent) {
nsDragEvent* dragEvent = static_cast<nsDragEvent*>(mEvent);
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(mEvent);
dragEvent->dataTransfer = aDataTransfer;
}
@ -88,7 +88,7 @@ nsDOMDragEvent::GetDataTransfer()
return nullptr;
}
nsDragEvent* dragEvent = static_cast<nsDragEvent*>(mEvent);
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(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);

View File

@ -55,6 +55,6 @@ public:
nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsDragEvent* aEvent);
mozilla::WidgetDragEvent* aEvent);
#endif // nsDOMDragEvent_h__

View File

@ -147,7 +147,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent)
nullptr;
break;
case NS_DRAG_EVENT:
static_cast<nsDragEvent*>(tmp->mEvent)->dataTransfer = nullptr;
static_cast<WidgetDragEvent*>(tmp->mEvent)->dataTransfer = nullptr;
static_cast<WidgetMouseEventBase*>(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<nsDragEvent*>(tmp->mEvent)->dataTransfer);
static_cast<WidgetDragEvent*>(tmp->mEvent)->dataTransfer);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
cb.NoteXPCOMChild(
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget);
@ -559,9 +559,8 @@ nsDOMEvent::DuplicatePrivateData()
}
case NS_DRAG_EVENT:
{
nsDragEvent* oldDragEvent = static_cast<nsDragEvent*>(mEvent);
nsDragEvent* dragEvent =
new nsDragEvent(false, msg, nullptr);
WidgetDragEvent* oldDragEvent = static_cast<WidgetDragEvent*>(mEvent);
WidgetDragEvent* dragEvent = new WidgetDragEvent(false, msg, nullptr);
dragEvent->AssignDragEventData(*oldDragEvent, true);
newEvent = dragEvent;
break;

View File

@ -722,7 +722,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
static_cast<WheelEvent*>(aEvent));
case NS_DRAG_EVENT:
return NS_NewDOMDragEvent(aDOMEvent, aOwner, aPresContext,
static_cast<nsDragEvent*>(aEvent));
static_cast<WidgetDragEvent*>(aEvent));
case NS_TEXT_EVENT:
return NS_NewDOMTextEvent(aDOMEvent, aOwner, aPresContext,
static_cast<WidgetTextEvent*>(aEvent));

View File

@ -1928,12 +1928,12 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
nsCOMPtr<nsIWidget> 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<nsIDOMDataTransfer> initialDataTransfer;
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
nsDragEvent *dragEvent = (nsDragEvent*)aEvent;
WidgetDragEvent *dragEvent = static_cast<WidgetDragEvent*>(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<nsIWidget> 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<nsMouseEvent*>(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)

View File

@ -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; }
/**

View File

@ -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,

View File

@ -182,7 +182,8 @@ nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
NS_ENSURE_TRUE(sourceNode, NS_ERROR_FAILURE);
}
nsDragEvent* dragEventInternal = static_cast<nsDragEvent *>(aDropEvent->GetInternalNSEvent());
WidgetDragEvent* dragEventInternal =
static_cast<WidgetDragEvent*>(aDropEvent->GetInternalNSEvent());
if (nsContentUtils::CheckForSubFrameDrop(dragSession, dragEventInternal)) {
// Don't allow drags from subframe documents with different origins than
// the drop destination.

View File

@ -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<nsDragEvent *>(aEvent);
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(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<nsDragEvent *>(aEvent);
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(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<nsDragEvent*>(aEvent);
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(aEvent);
nsContentUtils::SetDataTransferInEvent(dragEvent);
mView->Drop(mSlots->mDropRow, mSlots->mDropOrient, dragEvent->dataTransfer);

View File

@ -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 {

View File

@ -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__

View File

@ -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.

View File

@ -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();

View File

@ -424,7 +424,7 @@ private:
gchar* mTransparencyBitmap;
// all of our DND stuff
void InitDragEvent (nsDragEvent &aEvent);
void InitDragEvent(mozilla::WidgetDragEvent& aEvent);
float mLastMotionPressure;

View File

@ -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),

View File

@ -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<nsWindow *>(mWidget);
win->InitEvent(event);

View File

@ -370,7 +370,7 @@ nsBaseDragService::FireDragEventAtSource(uint32_t aMsg)
nsCOMPtr<nsIPresShell> 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;