Bug 1046101 part.1 Rename nsEventStructType to mozilla::EventClassID r=smaug

This commit is contained in:
Masayuki Nakano 2014-08-04 14:28:46 +09:00
parent ee8f6d3f54
commit 2c24a0ea29
49 changed files with 245 additions and 236 deletions

View File

@ -1728,7 +1728,7 @@ Element::DispatchClickEvent(nsPresContext* aPresContext,
clickCount = sourceMouseEvent->clickCount;
pressure = sourceMouseEvent->pressure;
inputSource = sourceMouseEvent->inputSource;
} else if (aSourceEvent->eventStructType == NS_KEY_EVENT) {
} else if (aSourceEvent->mClass == NS_KEY_EVENT) {
inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
}
event.pressure = pressure;

View File

@ -814,7 +814,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
// all the events are allowed even in the native anonymous content..
nsCOMPtr<nsIContent> t = do_QueryInterface(aVisitor.mEvent->originalTarget);
NS_ASSERTION(!t || !t->ChromeOnlyAccess() ||
aVisitor.mEvent->eventStructType != NS_MUTATION_EVENT ||
aVisitor.mEvent->mClass != NS_MUTATION_EVENT ||
aVisitor.mDOMEvent,
"Mutation event dispatched in native anonymous content!?!");
#endif

View File

