diff --git a/content/base/src/Element.cpp b/content/base/src/Element.cpp index fd1331b6169..81e93c33156 100644 --- a/content/base/src/Element.cpp +++ b/content/base/src/Element.cpp @@ -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; diff --git a/content/base/src/FragmentOrElement.cpp b/content/base/src/FragmentOrElement.cpp index 64f2150f143..0dac4e4a2e8 100644 --- a/content/base/src/FragmentOrElement.cpp +++ b/content/base/src/FragmentOrElement.cpp @@ -814,7 +814,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor) // all the events are allowed even in the native anonymous content.. nsCOMPtr 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 diff --git a/content/base/src/nsContentUtils.cpp b/content/base/src/nsContentUtils.cpp index cd2baae7e22..5171c97fb5d 100644 --- a/content/base/src/nsContentUtils.cpp +++ b/content/base/src/nsContentUtils.cpp @@ -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 diff --git a/content/html/content/src/HTMLCanvasElement.cpp b/content/html/content/src/HTMLCanvasElement.cpp index 012238a7a70..7eb1c2e880a 100644 --- a/content/html/content/src/HTMLCanvasElement.cpp +++ b/content/html/content/src/HTMLCanvasElement.cpp @@ -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(); diff --git a/content/html/content/src/HTMLInputElement.cpp b/content/html/content/src/HTMLInputElement.cpp index 25918ec8f1e..43c5523215d 100644 --- a/content/html/content/src/HTMLInputElement.cpp +++ b/content/html/content/src/HTMLInputElement.cpp @@ -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; } diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index cb6ec7060bb..7be32aea3e8 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -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(this) && tag != nsGkAtoms::command) { // Check that we really have an xul command event. That will be handled diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 29ae4786194..3110908786b 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -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; } diff --git a/dom/events/CompositionEvent.cpp b/dom/events/CompositionEvent.cpp index 3d105ffa501..c0728215da4 100644 --- a/dom/events/CompositionEvent.cpp +++ b/dom/events/CompositionEvent.cpp @@ -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) { diff --git a/dom/events/DragEvent.cpp b/dom/events/DragEvent.cpp index a099fdc9d8f..7bcee4653b0 100644 --- a/dom/events/DragEvent.cpp +++ b/dom/events/DragEvent.cpp @@ -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; } diff --git a/dom/events/Event.cpp b/dom/events/Event.cpp index 646dd88ae60..f61fbbe5884 100644 --- a/dom/events/Event.cpp +++ b/dom/events/Event.cpp @@ -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; diff --git a/dom/events/EventDispatcher.cpp b/dom/events/EventDispatcher.cpp index 28acd8290fa..6e82cbe8dac 100644 --- a/dom/events/EventDispatcher.cpp +++ b/dom/events/EventDispatcher.cpp @@ -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()); diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp index fb0badd6165..c62f11343e9 100644 --- a/dom/events/EventStateManager.cpp +++ b/dom/events/EventStateManager.cpp @@ -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 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, 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 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 lastOverElement = wrapper->mLastOverElement; - bool isPointer = aMouseEvent->eventStructType == NS_POINTER_EVENT; + bool isPointer = aMouseEvent->mClass == NS_POINTER_EVENT; Maybe enterDispatcher; if (dispatch) { diff --git a/dom/events/IMEStateManager.cpp b/dom/events/IMEStateManager.cpp index d17144619e0..a78c55ac788 100644 --- a/dom/events/IMEStateManager.cpp +++ b/dom/events/IMEStateManager.cpp @@ -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; } diff --git a/dom/events/InputEvent.cpp b/dom/events/InputEvent.cpp index 13cd371f5d3..131b05a52e6 100644 --- a/dom/events/InputEvent.cpp +++ b/dom/events/InputEvent.cpp @@ -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) { diff --git a/dom/events/InternalMutationEvent.h b/dom/events/InternalMutationEvent.h index b4f1ee2fefc..58f0b2815eb 100644 --- a/dom/events/InternalMutationEvent.h +++ b/dom/events/InternalMutationEvent.h @@ -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); diff --git a/dom/events/KeyboardEvent.cpp b/dom/events/KeyboardEvent.cpp index 851e3f66f84..351413df3e4 100644 --- a/dom/events/KeyboardEvent.cpp +++ b/dom/events/KeyboardEvent.cpp @@ -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; diff --git a/dom/events/MouseEvent.cpp b/dom/events/MouseEvent.cpp index d09fe1acfee..84c9ed4db6a 100644 --- a/dom/events/MouseEvent.cpp +++ b/dom/events/MouseEvent.cpp @@ -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 MouseEvent::GetRelatedTarget() { nsCOMPtr relatedTarget; - switch(mEvent->eventStructType) - { + switch(mEvent->mClass) { case NS_MOUSE_EVENT: case NS_MOUSE_SCROLL_EVENT: case NS_WHEEL_EVENT: diff --git a/dom/events/PointerEvent.cpp b/dom/events/PointerEvent.cpp index fad5fe9ff00..156ac64345f 100644 --- a/dom/events/PointerEvent.cpp +++ b/dom/events/PointerEvent.cpp @@ -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(); diff --git a/dom/events/SimpleGestureEvent.cpp b/dom/events/SimpleGestureEvent.cpp index b85d33ea7e9..f3d6747da44 100644 --- a/dom/events/SimpleGestureEvent.cpp +++ b/dom/events/SimpleGestureEvent.cpp @@ -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; diff --git a/dom/events/TextComposition.cpp b/dom/events/TextComposition.cpp index a78be0585d5..80bfea4b2c3 100644 --- a/dom/events/TextComposition.cpp +++ b/dom/events/TextComposition.cpp @@ -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 = diff --git a/dom/events/UIEvent.cpp b/dom/events/UIEvent.cpp index 944463d5c12..d9748151bc9 100644 --- a/dom/events/UIEvent.cpp +++ b/dom/events/UIEvent.cpp @@ -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; diff --git a/dom/events/UIEvent.h b/dom/events/UIEvent.h index 2d3d17aa347..fc50af6c427 100644 --- a/dom/events/UIEvent.h +++ b/dom/events/UIEvent.h @@ -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; } diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 7950615de04..f1e6fe05fd1 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -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; } diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index cba3e3c0552..79e2ef65fd7 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -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) diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index dae66f42b56..b26d90a08b1 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -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); diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp index 1d4407d416a..ddc2145d279 100644 --- a/layout/base/PositionedEventTargeting.cpp +++ b/layout/base/PositionedEventTargeting.cpp @@ -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) { diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 20d6d71c9e4..801f9da3ceb 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -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, diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index dad0632cbc6..ece8a625978 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -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 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 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 { diff --git a/layout/forms/nsNumberControlFrame.cpp b/layout/forms/nsNumberControlFrame.cpp index 949869a587c..24bac5e3abb 100644 --- a/layout/forms/nsNumberControlFrame.cpp +++ b/layout/forms/nsNumberControlFrame.cpp @@ -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 diff --git a/layout/forms/nsRangeFrame.cpp b/layout/forms/nsRangeFrame.cpp index 36cb66a4c79..74b36ad74eb 100644 --- a/layout/forms/nsRangeFrame.cpp +++ b/layout/forms/nsRangeFrame.cpp @@ -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( diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index a7669b1dcc2..b38ec944287 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -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; } diff --git a/layout/xul/nsResizerFrame.cpp b/layout/xul/nsResizerFrame.cpp index 8e52ac23423..a14a5ca811e 100644 --- a/layout/xul/nsResizerFrame.cpp +++ b/layout/xul/nsResizerFrame.cpp @@ -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 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; diff --git a/layout/xul/nsSliderFrame.cpp b/layout/xul/nsSliderFrame.cpp index ef98e9f9a3d..20d3f727259 100644 --- a/layout/xul/nsSliderFrame.cpp +++ b/layout/xul/nsSliderFrame.cpp @@ -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; } diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp index c2edb9ca872..fe69837737b 100644 --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -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 mouseEvent = do_QueryInterface(aEvent); diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index 582dc88b2fa..bb73df13789 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -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); diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h index 0b869d4f283..e7e3496b98f 100644 --- a/widget/BasicEvents.h +++ b/widget/BasicEvents.h @@ -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); diff --git a/widget/ContentEvents.h b/widget/ContentEvents.h index 61875e0d774..58a6555ee65 100644 --- a/widget/ContentEvents.h +++ b/widget/ContentEvents.h @@ -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); diff --git a/widget/MiscEvents.h b/widget/MiscEvents.h index a54985c9648..ebc56d58319 100644 --- a/widget/MiscEvents.h +++ b/widget/MiscEvents.h @@ -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); diff --git a/widget/MouseEvents.h b/widget/MouseEvents.h index 8a306749229..bd111e3117d 100644 --- a/widget/MouseEvents.h +++ b/widget/MouseEvents.h @@ -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 = diff --git a/widget/TextEvents.h b/widget/TextEvents.h index 5e4d7815153..bc69695f01f 100644 --- a/widget/TextEvents.h +++ b/widget/TextEvents.h @@ -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 = diff --git a/widget/TouchEvents.h b/widget/TouchEvents.h index bbf0f56b644..e0b71cf35f4 100644 --- a/widget/TouchEvents.h +++ b/widget/TouchEvents.h @@ -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); diff --git a/widget/gtk/nsGtkKeyUtils.cpp b/widget/gtk/nsGtkKeyUtils.cpp index ac3b23b8a73..4414358b882 100644 --- a/widget/gtk/nsGtkKeyUtils.cpp +++ b/widget/gtk/nsGtkKeyUtils.cpp @@ -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: diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 5ec28e6d565..7ec743acec0 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -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; } diff --git a/widget/nsGUIEventIPC.h b/widget/nsGUIEventIPC.h index 9b226c80799..e558e8736fa 100644 --- a/widget/nsGUIEventIPC.h +++ b/widget/nsGUIEventIPC.h @@ -45,7 +45,8 @@ struct ParamTraits static void Write(Message* aMsg, const paramType& aParam) { - WriteParam(aMsg, (uint8_t) aParam.eventStructType); + WriteParam(aMsg, + static_cast(aParam.mClass)); WriteParam(aMsg, aParam.message); WriteParam(aMsg, aParam.refPoint); WriteParam(aMsg, aParam.time); @@ -55,14 +56,14 @@ struct ParamTraits 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(eventStructType); + aResult->mClass = static_cast(eventClassID); return ret; } }; diff --git a/widget/shared/WidgetEventImpl.cpp b/widget/shared/WidgetEventImpl.cpp index f22224dbc69..06278461823 100644 --- a/widget/shared/WidgetEventImpl.cpp +++ b/widget/shared/WidgetEventImpl.cpp @@ -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 diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 9a86006d43a..db2f6812e6c 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -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) { diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index ccb678bd65a..6eaccb305b6 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -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; } diff --git a/widget/windows/winrt/MetroWidget.cpp b/widget/windows/winrt/MetroWidget.cpp index 30c387d73c9..243f0c6c681 100644 --- a/widget/windows/winrt/MetroWidget.cpp +++ b/widget/windows/winrt/MetroWidget.cpp @@ -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(); diff --git a/widget/xpwidgets/PuppetWidget.cpp b/widget/xpwidgets/PuppetWidget.cpp index 3928abe49e1..baf23bce12f 100644 --- a/widget/xpwidgets/PuppetWidget.cpp +++ b/widget/xpwidgets/PuppetWidget.cpp @@ -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;