Bug 920377 part.27 Get rid of nsMouseEvent_base r=roc

This commit is contained in:
Masayuki Nakano 2013-10-01 16:23:02 +09:00
parent 512bc33b30
commit 3224fb4749
10 changed files with 34 additions and 28 deletions

View File

@ -143,11 +143,13 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent)
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget = nullptr;
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget =
nullptr;
break;
case NS_DRAG_EVENT:
static_cast<nsDragEvent*>(tmp->mEvent)->dataTransfer = nullptr;
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget = nullptr;
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget =
nullptr;
break;
case NS_CLIPBOARD_EVENT:
static_cast<InternalClipboardEvent*>(tmp->mEvent)->clipboardData =
@ -182,7 +184,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent)
case NS_SIMPLE_GESTURE_EVENT:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
cb.NoteXPCOMChild(
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget);
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget);
break;
case NS_DRAG_EVENT:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->dataTransfer");
@ -190,7 +192,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent)
static_cast<nsDragEvent*>(tmp->mEvent)->dataTransfer);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
cb.NoteXPCOMChild(
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget);
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget);
break;
case NS_CLIPBOARD_EVENT:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->clipboardData");

View File

@ -86,8 +86,9 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, bool aCanBubble, bool a
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
{
static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget = aRelatedTarget;
static_cast<nsMouseEvent_base*>(mEvent)->button = aButton;
static_cast<WidgetMouseEventBase*>(mEvent)->relatedTarget =
aRelatedTarget;
static_cast<WidgetMouseEventBase*>(mEvent)->button = aButton;
WidgetInputEvent* inputEvent = static_cast<WidgetInputEvent*>(mEvent);
inputEvent->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
mClientPoint.x = aClientX;
@ -169,7 +170,7 @@ nsDOMMouseEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
static_cast<nsMouseEvent_base*>(e->mEvent)->buttons = aParam.mButtons;
static_cast<WidgetMouseEventBase*>(e->mEvent)->buttons = aParam.mButtons;
break;
default:
break;
@ -192,8 +193,8 @@ nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool
aMetaKey, aButton, aRelatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
static_cast<nsMouseEvent_base*>(mEvent)->pressure = aPressure;
static_cast<nsMouseEvent_base*>(mEvent)->inputSource = aInputSource;
static_cast<WidgetMouseEventBase*>(mEvent)->pressure = aPressure;
static_cast<WidgetMouseEventBase*>(mEvent)->inputSource = aInputSource;
return NS_OK;
}
@ -215,7 +216,7 @@ nsDOMMouseEvent::Button()
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
return static_cast<nsMouseEvent_base*>(mEvent)->button;
return static_cast<WidgetMouseEventBase*>(mEvent)->button;
default:
NS_WARNING("Tried to get mouse button for non-mouse event!");
return nsMouseEvent::eLeftButton;
@ -240,7 +241,7 @@ nsDOMMouseEvent::Buttons()
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
return static_cast<nsMouseEvent_base*>(mEvent)->buttons;
return static_cast<WidgetMouseEventBase*>(mEvent)->buttons;
default:
MOZ_CRASH("Tried to get mouse buttons for non-mouse event!");
}
@ -265,7 +266,8 @@ nsDOMMouseEvent::GetRelatedTarget()
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
relatedTarget = do_QueryInterface(static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget);
relatedTarget = do_QueryInterface(
static_cast<WidgetMouseEventBase*>(mEvent)->relatedTarget);
break;
default:
break;

View File

@ -95,11 +95,11 @@ public:
}
float MozPressure() const
{
return static_cast<nsMouseEvent_base*>(mEvent)->pressure;
return static_cast<mozilla::WidgetMouseEventBase*>(mEvent)->pressure;
}
uint16_t MozInputSource() const
{
return static_cast<nsMouseEvent_base*>(mEvent)->inputSource;
return static_cast<mozilla::WidgetMouseEventBase*>(mEvent)->inputSource;
}
void InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
nsIDOMWindow *aView, int32_t aDetail, int32_t aScreenX,

View File

@ -105,7 +105,6 @@ class InternalMutationEvent;
// TODO: Remove following typedefs
typedef mozilla::WidgetEvent nsEvent;
typedef mozilla::WidgetGUIEvent nsGUIEvent;
typedef mozilla::WidgetMouseEventBase nsMouseEvent_base;
typedef mozilla::WidgetMouseEvent nsMouseEvent;
typedef mozilla::WidgetDragEvent nsDragEvent;
typedef mozilla::WidgetMouseScrollEvent nsMouseScrollEvent;

View File

@ -424,7 +424,6 @@ typedef WidgetWheelEvent WheelEvent;
} // namespace mozilla
// TODO: Remove following typedefs
typedef mozilla::WidgetMouseEventBase nsMouseEvent_base;
typedef mozilla::WidgetMouseEvent nsMouseEvent;
typedef mozilla::WidgetDragEvent nsDragEvent;
typedef mozilla::WidgetMouseScrollEvent nsMouseScrollEvent;