@ -4894,7 +4894,7 @@ nsContentUtils::GetAccelKeyCandidates(nsIDOMKeyEvent* aDOMKeyEvent,
WidgetKeyboardEvent* nativeKeyEvent =
aDOMKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
if (nativeKeyEvent) {
NS_ASSERTION(nativeKeyEvent->eventStructType == NS_KEY_EVENT,
NS_ASSERTION(nativeKeyEvent->mClass == NS_KEY_EVENT,
"wrong type of native event");
// nsShortcutCandidate::mCharCode is a candidate charCode.
// nsShoftcutCandidate::mIgnoreShift means the mCharCode should be tried to

View File

@ -293,7 +293,7 @@ HTMLCanvasElement::CopyInnerTo(Element* aDest)
nsresult HTMLCanvasElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
{
if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT) {
if (aVisitor.mEvent->mClass == NS_MOUSE_EVENT) {
WidgetMouseEventBase* evt = (WidgetMouseEventBase*)aVisitor.mEvent;
if (mCurrentContext) {
nsIFrame *frame = GetPrimaryFrame();

View File

@ -3251,7 +3251,7 @@ HTMLInputElement::NeedToInitializeEditorForEvent(
// handled without the editor being initialized. These events include:
// mousein/move/out, overflow/underflow, and DOM mutation events.
if (!IsSingleLineTextControl(false) ||
aVisitor.mEvent->eventStructType == NS_MUTATION_EVENT) {
aVisitor.mEvent->mClass == NS_MUTATION_EVENT) {
return false;
}
@ -4269,9 +4269,9 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
MOZ_ASSERT(mType == NS_FORM_INPUT_RANGE);
if (nsEventStatus_eConsumeNoDefault == aVisitor.mEventStatus ||
!(aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT ||
aVisitor.mEvent->eventStructType == NS_TOUCH_EVENT ||
aVisitor.mEvent->eventStructType == NS_KEY_EVENT)) {
!(aVisitor.mEvent->mClass == NS_MOUSE_EVENT ||
aVisitor.mEvent->mClass == NS_TOUCH_EVENT ||
aVisitor.mEvent->mClass == NS_KEY_EVENT)) {
return;
}

View File

@ -1289,7 +1289,7 @@ nsXULElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
return NS_OK;
}
if (aVisitor.mEvent->message == NS_XUL_COMMAND &&
aVisitor.mEvent->eventStructType == NS_INPUT_EVENT &&
aVisitor.mEvent->mClass == NS_INPUT_EVENT &&
aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this) &&
tag != nsGkAtoms::command) {
// Check that we really have an xul command event. That will be handled

View File

@ -13494,7 +13494,7 @@ nsGlobalWindow::BeginWindowMove(Event& aMouseDownEvent, Element* aPanel,
WidgetMouseEvent* mouseEvent =
aMouseDownEvent.GetInternalNSEvent()->AsMouseEvent();
if (!mouseEvent || mouseEvent->eventStructType != NS_MOUSE_EVENT) {
if (!mouseEvent || mouseEvent->mClass != NS_MOUSE_EVENT) {
aError.Throw(NS_ERROR_FAILURE);
return;
}

View File

@ -17,7 +17,7 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetCompositionEvent(false, 0, nullptr))
{
NS_ASSERTION(mEvent->eventStructType == NS_COMPOSITION_EVENT,
NS_ASSERTION(mEvent->mClass == NS_COMPOSITION_EVENT,
"event type mismatch");
if (aEvent) {

View File

@ -116,7 +116,7 @@ DragEvent::GetDataTransfer()
// with the drag. It is initialized when an attempt is made to retrieve it
// rather that when the event is created to avoid duplicating the data when
// no listener ever uses it.
if (!mEvent || mEvent->eventStructType != NS_DRAG_EVENT) {
if (!mEvent || mEvent->mClass != NS_DRAG_EVENT) {
NS_WARNING("Tried to get dataTransfer from non-drag event!");
return nullptr;
}

View File

@ -157,7 +157,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Event)
tmp->mEvent->target = nullptr;
tmp->mEvent->currentTarget = nullptr;
tmp->mEvent->originalTarget = nullptr;
switch (tmp->mEvent->eventStructType) {
switch (tmp->mEvent->mClass) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
@ -195,7 +195,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Event)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->target)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->currentTarget)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->originalTarget)
switch (tmp->mEvent->eventStructType) {
switch (tmp->mEvent->mClass) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
@ -525,7 +525,7 @@ Event::SetEventType(const nsAString& aEventTypeArg)
if (mIsMainThreadEvent) {
mEvent->typeString.Truncate();
mEvent->userType =
nsContentUtils::GetEventIdAndAtom(aEventTypeArg, mEvent->eventStructType,
nsContentUtils::GetEventIdAndAtom(aEventTypeArg, mEvent->mClass,
&(mEvent->message));
} else {
mEvent->userType = nullptr;
@ -661,7 +661,7 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent)
// check for exceptions:
PopupControlState abuse = openAbused;
switch(aEvent->eventStructType) {
switch(aEvent->mClass) {
case NS_EVENT :
// For these following events only allow popups if they're
// triggered while handling user input. See
@ -847,13 +847,13 @@ Event::GetScreenCoords(nsPresContext* aPresContext,
}
if (!aEvent ||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
aEvent->eventStructType != NS_WHEEL_EVENT &&
aEvent->eventStructType != NS_POINTER_EVENT &&
aEvent->eventStructType != NS_TOUCH_EVENT &&
aEvent->eventStructType != NS_DRAG_EVENT &&
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT)) {
(aEvent->mClass != NS_MOUSE_EVENT &&
aEvent->mClass != NS_MOUSE_SCROLL_EVENT &&
aEvent->mClass != NS_WHEEL_EVENT &&
aEvent->mClass != NS_POINTER_EVENT &&
aEvent->mClass != NS_TOUCH_EVENT &&
aEvent->mClass != NS_DRAG_EVENT &&
aEvent->mClass != NS_SIMPLE_GESTURE_EVENT)) {
return nsIntPoint(0, 0);
}
@ -903,13 +903,13 @@ Event::GetClientCoords(nsPresContext* aPresContext,
}
if (!aEvent ||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
aEvent->eventStructType != NS_WHEEL_EVENT &&
aEvent->eventStructType != NS_TOUCH_EVENT &&
aEvent->eventStructType != NS_DRAG_EVENT &&
aEvent->eventStructType != NS_POINTER_EVENT &&
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
(aEvent->mClass != NS_MOUSE_EVENT &&
aEvent->mClass != NS_MOUSE_SCROLL_EVENT &&
aEvent->mClass != NS_WHEEL_EVENT &&
aEvent->mClass != NS_TOUCH_EVENT &&
aEvent->mClass != NS_DRAG_EVENT &&
aEvent->mClass != NS_POINTER_EVENT &&
aEvent->mClass != NS_SIMPLE_GESTURE_EVENT) ||
!aPresContext ||
!aEvent->AsGUIEvent()->widget) {
return aDefaultPoint;

View File

@ -684,7 +684,7 @@ EventDispatcher::CreateEvent(EventTarget* aOwner,
*aDOMEvent = nullptr;
if (aEvent) {
switch(aEvent->eventStructType) {
switch(aEvent->mClass) {
case NS_MUTATION_EVENT:
return NS_NewDOMMutationEvent(aDOMEvent, aOwner, aPresContext,
aEvent->AsMutationEvent());

View File

@ -497,7 +497,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
if (aEvent->mFlags.mIsTrusted &&
((mouseEvent && mouseEvent->IsReal()) ||
aEvent->eventStructType == NS_WHEEL_EVENT) &&
aEvent->mClass == NS_WHEEL_EVENT) &&
!sIsPointerLocked) {
sLastScreenPoint =
UIEvent::CalculateScreenPoint(aPresContext, aEvent);
@ -511,8 +511,8 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
((mouseEvent && mouseEvent->IsReal() &&
mouseEvent->message != NS_MOUSE_ENTER &&
mouseEvent->message != NS_MOUSE_EXIT) ||
aEvent->eventStructType == NS_WHEEL_EVENT ||
aEvent->eventStructType == NS_KEY_EVENT)) {
aEvent->mClass == NS_WHEEL_EVENT ||
aEvent->mClass == NS_KEY_EVENT)) {
if (gMouseOrKeyboardEventCounter == 0) {
nsCOMPtr<nsIObserverService> obs =
mozilla::services::GetObserverService();
@ -1089,7 +1089,7 @@ EventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
return false;
}
switch (aEvent->eventStructType) {
switch (aEvent->mClass) {
case NS_MOUSE_EVENT: {
return remote->SendRealMouseEvent(*aEvent->AsMouseEvent());
}
@ -1156,7 +1156,7 @@ EventStateManager::GetChildProcessOffset(nsFrameLoader* aFrameLoader,
bool
CrossProcessSafeEvent(const WidgetEvent& aEvent)
{
switch (aEvent.eventStructType) {
switch (aEvent.mClass) {
case NS_KEY_EVENT:
case NS_WHEEL_EVENT:
return true;
@ -1200,7 +1200,7 @@ EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
//
// NB: the elements of |targets| must be unique, for correctness.
nsAutoTArray<nsCOMPtr<nsIContent>, 1> targets;
if (aEvent->eventStructType != NS_TOUCH_EVENT ||
if (aEvent->mClass != NS_TOUCH_EVENT ||
aEvent->message == NS_TOUCH_START) {
// If this event only has one target, and it's remote, add it to
// the array.
@ -3013,7 +3013,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
case NS_DRAGDROP_ENTER:
case NS_DRAGDROP_OVER:
{
NS_ASSERTION(aEvent->eventStructType == NS_DRAG_EVENT, "Expected a drag event");
NS_ASSERTION(aEvent->mClass == NS_DRAG_EVENT, "Expected a drag event");
nsCOMPtr<nsIDragSession> dragSession = nsContentUtils::GetDragSession();
if (!dragSession)
@ -3787,7 +3787,7 @@ EventStateManager::NotifyMouseOut(WidgetMouseEvent* aMouseEvent,
// hover state itself, and we have optimizations for hover switching between
// two nearby elements both deep in the DOM tree that would be defeated by
// switching the hover state to null here.
bool isPointer = aMouseEvent->eventStructType == NS_POINTER_EVENT;
bool isPointer = aMouseEvent->mClass == NS_POINTER_EVENT;
if (!aMovingInto && !isPointer) {
// Unset :hover
SetContentState(nullptr, NS_EVENT_STATE_HOVER);
@ -3850,7 +3850,7 @@ EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
// DispatchMouseOrPointerEvent() call below, since NotifyMouseOut() resets it, bug 298477.
nsCOMPtr<nsIContent> lastOverElement = wrapper->mLastOverElement;
bool isPointer = aMouseEvent->eventStructType == NS_POINTER_EVENT;
bool isPointer = aMouseEvent->mClass == NS_POINTER_EVENT;
Maybe<EnterLeaveDispatcher> enterDispatcher;
if (dispatch) {

View File

@ -130,9 +130,9 @@ GetIMEStateSetOpenName(IMEState::Open aOpen)
}
static const char*
GetEventStructName(nsEventStructType aEventStructType)
GetEventClassIDName(EventClassID aEventClassID)
{
switch (aEventStructType) {
switch (aEventClassID) {
case NS_COMPOSITION_EVENT:
return "NS_COMPOSITION_EVENT";
case NS_TEXT_EVENT:
@ -850,16 +850,16 @@ IMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
{
PR_LOG(sISMLog, PR_LOG_ALWAYS,
("ISM: IMEStateManager::DispatchCompositionEvent(aNode=0x%p, "
"aPresContext=0x%p, aEvent={ eventStructType=%s, message=%s, "
"aPresContext=0x%p, aEvent={ mClass=%s, message=%s, "
" mFlags={ mIsTrusted=%s, mPropagationStopped=%s } })",
aEventTargetNode, aPresContext,
GetEventStructName(aEvent->eventStructType),
GetEventClassIDName(aEvent->mClass),
GetEventMessageName(aEvent->message),
GetBoolName(aEvent->mFlags.mIsTrusted),
GetBoolName(aEvent->mFlags.mPropagationStopped)));
MOZ_ASSERT(aEvent->eventStructType == NS_COMPOSITION_EVENT ||
aEvent->eventStructType == NS_TEXT_EVENT);
MOZ_ASSERT(aEvent->mClass == NS_COMPOSITION_EVENT ||
aEvent->mClass == NS_TEXT_EVENT);
if (!aEvent->mFlags.mIsTrusted || aEvent->mFlags.mPropagationStopped) {
return;
}

View File

@ -16,7 +16,7 @@ InputEvent::InputEvent(EventTarget* aOwner,
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent : new InternalEditorInputEvent(false, 0, nullptr))
{
NS_ASSERTION(mEvent->eventStructType == NS_EDITOR_INPUT_EVENT,
NS_ASSERTION(mEvent->mClass == NS_EDITOR_INPUT_EVENT,
"event type mismatch");
if (aEvent) {

View File

@ -27,7 +27,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_MUTATION_EVENT,
MOZ_ASSERT(mClass == NS_MUTATION_EVENT,
"Duplicate() must be overridden by sub class");
InternalMutationEvent* result = new InternalMutationEvent(false, message);
result->AssignMutationEventData(*this, true);

View File

@ -19,7 +19,7 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
, mInitializedByCtor(false)
, mInitialzedWhichValue(0)
{
NS_ASSERTION(mEvent->eventStructType == NS_KEY_EVENT, "event type mismatch");
NS_ASSERTION(mEvent->mClass == NS_KEY_EVENT, "event type mismatch");
if (aEvent) {
mEventIsInternal = false;

View File

@ -69,7 +69,7 @@ MouseEvent::InitMouseEvent(const nsAString& aType,
UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv);
switch(mEvent->eventStructType) {
switch(mEvent->mClass) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
@ -123,7 +123,7 @@ MouseEvent::InitMouseEvent(const nsAString& aType,
aButton, aRelatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
switch(mEvent->eventStructType) {
switch(mEvent->mClass) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
@ -154,7 +154,7 @@ MouseEvent::Constructor(const GlobalObject& aGlobal,
aRv);
e->SetTrusted(trusted);
switch (e->mEvent->eventStructType) {
switch (e->mEvent->mClass) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
@ -213,8 +213,7 @@ MouseEvent::GetButton(int16_t* aButton)
int16_t
MouseEvent::Button()
{
switch(mEvent->eventStructType)
{
switch(mEvent->mClass) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
@ -239,8 +238,7 @@ MouseEvent::GetButtons(uint16_t* aButtons)
uint16_t
MouseEvent::Buttons()
{
switch(mEvent->eventStructType)
{
switch(mEvent->mClass) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
@ -265,8 +263,7 @@ already_AddRefed<EventTarget>
MouseEvent::GetRelatedTarget()
{
nsCOMPtr<EventTarget> relatedTarget;
switch(mEvent->eventStructType)
{
switch(mEvent->mClass) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:

View File

@ -18,7 +18,7 @@ PointerEvent::PointerEvent(EventTarget* aOwner,
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetPointerEvent(false, 0, nullptr))
{
NS_ASSERTION(mEvent->eventStructType == NS_POINTER_EVENT,
NS_ASSERTION(mEvent->mClass == NS_POINTER_EVENT,
"event type mismatch NS_POINTER_EVENT");
WidgetMouseEvent* mouseEvent = mEvent->AsMouseEvent();

View File

@ -17,7 +17,8 @@ SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
aEvent ? aEvent :
new WidgetSimpleGestureEvent(false, 0, nullptr))
{
NS_ASSERTION(mEvent->eventStructType == NS_SIMPLE_GESTURE_EVENT, "event type mismatch");
NS_ASSERTION(mEvent->mClass == NS_SIMPLE_GESTURE_EVENT,
"event type mismatch");
if (aEvent) {
mEventIsInternal = false;

View File

@ -110,7 +110,7 @@ TextComposition::NotityUpdateComposition(WidgetGUIEvent* aEvent)
mCompositionStartOffset = 0;
}
mCompositionTargetOffset = mCompositionStartOffset;
} else if (aEvent->eventStructType != NS_TEXT_EVENT) {
} else if (aEvent->mClass != NS_TEXT_EVENT) {
return;
} else {
mCompositionTargetOffset =

View File

@ -46,8 +46,7 @@ UIEvent::UIEvent(EventTarget* aOwner,
// Fill mDetail and mView according to the mEvent (widget-generated
// event) we've got
switch(mEvent->eventStructType)
{
switch(mEvent->mClass) {
case NS_UI_EVENT:
{
mDetail = mEvent->AsUIEvent()->detail;
@ -119,12 +118,12 @@ UIEvent::GetMovementPoint()
}
if (!mEvent ||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
mEvent->eventStructType != NS_WHEEL_EVENT &&
mEvent->eventStructType != NS_DRAG_EVENT &&
mEvent->eventStructType != NS_POINTER_EVENT &&
mEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
(mEvent->mClass != NS_MOUSE_EVENT &&
mEvent->mClass != NS_MOUSE_SCROLL_EVENT &&
mEvent->mClass != NS_WHEEL_EVENT &&
mEvent->mClass != NS_DRAG_EVENT &&
mEvent->mClass != NS_POINTER_EVENT &&
mEvent->mClass != NS_SIMPLE_GESTURE_EVENT) ||
!mEvent->AsGUIEvent()->widget) {
return nsIntPoint(0, 0);
}
@ -297,13 +296,13 @@ nsIntPoint
UIEvent::GetLayerPoint() const
{
if (!mEvent ||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
mEvent->eventStructType != NS_WHEEL_EVENT &&
mEvent->eventStructType != NS_POINTER_EVENT &&
mEvent->eventStructType != NS_TOUCH_EVENT &&
mEvent->eventStructType != NS_DRAG_EVENT &&
mEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
(mEvent->mClass != NS_MOUSE_EVENT &&
mEvent->mClass != NS_MOUSE_SCROLL_EVENT &&
mEvent->mClass != NS_WHEEL_EVENT &&
mEvent->mClass != NS_POINTER_EVENT &&
mEvent->mClass != NS_TOUCH_EVENT &&
mEvent->mClass != NS_DRAG_EVENT &&
mEvent->mClass != NS_SIMPLE_GESTURE_EVENT) ||
!mPresContext ||
mEventIsInternal) {
return mLayerPoint;

View File

@ -43,12 +43,12 @@ public:
WidgetEvent* aEvent)
{
if (!aEvent ||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
aEvent->eventStructType != NS_WHEEL_EVENT &&
aEvent->eventStructType != NS_DRAG_EVENT &&
aEvent->eventStructType != NS_POINTER_EVENT &&
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT)) {
(aEvent->mClass != NS_MOUSE_EVENT &&
aEvent->mClass != NS_MOUSE_SCROLL_EVENT &&
aEvent->mClass != NS_WHEEL_EVENT &&
aEvent->mClass != NS_DRAG_EVENT &&
aEvent->mClass != NS_POINTER_EVENT &&
aEvent->mClass != NS_SIMPLE_GESTURE_EVENT)) {
return nsIntPoint(0, 0);
}
@ -70,12 +70,12 @@ public:
CSSIntPoint* aDefaultClientPoint)
{
if (!aEvent ||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
aEvent->eventStructType != NS_WHEEL_EVENT &&
aEvent->eventStructType != NS_DRAG_EVENT &&
aEvent->eventStructType != NS_POINTER_EVENT &&
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
(aEvent->mClass != NS_MOUSE_EVENT &&
aEvent->mClass != NS_MOUSE_SCROLL_EVENT &&
aEvent->mClass != NS_WHEEL_EVENT &&
aEvent->mClass != NS_DRAG_EVENT &&
aEvent->mClass != NS_POINTER_EVENT &&
aEvent->mClass != NS_SIMPLE_GESTURE_EVENT) ||
!aPresContext ||
!aEvent->AsGUIEvent()->widget) {
return aDefaultClientPoint
@ -132,9 +132,9 @@ public:
virtual uint32_t Which()
{
MOZ_ASSERT(mEvent->eventStructType != NS_KEY_EVENT,
MOZ_ASSERT(mEvent->mClass != NS_KEY_EVENT,
"Key events should override Which()");
MOZ_ASSERT(mEvent->eventStructType != NS_MOUSE_EVENT,
MOZ_ASSERT(mEvent->mClass != NS_MOUSE_EVENT,
"Mouse events should override Which()");
return 0;
}

View File

@ -779,7 +779,7 @@ void
TabParent::MapEventCoordinatesForChildProcess(
const LayoutDeviceIntPoint& aOffset, WidgetEvent* aEvent)
{
if (aEvent->eventStructType != NS_TOUCH_EVENT) {
if (aEvent->mClass != NS_TOUCH_EVENT) {
aEvent->refPoint = aOffset;
} else {
aEvent->refPoint = LayoutDeviceIntPoint();
@ -1015,7 +1015,7 @@ TabParent::TryCapture(const WidgetGUIEvent& aEvent)
{
MOZ_ASSERT(sEventCapturer == this && mEventCaptureDepth > 0);
if (aEvent.eventStructType != NS_TOUCH_EVENT) {
if (aEvent.mClass != NS_TOUCH_EVENT) {
// Only capture of touch events is implemented, for now.
return false;
}

View File

@ -1638,7 +1638,7 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
if (mInstance) {
WidgetKeyboardEvent* keyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
if (keyEvent && keyEvent->eventStructType == NS_KEY_EVENT) {
if (keyEvent && keyEvent->mClass == NS_KEY_EVENT) {
nsEventStatus rv = ProcessEvent(*keyEvent);
if (nsEventStatus_eConsumeNoDefault == rv) {
aKeyEvent->PreventDefault();
@ -1673,7 +1673,7 @@ nsPluginInstanceOwner::ProcessMouseDown(nsIDOMEvent* aMouseEvent)
WidgetMouseEvent* mouseEvent =
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
if (mouseEvent && mouseEvent->eventStructType == NS_MOUSE_EVENT) {
if (mouseEvent && mouseEvent->mClass == NS_MOUSE_EVENT) {
mLastMouseDownButtonType = mouseEvent->button;
nsEventStatus rv = ProcessEvent(*mouseEvent);
if (nsEventStatus_eConsumeNoDefault == rv) {
@ -1698,7 +1698,7 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent,
WidgetMouseEvent* mouseEvent =
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
if (mouseEvent && mouseEvent->eventStructType == NS_MOUSE_EVENT) {
if (mouseEvent && mouseEvent->mClass == NS_MOUSE_EVENT) {
nsEventStatus rv = ProcessEvent(*mouseEvent);
if (nsEventStatus_eConsumeNoDefault == rv) {
aMouseEvent->PreventDefault();
@ -1904,7 +1904,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
// we can get synthetic events from the EventStateManager... these
// have no pluginEvent
NPEvent pluginEvent;
if (anEvent.eventStructType == NS_MOUSE_EVENT) {
if (anEvent.mClass == NS_MOUSE_EVENT) {
if (!pPluginEvent) {
// XXX Should extend this list to synthesize events for more event
// types
@ -2011,8 +2011,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
XEvent pluginEvent = XEvent();
pluginEvent.type = 0;
switch(anEvent.eventStructType)
{
switch(anEvent.mClass) {
case NS_MOUSE_EVENT:
{
switch (anEvent.message)
@ -2213,8 +2212,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
fm->SetFocus(elem, 0);
}
}
switch(anEvent.eventStructType)
{
switch(anEvent.mClass) {
case NS_MOUSE_EVENT:
{
switch (anEvent.message)

View File

@ -693,7 +693,7 @@ APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent,
MOZ_ASSERT(NS_IsMainThread());
switch (aEvent.eventStructType) {
switch (aEvent.mClass) {
case NS_TOUCH_EVENT: {
WidgetTouchEvent& touchEvent = *aEvent.AsTouchEvent();
MultiTouchInput touchInput(touchEvent);

View File

@ -74,14 +74,14 @@ static EventRadiusPrefs sMouseEventRadiusPrefs;
static EventRadiusPrefs sTouchEventRadiusPrefs;
static const EventRadiusPrefs*
GetPrefsFor(nsEventStructType aEventStructType)
GetPrefsFor(EventClassID aEventClassID)
{
EventRadiusPrefs* prefs = nullptr;
const char* prefBranch = nullptr;
if (aEventStructType == NS_TOUCH_EVENT) {
if (aEventClassID == NS_TOUCH_EVENT) {
prefBranch = "touch";
prefs = &sTouchEventRadiusPrefs;
} else if (aEventStructType == NS_MOUSE_EVENT) {
} else if (aEventClassID == NS_MOUSE_EVENT) {
// Mostly for testing purposes
prefBranch = "mouse";
prefs = &sMouseEventRadiusPrefs;
@ -105,7 +105,7 @@ GetPrefsFor(nsEventStructType aEventStructType)
Preferences::AddUintVarCache(&prefs->mSideRadii[i], radiusPref.get(), 0);
}
if (aEventStructType == NS_MOUSE_EVENT) {
if (aEventClassID == NS_MOUSE_EVENT) {
Preferences::AddBoolVarCache(&prefs->mTouchOnly,
"ui.mouse.radius.inputSource.touchOnly", true);
} else {
@ -363,14 +363,14 @@ FindFrameTargetedByInputEvent(const WidgetGUIEvent* aEvent,
nsIFrame* target =
nsLayoutUtils::GetFrameForPoint(aRootFrame, aPointRelativeToRootFrame, flags);
const EventRadiusPrefs* prefs = GetPrefsFor(aEvent->eventStructType);
const EventRadiusPrefs* prefs = GetPrefsFor(aEvent->mClass);
if (!prefs || !prefs->mEnabled || (target && IsElementClickable(target, nsGkAtoms::body))) {
return target;
}
// Do not modify targeting for actual mouse hardware; only for mouse
// events generated by touch-screen hardware.
if (aEvent->eventStructType == NS_MOUSE_EVENT &&
if (aEvent->mClass == NS_MOUSE_EVENT &&
prefs->mTouchOnly &&
aEvent->AsMouseEvent()->inputSource !=
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {

View File

@ -1869,15 +1869,15 @@ nsPoint
nsLayoutUtils::GetEventCoordinatesRelativeTo(const WidgetEvent* aEvent,
nsIFrame* aFrame)
{
if (!aEvent || (aEvent->eventStructType != NS_MOUSE_EVENT &&
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
aEvent->eventStructType != NS_WHEEL_EVENT &&
aEvent->eventStructType != NS_DRAG_EVENT &&
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT &&
aEvent->eventStructType != NS_POINTER_EVENT &&
aEvent->eventStructType != NS_GESTURENOTIFY_EVENT &&
aEvent->eventStructType != NS_TOUCH_EVENT &&
aEvent->eventStructType != NS_QUERY_CONTENT_EVENT))
if (!aEvent || (aEvent->mClass != NS_MOUSE_EVENT &&
aEvent->mClass != NS_MOUSE_SCROLL_EVENT &&
aEvent->mClass != NS_WHEEL_EVENT &&
aEvent->mClass != NS_DRAG_EVENT &&
aEvent->mClass != NS_SIMPLE_GESTURE_EVENT &&
aEvent->mClass != NS_POINTER_EVENT &&
aEvent->mClass != NS_GESTURENOTIFY_EVENT &&
aEvent->mClass != NS_TOUCH_EVENT &&
aEvent->mClass != NS_QUERY_CONTENT_EVENT))
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
return GetEventCoordinatesRelativeTo(aEvent,

View File

@ -465,7 +465,7 @@ public:
virtual void HandleEvent(EventChainPostVisitor& aVisitor) MOZ_OVERRIDE
{
if (aVisitor.mPresContext && aVisitor.mEvent->eventStructType != NS_EVENT) {
if (aVisitor.mPresContext && aVisitor.mEvent->mClass != NS_EVENT) {
if (aVisitor.mEvent->message == NS_MOUSE_BUTTON_DOWN ||
aVisitor.mEvent->message == NS_MOUSE_BUTTON_UP) {
// Mouse-up and mouse-down events call nsFrame::HandlePress/Release
@ -6704,7 +6704,7 @@ DispatchPointerFromMouseOrTouch(PresShell* aShell,
nsEventStatus* aStatus)
{
uint32_t pointerMessage = 0;
if (aEvent->eventStructType == NS_MOUSE_EVENT) {
if (aEvent->mClass == NS_MOUSE_EVENT) {
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
// if it is not mouse then it is likely will come as touch event
if (!mouseEvent->convertToPointer) {
@ -6736,7 +6736,7 @@ DispatchPointerFromMouseOrTouch(PresShell* aShell,
0.0f;
event.convertToPointer = mouseEvent->convertToPointer = false;
aShell->HandleEvent(aFrame, &event, aDontRetargetEvents, aStatus);
} else if (aEvent->eventStructType == NS_TOUCH_EVENT) {
} else if (aEvent->mClass == NS_TOUCH_EVENT) {
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
// loop over all touches and dispatch pointer events on each touch
// copy the event
@ -6898,8 +6898,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
nsIContent* capturingContent =
(aEvent->HasMouseEventMessage() ||
aEvent->eventStructType == NS_WHEEL_EVENT ? GetCapturingContent() :
nullptr);
aEvent->mClass == NS_WHEEL_EVENT ? GetCapturingContent() : nullptr);
nsCOMPtr<nsIDocument> retargetEventDoc;
if (!aDontRetargetEvents) {
@ -6928,7 +6927,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
// document that is being captured.
retargetEventDoc = capturingContent->GetCrossShadowCurrentDoc();
#ifdef ANDROID
} else if (aEvent->eventStructType == NS_TOUCH_EVENT) {
} else if (aEvent->mClass == NS_TOUCH_EVENT) {
retargetEventDoc = GetTouchEventTargetDocument();
#endif
}
@ -6958,7 +6957,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
}
}
if (aEvent->eventStructType == NS_KEY_EVENT &&
if (aEvent->mClass == NS_KEY_EVENT &&
mDocument && mDocument->EventHandlingSuppressed()) {
if (aEvent->message == NS_KEY_DOWN) {
mNoDelayedKeyEvents = true;
@ -6976,7 +6975,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
if (aEvent->IsUsingCoordinates()) {
ReleasePointerCaptureCaller releasePointerCaptureCaller;
if (nsLayoutUtils::AreAsyncAnimationsEnabled() && mDocument) {
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
if (aEvent->mClass == NS_TOUCH_EVENT) {
nsIDocument::UnlockPointer();
}
@ -7057,7 +7056,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
}
// all touch events except for touchstart use a captured target
if (aEvent->eventStructType == NS_TOUCH_EVENT &&
if (aEvent->mClass == NS_TOUCH_EVENT &&
aEvent->message != NS_TOUCH_START) {
captureRetarget = true;
}
@ -7155,7 +7154,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
} else {
eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, frame);
}
if (mouseEvent && mouseEvent->eventStructType == NS_MOUSE_EVENT &&
if (mouseEvent && mouseEvent->mClass == NS_MOUSE_EVENT &&
mouseEvent->ignoreRootScrollFrame) {
flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
}
@ -7184,7 +7183,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
}
}
if (aEvent->eventStructType == NS_POINTER_EVENT &&
if (aEvent->mClass == NS_POINTER_EVENT &&
aEvent->message != NS_POINTER_DOWN) {
if (WidgetPointerEvent* pointerEvent = aEvent->AsPointerEvent()) {
uint32_t pointerId = pointerEvent->pointerId;
@ -7210,7 +7209,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
// Suppress mouse event if it's being targeted at an element inside
// a document which needs events suppressed
if (aEvent->eventStructType == NS_MOUSE_EVENT &&
if (aEvent->mClass == NS_MOUSE_EVENT &&
frame->PresContext()->Document()->EventHandlingSuppressed()) {
if (aEvent->message == NS_MOUSE_BUTTON_DOWN) {
mNoDelayedMouseEvents = true;
@ -7756,14 +7755,14 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
if (NS_SUCCEEDED(rv)) {
bool wasHandlingKeyBoardEvent =
nsContentUtils::IsHandlingKeyBoardEvent();
if (aEvent->eventStructType == NS_KEY_EVENT) {
if (aEvent->mClass == NS_KEY_EVENT) {
nsContentUtils::SetIsHandlingKeyBoardEvent(true);
}
if (aEvent->IsAllowedToDispatchDOMEvent()) {
MOZ_ASSERT(nsContentUtils::IsSafeToRunScript(),
"Somebody changed aEvent to cause a DOM event!");
nsPresShellEventCB eventCB(this);
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
if (aEvent->mClass == NS_TOUCH_EVENT) {
DispatchTouchEvent(aEvent, aStatus, &eventCB, touchIsNew);
} else {
nsCOMPtr<nsINode> eventTarget = mCurrentEventContent.get();
@ -7784,8 +7783,8 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, nsEventStatus* aStatus)
}
}
if (eventTarget) {
if (aEvent->eventStructType == NS_COMPOSITION_EVENT ||
aEvent->eventStructType == NS_TEXT_EVENT) {
if (aEvent->mClass == NS_COMPOSITION_EVENT ||
aEvent->mClass == NS_TEXT_EVENT) {
IMEStateManager::DispatchCompositionEvent(eventTarget,
mPresContext, aEvent, aStatus, eventCBPtr);
} else {

View File

@ -563,8 +563,7 @@ nsNumberControlFrame::GetNumberControlFrameForSpinButton(nsIFrame* aFrame)
int32_t
nsNumberControlFrame::GetSpinButtonForPointerEvent(WidgetGUIEvent* aEvent) const
{
MOZ_ASSERT(aEvent->eventStructType == NS_MOUSE_EVENT,
"Unexpected event type");
MOZ_ASSERT(aEvent->mClass == NS_MOUSE_EVENT, "Unexpected event type");
if (!mSpinBox) {
// we don't have a spinner

View File

@ -466,8 +466,8 @@ nsRangeFrame::GetValueAsFractionOfRange()
Decimal
nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent)
{
MOZ_ASSERT(aEvent->eventStructType == NS_MOUSE_EVENT ||
aEvent->eventStructType == NS_TOUCH_EVENT,
MOZ_ASSERT(aEvent->mClass == NS_MOUSE_EVENT ||
aEvent->mClass == NS_TOUCH_EVENT,
"Unexpected event type - aEvent->refPoint may be meaningless");
MOZ_ASSERT(mContent->IsHTML(nsGkAtoms::input), "bad cast");
@ -485,7 +485,7 @@ nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent)
Decimal range = maximum - minimum;
LayoutDeviceIntPoint absPoint;
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
if (aEvent->mClass == NS_TOUCH_EVENT) {
MOZ_ASSERT(aEvent->AsTouchEvent()->touches.Length() == 1,
"Unexpected number of touches");
absPoint = LayoutDeviceIntPoint::FromUntyped(

View File

@ -2465,9 +2465,9 @@ nsFrame::HandleEvent(nsPresContext* aPresContext,
return HandleDrag(aPresContext, aEvent, aEventStatus);
}
if ((aEvent->eventStructType == NS_MOUSE_EVENT &&
if ((aEvent->mClass == NS_MOUSE_EVENT &&
aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) ||
aEvent->eventStructType == NS_TOUCH_EVENT) {
aEvent->mClass == NS_TOUCH_EVENT) {
if (aEvent->message == NS_MOUSE_BUTTON_DOWN || aEvent->message == NS_TOUCH_START) {
HandlePress(aPresContext, aEvent, aEventStatus);
} else if (aEvent->message == NS_MOUSE_BUTTON_UP || aEvent->message == NS_TOUCH_END) {
@ -2679,7 +2679,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
}
NS_ENSURE_ARG_POINTER(aEvent);
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
if (aEvent->mClass == NS_TOUCH_EVENT) {
return NS_OK;
}
@ -3073,7 +3073,8 @@ NS_IMETHODIMP nsFrame::HandleDrag(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus)
{
MOZ_ASSERT(aEvent->eventStructType == NS_MOUSE_EVENT, "HandleDrag can only handle mouse event");
MOZ_ASSERT(aEvent->mClass == NS_MOUSE_EVENT,
"HandleDrag can only handle mouse event");
bool selectable;
IsSelectable(&selectable, nullptr);
@ -3208,7 +3209,7 @@ NS_IMETHODIMP nsFrame::HandleRelease(nsPresContext* aPresContext,
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus)
{
if (aEvent->eventStructType != NS_MOUSE_EVENT) {
if (aEvent->mClass != NS_MOUSE_EVENT) {
return NS_OK;
}

View File

@ -64,8 +64,8 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
switch (aEvent->message) {
case NS_TOUCH_START:
case NS_MOUSE_BUTTON_DOWN: {
if (aEvent->eventStructType == NS_TOUCH_EVENT ||
(aEvent->eventStructType == NS_MOUSE_EVENT &&
if (aEvent->mClass == NS_TOUCH_EVENT ||
(aEvent->mClass == NS_MOUSE_EVENT &&
aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton)) {
nsCOMPtr<nsIBaseWindow> window;
nsIPresShell* presShell = aPresContext->GetPresShell();
@ -129,8 +129,8 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
case NS_TOUCH_END:
case NS_MOUSE_BUTTON_UP: {
if (aEvent->eventStructType == NS_TOUCH_EVENT ||
(aEvent->eventStructType == NS_MOUSE_EVENT &&
if (aEvent->mClass == NS_TOUCH_EVENT ||
(aEvent->mClass == NS_MOUSE_EVENT &&
aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton)) {
// we're done tracking.
mTrackingMouseMove = false;

View File

@ -470,7 +470,7 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
isMouseOutsideThumb = true;
}
}
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
if (aEvent->mClass == NS_TOUCH_EVENT) {
*aEventStatus = nsEventStatus_eConsumeNoDefault;
}
if (isMouseOutsideThumb)
@ -523,7 +523,7 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
NS_ENSURE_TRUE(weakFrame.IsAlive(), NS_OK);
DragThumb(true);
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
if (aEvent->mClass == NS_TOUCH_EVENT) {
*aEventStatus = nsEventStatus_eConsumeNoDefault;
}

View File

@ -546,9 +546,9 @@ nsXULPopupManager::InitTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup,
return;
nsIFrame* rootDocumentRootFrame = rootDocPresContext->
PresShell()->FrameManager()->GetRootFrame();
if ((event->eventStructType == NS_MOUSE_EVENT ||
event->eventStructType == NS_MOUSE_SCROLL_EVENT ||
event->eventStructType == NS_WHEEL_EVENT) &&
if ((event->mClass == NS_MOUSE_EVENT ||
event->mClass == NS_MOUSE_SCROLL_EVENT ||
event->mClass == NS_WHEEL_EVENT) &&
!event->AsGUIEvent()->widget) {
// no widget, so just use the client point if available
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);

View File

@ -2546,7 +2546,7 @@ nsTreeBodyFrame::GetCursor(const nsPoint& aPoint,
static uint32_t GetDropEffect(WidgetGUIEvent* aEvent)
{
NS_ASSERTION(aEvent->eventStructType == NS_DRAG_EVENT, "wrong event type");
NS_ASSERTION(aEvent->mClass == NS_DRAG_EVENT, "wrong event type");
WidgetDragEvent* dragEvent = aEvent->AsDragEvent();
nsContentUtils::SetDataTransferInEvent(dragEvent);
@ -2724,7 +2724,7 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
rv = mView->GetParentIndex(parentIndex, &parentIndex);
}
NS_ASSERTION(aEvent->eventStructType == NS_DRAG_EVENT, "wrong event type");
NS_ASSERTION(aEvent->mClass == NS_DRAG_EVENT, "wrong event type");
WidgetDragEvent* dragEvent = aEvent->AsDragEvent();
nsContentUtils::SetDataTransferInEvent(dragEvent);

View File

@ -17,12 +17,13 @@
#include "nsString.h"
#include "Units.h"
namespace mozilla {
/******************************************************************************
* Event Struct Types
*
* TODO: Move it into mozilla namespace.
* Event Class ID
******************************************************************************/
enum nsEventStructType
typedef uint8_t EventClassIDType;
enum EventClassID MOZ_ENUM_TYPE(EventClassIDType)
{
// BasicEvents.h
NS_EVENT, // WidgetEvent
@ -70,6 +71,8 @@ enum nsEventStructType
NS_MUTATION_EVENT // InternalMutationEvent
};
} // namespace mozilla
/******************************************************************************
* Messages
*
@ -621,10 +624,14 @@ struct EventFlags : public BaseEventFlags
class WidgetEvent
{
protected:
WidgetEvent(bool aIsTrusted, uint32_t aMessage,
nsEventStructType aStructType) :
eventStructType(aStructType), message(aMessage), refPoint(0, 0),
lastRefPoint(0, 0), time(0), timeStamp(TimeStamp::Now()), userType(0)
WidgetEvent(bool aIsTrusted, uint32_t aMessage, EventClassID aEventClassID)
: mClass(aEventClassID)
, message(aMessage)
, refPoint(0, 0)
, lastRefPoint(0, 0)
, time(0)
, timeStamp(TimeStamp::Now())
, userType(nullptr)
{
MOZ_COUNT_CTOR(WidgetEvent);
mFlags.Clear();
@ -639,9 +646,14 @@ protected:
}
public:
WidgetEvent(bool aIsTrusted, uint32_t aMessage) :
eventStructType(NS_EVENT), message(aMessage), refPoint(0, 0),
lastRefPoint(0, 0), time(0), timeStamp(TimeStamp::Now()), userType(0)
WidgetEvent(bool aIsTrusted, uint32_t aMessage)
: mClass(NS_EVENT)
, message(aMessage)
, refPoint(0, 0)
, lastRefPoint(0, 0)
, time(0)
, timeStamp(TimeStamp::Now())
, userType(nullptr)
{
MOZ_COUNT_CTOR(WidgetEvent);
mFlags.Clear();
@ -663,7 +675,7 @@ public:
virtual WidgetEvent* Duplicate() const
{
MOZ_ASSERT(eventStructType == NS_EVENT,
MOZ_ASSERT(mClass == NS_EVENT,
"Duplicate() must be overridden by sub class");
WidgetEvent* result = new WidgetEvent(false, message);
result->AssignEventData(*this, true);
@ -671,8 +683,7 @@ public:
return result;
}
// See event struct types
nsEventStructType eventStructType;
EventClassID mClass;
// See GUI MESSAGES,
uint32_t message;
// Relative to the widget of the event, or if there is no widget then it is
@ -701,10 +712,7 @@ public:
void AssignEventData(const WidgetEvent& aEvent, bool aCopyTargets)
{
// eventStructType should be initialized with the constructor.
// However, NS_SVGZOOM_EVENT and NS_SMIL_TIME_EVENT are set after that.
// Therefore, we need to copy eventStructType here.
eventStructType = aEvent.eventStructType;
// mClass should be initialized with the constructor.
// message should be initialized with the constructor.
refPoint = aEvent.refPoint;
// lastRefPoint doesn't need to be copied.
@ -837,9 +845,9 @@ class WidgetGUIEvent : public WidgetEvent
{
protected:
WidgetGUIEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
nsEventStructType aStructType) :
WidgetEvent(aIsTrusted, aMessage, aStructType),
widget(aWidget)
EventClassID aEventClassID)
: WidgetEvent(aIsTrusted, aMessage, aEventClassID)
, widget(aWidget)
{
}
@ -858,7 +866,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_GUI_EVENT,
MOZ_ASSERT(mClass == NS_GUI_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetGUIEvent* result = new WidgetGUIEvent(false, message, nullptr);
@ -997,9 +1005,9 @@ class WidgetInputEvent : public WidgetGUIEvent
{
protected:
WidgetInputEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
nsEventStructType aStructType) :
WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aStructType),
modifiers(0)
EventClassID aEventClassID)
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
, modifiers(0)
{
}
@ -1018,7 +1026,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_INPUT_EVENT,
MOZ_ASSERT(mClass == NS_INPUT_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetInputEvent* result = new WidgetInputEvent(false, message, nullptr);
@ -1146,15 +1154,15 @@ protected:
}
InternalUIEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
nsEventStructType aStructType)
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aStructType)
EventClassID aEventClassID)
: WidgetGUIEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
, detail(0)
{
}
InternalUIEvent(bool aIsTrusted, uint32_t aMessage,
nsEventStructType aStructType)
: WidgetGUIEvent(aIsTrusted, aMessage, nullptr, aStructType)
EventClassID aEventClassID)
: WidgetGUIEvent(aIsTrusted, aMessage, nullptr, aEventClassID)
, detail(0)
{
}
@ -1170,7 +1178,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_UI_EVENT,
MOZ_ASSERT(mClass == NS_UI_EVENT,
"Duplicate() must be overridden by sub class");
InternalUIEvent* result = new InternalUIEvent(false, message);
result->AssignUIEventData(*this, true);

View File

@ -47,7 +47,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_SCROLLPORT_EVENT,
MOZ_ASSERT(mClass == NS_SCROLLPORT_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
InternalScrollPortEvent* result =
@ -88,7 +88,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_SCROLLAREA_EVENT,
MOZ_ASSERT(mClass == NS_SCROLLAREA_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
InternalScrollAreaEvent* result =
@ -129,7 +129,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_FORM_EVENT,
MOZ_ASSERT(mClass == NS_FORM_EVENT,
"Duplicate() must be overridden by sub class");
InternalFormEvent* result = new InternalFormEvent(false, message);
result->AssignFormEventData(*this, true);
@ -166,7 +166,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_CLIPBOARD_EVENT,
MOZ_ASSERT(mClass == NS_CLIPBOARD_EVENT,
"Duplicate() must be overridden by sub class");
InternalClipboardEvent* result = new InternalClipboardEvent(false, message);
result->AssignClipboardEventData(*this, true);
@ -202,7 +202,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_FOCUS_EVENT,
MOZ_ASSERT(mClass == NS_FOCUS_EVENT,
"Duplicate() must be overridden by sub class");
InternalFocusEvent* result = new InternalFocusEvent(false, message);
result->AssignFocusEventData(*this, true);
@ -247,7 +247,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_TRANSITION_EVENT,
MOZ_ASSERT(mClass == NS_TRANSITION_EVENT,
"Duplicate() must be overridden by sub class");
InternalTransitionEvent* result =
new InternalTransitionEvent(false, message);
@ -292,7 +292,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_ANIMATION_EVENT,
MOZ_ASSERT(mClass == NS_ANIMATION_EVENT,
"Duplicate() must be overridden by sub class");
InternalAnimationEvent* result = new InternalAnimationEvent(false, message);
result->AssignAnimationEventData(*this, true);
@ -332,7 +332,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_SVGZOOM_EVENT,
MOZ_ASSERT(mClass == NS_SVGZOOM_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
InternalSVGZoomEvent* result = new InternalSVGZoomEvent(false, message);
@ -369,7 +369,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_SMIL_TIME_EVENT,
MOZ_ASSERT(mClass == NS_SMIL_TIME_EVENT,
"Duplicate() must be overridden by sub class");
InternalSMILTimeEvent* result = new InternalSMILTimeEvent(false, message);
result->AssignSMILTimeEventData(*this, true);

View File

@ -110,7 +110,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_COMMAND_EVENT,
MOZ_ASSERT(mClass == NS_COMMAND_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetCommandEvent* result =
@ -153,7 +153,7 @@ public:
{
// NOTE: PluginEvent has to be dispatched to nsIFrame::HandleEvent().
// So, this event needs to support Duplicate().
MOZ_ASSERT(eventStructType == NS_PLUGIN_EVENT,
MOZ_ASSERT(mClass == NS_PLUGIN_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetPluginEvent* result = new WidgetPluginEvent(false, message, nullptr);

View File

@ -78,10 +78,12 @@ protected:
}
WidgetMouseEventBase(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
nsEventStructType aStructType) :
WidgetInputEvent(aIsTrusted, aMessage, aWidget, aStructType),
button(0), buttons(0), pressure(0),
inputSource(nsIDOMMouseEvent::MOZ_SOURCE_MOUSE)
EventClassID aEventClassID)
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, aEventClassID)
, button(0)
, buttons(0)
, pressure(0)
, inputSource(nsIDOMMouseEvent::MOZ_SOURCE_MOUSE)
{
}
@ -188,10 +190,14 @@ protected:
}
WidgetMouseEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget,
nsEventStructType aStructType, reasonType aReason) :
WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aStructType),
acceptActivation(false), ignoreRootScrollFrame(false),
reason(aReason), context(eNormal), exit(eChild), clickCount(0)
EventClassID aEventClassID, reasonType aReason)
: WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, aEventClassID)
, acceptActivation(false)
, ignoreRootScrollFrame(false)
, reason(aReason)
, context(eNormal)
, exit(eChild)
, clickCount(0)
{
switch (aMessage) {
case NS_MOUSEENTER:
@ -239,7 +245,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_MOUSE_EVENT,
MOZ_ASSERT(mClass == NS_MOUSE_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetMouseEvent* result =
@ -311,7 +317,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_DRAG_EVENT,
MOZ_ASSERT(mClass == NS_DRAG_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetDragEvent* result = new WidgetDragEvent(false, message, nullptr);
@ -370,7 +376,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_MOUSE_SCROLL_EVENT,
MOZ_ASSERT(mClass == NS_MOUSE_SCROLL_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetMouseScrollEvent* result =
@ -432,7 +438,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_WHEEL_EVENT,
MOZ_ASSERT(mClass == NS_WHEEL_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetWheelEvent* result = new WidgetWheelEvent(false, message, nullptr);
@ -575,7 +581,7 @@ public:
, height(0)
, isPrimary(true)
{
eventStructType = NS_POINTER_EVENT;
mClass = NS_POINTER_EVENT;
UpdateFlags();
}
@ -599,7 +605,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_POINTER_EVENT,
MOZ_ASSERT(mClass == NS_POINTER_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetPointerEvent* result =

View File

@ -99,7 +99,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_KEY_EVENT,
MOZ_ASSERT(mClass == NS_KEY_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetKeyboardEvent* result =
@ -232,7 +232,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_TEXT_EVENT,
MOZ_ASSERT(mClass == NS_TEXT_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetTextEvent* result = new WidgetTextEvent(false, message, nullptr);
@ -313,7 +313,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_COMPOSITION_EVENT,
MOZ_ASSERT(mClass == NS_COMPOSITION_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetCompositionEvent* result =
@ -566,7 +566,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_EDITOR_INPUT_EVENT,
MOZ_ASSERT(mClass == NS_EDITOR_INPUT_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
InternalEditorInputEvent* result =

View File

@ -50,7 +50,7 @@ public:
// in PreHandleEvent() and not to dispatch as a DOM event into the DOM
// tree like ContentQueryEvent. Then, this event doesn't need to
// support Duplicate().
MOZ_ASSERT(eventStructType == NS_GESTURENOTIFY_EVENT,
MOZ_ASSERT(mClass == NS_GESTURENOTIFY_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetGestureNotifyEvent* result =
@ -116,7 +116,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_SIMPLE_GESTURE_EVENT,
MOZ_ASSERT(mClass == NS_SIMPLE_GESTURE_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetSimpleGestureEvent* result =
@ -190,7 +190,7 @@ public:
virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
{
MOZ_ASSERT(eventStructType == NS_TOUCH_EVENT,
MOZ_ASSERT(mClass == NS_TOUCH_EVENT,
"Duplicate() must be overridden by sub class");
// Not copying widget, it is a weak reference.
WidgetTouchEvent* result = new WidgetTouchEvent(false, message, nullptr);

View File

@ -646,7 +646,7 @@ KeymapWrapper::InitInputEvent(WidgetInputEvent& aInputEvent,
GetBoolName(aInputEvent.modifiers & MODIFIER_NUMLOCK),
GetBoolName(aInputEvent.modifiers & MODIFIER_SCROLLLOCK)));
switch(aInputEvent.eventStructType) {
switch(aInputEvent.mClass) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:

View File

@ -6211,7 +6211,7 @@ NS_IMETHODIMP
nsWindow::BeginMoveDrag(WidgetMouseEvent* aEvent)
{
NS_ABORT_IF_FALSE(aEvent, "must have event");
NS_ABORT_IF_FALSE(aEvent->eventStructType == NS_MOUSE_EVENT,
NS_ABORT_IF_FALSE(aEvent->mClass == NS_MOUSE_EVENT,
"event must have correct struct type");
GdkWindow *gdk_window;
@ -6234,7 +6234,7 @@ nsWindow::BeginResizeDrag(WidgetGUIEvent* aEvent,
{
NS_ENSURE_ARG_POINTER(aEvent);
if (aEvent->eventStructType != NS_MOUSE_EVENT) {
if (aEvent->mClass != NS_MOUSE_EVENT) {
// you can only begin a resize drag with a mouse event
return NS_ERROR_INVALID_ARG;
}

View File

@ -45,7 +45,8 @@ struct ParamTraits<mozilla::WidgetEvent>
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, (uint8_t) aParam.eventStructType);
WriteParam(aMsg,
static_cast<mozilla::EventClassIDType>(aParam.mClass));
WriteParam(aMsg, aParam.message);
WriteParam(aMsg, aParam.refPoint);
WriteParam(aMsg, aParam.time);
@ -55,14 +56,14 @@ struct ParamTraits<mozilla::WidgetEvent>
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{
uint8_t eventStructType = 0;
bool ret = ReadParam(aMsg, aIter, &eventStructType) &&
mozilla::EventClassIDType eventClassID = 0;
bool ret = ReadParam(aMsg, aIter, &eventClassID) &&
ReadParam(aMsg, aIter, &aResult->message) &&
ReadParam(aMsg, aIter, &aResult->refPoint) &&
ReadParam(aMsg, aIter, &aResult->time) &&
ReadParam(aMsg, aIter, &aResult->timeStamp) &&
ReadParam(aMsg, aIter, &aResult->mFlags);
aResult->eventStructType = static_cast<nsEventStructType>(eventStructType);
aResult->mClass = static_cast<mozilla::EventClassID>(eventClassID);
return ret;
}
};

View File

@ -46,25 +46,25 @@ WidgetEvent::As##aName() const \
bool
WidgetEvent::IsQueryContentEvent() const
{
return eventStructType == NS_QUERY_CONTENT_EVENT;
return mClass == NS_QUERY_CONTENT_EVENT;
}
bool
WidgetEvent::IsSelectionEvent() const
{
return eventStructType == NS_SELECTION_EVENT;
return mClass == NS_SELECTION_EVENT;
}
bool
WidgetEvent::IsContentCommandEvent() const
{
return eventStructType == NS_CONTENT_COMMAND_EVENT;
return mClass == NS_CONTENT_COMMAND_EVENT;
}
bool
WidgetEvent::IsNativeEventDelivererForPlugin() const
{
return eventStructType == NS_PLUGIN_EVENT;
return mClass == NS_PLUGIN_EVENT;
}
@ -215,7 +215,7 @@ WidgetEvent::IsTargetedAtFocusedContent() const
bool
WidgetEvent::IsAllowedToDispatchDOMEvent() const
{
switch (eventStructType) {
switch (mClass) {
case NS_MOUSE_EVENT:
case NS_POINTER_EVENT:
// We want synthesized mouse moves to cause mouseover and mouseout

View File

@ -280,7 +280,7 @@ ModifierKeyState::InitInputEvent(WidgetInputEvent& aInputEvent) const
{
aInputEvent.modifiers = mModifiers;
switch(aInputEvent.eventStructType) {
switch(aInputEvent.mClass) {
case NS_MOUSE_EVENT:
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
@ -296,10 +296,10 @@ ModifierKeyState::InitInputEvent(WidgetInputEvent& aInputEvent) const
void
ModifierKeyState::InitMouseEvent(WidgetInputEvent& aMouseEvent) const
{
NS_ASSERTION(aMouseEvent.eventStructType == NS_MOUSE_EVENT ||
aMouseEvent.eventStructType == NS_WHEEL_EVENT ||
aMouseEvent.eventStructType == NS_DRAG_EVENT ||
aMouseEvent.eventStructType == NS_SIMPLE_GESTURE_EVENT,
NS_ASSERTION(aMouseEvent.mClass == NS_MOUSE_EVENT ||
aMouseEvent.mClass == NS_WHEEL_EVENT ||
aMouseEvent.mClass == NS_DRAG_EVENT ||
aMouseEvent.mClass == NS_SIMPLE_GESTURE_EVENT,
"called with non-mouse event");
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {

View File

@ -1538,7 +1538,7 @@ nsWindow::BeginResizeDrag(WidgetGUIEvent* aEvent,
{
NS_ENSURE_ARG_POINTER(aEvent);
if (aEvent->eventStructType != NS_MOUSE_EVENT) {
if (aEvent->mClass != NS_MOUSE_EVENT) {
// you can only begin a resize drag with a mouse event
return NS_ERROR_INVALID_ARG;
}

View File

@ -651,7 +651,7 @@ bool
MetroWidget::DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent)
{
WidgetGUIEvent* newEvent = nullptr;
switch(aEvent->eventStructType) {
switch(aEvent->mClass) {
case NS_WHEEL_EVENT:
{
WidgetWheelEvent* oldEvent = aEvent->AsWheelEvent();

View File

@ -290,7 +290,7 @@ PuppetWidget::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
mIMEComposing = true;
}
uint32_t seqno = kLatestSeqno;
switch (event->eventStructType) {
switch (event->mClass) {
case NS_COMPOSITION_EVENT:
seqno = event->AsCompositionEvent()->mSeqno;
break;