View File

@ -381,7 +381,7 @@ public:
static void ReEvaluateMouseEnterState(NSEvent* aEvent = nil, ChildView* aOldView = nil);
static void ResendLastMouseMoveEvent();
static ChildView* ViewForEvent(NSEvent* aEvent);
static void AttachPluginEvent(nsMouseEvent_base& aMouseEvent,
static void AttachPluginEvent(mozilla::WidgetMouseEventBase& aMouseEvent,
ChildView* aView,
NSEvent* aNativeMouseEvent,
int aPluginEventType,

View File

@ -4852,8 +4852,8 @@ static int32_t RoundUp(double aDouble)
outGeckoEvent->refPoint = LayoutDeviceIntPoint::FromUntyped(
mGeckoChild->CocoaPointsToDevPixels(localPoint));
nsMouseEvent_base* mouseEvent =
static_cast<nsMouseEvent_base*>(outGeckoEvent);
WidgetMouseEventBase* mouseEvent =
static_cast<WidgetMouseEventBase*>(outGeckoEvent);
mouseEvent->buttons = 0;
NSUInteger mouseButtons = [NSEvent pressedMouseButtons];
@ -6137,7 +6137,7 @@ ChildViewMouseTracker::ViewForEvent(NSEvent* aEvent)
}
void
ChildViewMouseTracker::AttachPluginEvent(nsMouseEvent_base& aMouseEvent,
ChildViewMouseTracker::AttachPluginEvent(WidgetMouseEventBase& aMouseEvent,
ChildView* aView,
NSEvent* aNativeMouseEvent,
int aPluginEventType,

View File

@ -560,7 +560,8 @@ KeymapWrapper::InitInputEvent(WidgetInputEvent& aInputEvent,
return;
}
nsMouseEvent_base& mouseEvent = static_cast<nsMouseEvent_base&>(aInputEvent);
WidgetMouseEventBase& mouseEvent =
static_cast<WidgetMouseEventBase&>(aInputEvent);
mouseEvent.buttons = 0;
if (aModifierState & GDK_BUTTON1_MASK) {
mouseEvent.buttons |= nsMouseEvent::eLeftButtonFlag;

View File

@ -100,9 +100,9 @@ struct ParamTraits<mozilla::WidgetInputEvent>
};
template<>
struct ParamTraits<nsMouseEvent_base>
struct ParamTraits<mozilla::WidgetMouseEventBase>
{
typedef nsMouseEvent_base paramType;
typedef mozilla::WidgetMouseEventBase paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
@ -131,7 +131,7 @@ struct ParamTraits<mozilla::WheelEvent>
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<nsMouseEvent_base>(aParam));
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
WriteParam(aMsg, aParam.deltaX);
WriteParam(aMsg, aParam.deltaY);
WriteParam(aMsg, aParam.deltaZ);
@ -150,7 +150,8 @@ struct ParamTraits<mozilla::WheelEvent>
{
int32_t scrollType = 0;
bool rv =
ReadParam(aMsg, aIter, static_cast<nsMouseEvent_base*>(aResult)) &&
ReadParam(aMsg, aIter,
static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->deltaX) &&
ReadParam(aMsg, aIter, &aResult->deltaY) &&
ReadParam(aMsg, aIter, &aResult->deltaZ) &&
@ -176,7 +177,7 @@ struct ParamTraits<nsMouseEvent>
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<nsMouseEvent_base>(aParam));
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
WriteParam(aMsg, aParam.ignoreRootScrollFrame);
WriteParam(aMsg, (uint8_t) aParam.reason);
WriteParam(aMsg, (uint8_t) aParam.context);
@ -188,7 +189,8 @@ struct ParamTraits<nsMouseEvent>
{
bool rv;
uint8_t reason = 0, context = 0, exit = 0;
rv = ReadParam(aMsg, aIter, static_cast<nsMouseEvent_base*>(aResult)) &&
rv = ReadParam(aMsg, aIter,
static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->ignoreRootScrollFrame) &&
ReadParam(aMsg, aIter, &reason) &&
ReadParam(aMsg, aIter, &context) &&

View File

@ -151,7 +151,8 @@ ModifierKeyState::InitMouseEvent(WidgetInputEvent& aMouseEvent) const
aMouseEvent.eventStructType == NS_SIMPLE_GESTURE_EVENT,
"called with non-mouse event");
nsMouseEvent_base& mouseEvent = static_cast<nsMouseEvent_base&>(aMouseEvent);
WidgetMouseEventBase& mouseEvent =
static_cast<WidgetMouseEventBase&>(aMouseEvent);
mouseEvent.buttons = 0;
if (::GetKeyState(VK_LBUTTON) < 0) {
mouseEvent.buttons |= nsMouseEvent::eLeftButtonFlag;