Bug 1046101 part.1 Rename nsEventStructType to mozilla::EventClassID r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 04 Aug 2014 14:28:46 +0900
changeset 197532 b6e08b99faf8cd00121d4112445a7aded885c7cf
parent 197531 d1b960226e0bd93e1380d45977ccdb25d13ce5a3
child 197533 d0783cbdb8d8240ab95871f0d332fba5d0a46f1e
push id47161
push usermasayuki@d-toybox.com
push dateMon, 04 Aug 2014 05:29:14 +0000
treeherdermozilla-inbound@c0cfff4ee625 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1046101
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1046101 part.1 Rename nsEventStructType to mozilla::EventClassID r=smaug
content/base/src/Element.cpp
content/base/src/FragmentOrElement.cpp
content/base/src/nsContentUtils.cpp
content/html/content/src/HTMLCanvasElement.cpp
content/html/content/src/HTMLInputElement.cpp
content/xul/content/src/nsXULElement.cpp
dom/base/nsGlobalWindow.cpp
dom/events/CompositionEvent.cpp
dom/events/DragEvent.cpp
dom/events/Event.cpp
dom/events/EventDispatcher.cpp
dom/events/EventStateManager.cpp
dom/events/IMEStateManager.cpp
dom/events/InputEvent.cpp
dom/events/InternalMutationEvent.h
dom/events/KeyboardEvent.cpp
dom/events/MouseEvent.cpp
dom/events/PointerEvent.cpp
dom/events/SimpleGestureEvent.cpp
dom/events/TextComposition.cpp
dom/events/UIEvent.cpp
dom/events/UIEvent.h
dom/ipc/TabParent.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
gfx/layers/apz/src/APZCTreeManager.cpp
layout/base/PositionedEventTargeting.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsPresShell.cpp
layout/forms/nsNumberControlFrame.cpp
layout/forms/nsRangeFrame.cpp
layout/generic/nsFrame.cpp
layout/xul/nsResizerFrame.cpp
layout/xul/nsSliderFrame.cpp
layout/xul/nsXULPopupManager.cpp
layout/xul/tree/nsTreeBodyFrame.cpp
widget/BasicEvents.h
widget/ContentEvents.h
widget/MiscEvents.h
widget/MouseEvents.h
widget/TextEvents.h
widget/TouchEvents.h
widget/gtk/nsGtkKeyUtils.cpp
widget/gtk/nsWindow.cpp
widget/nsGUIEventIPC.h
widget/shared/WidgetEventImpl.cpp
widget/windows/KeyboardLayout.cpp
widget/windows/nsWindow.cpp
widget/windows/winrt/MetroWidget.cpp
widget/xpwidgets/PuppetWidget.cpp
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -1723,17 +1723,17 @@ Element::DispatchClickEvent(nsPresContex
   uint32_t clickCount = 1;
   float pressure = 0;
   uint16_t inputSource = 0;
   WidgetMouseEvent* sourceMouseEvent = aSourceEvent->AsMouseEvent();
   if (sourceMouseEvent) {
     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;
   event.clickCount = clickCount;
   event.inputSource = inputSource;
   event.modifiers = aSourceEvent->modifiers;
   if (aExtraEventFlags) {
     // Be careful not to overwrite existing flags!
--- a/content/base/src/FragmentOrElement.cpp
+++ b/content/base/src/FragmentOrElement.cpp
@@ -809,17 +809,17 @@ nsIContent::PreHandleEvent(EventChainPre
   // Event may need to be retargeted if this is the root of a native
   // anonymous content subtree or event is dispatched somewhere inside XBL.
   if (isAnonForEvents) {
 #ifdef DEBUG
     // If a DOM event is explicitly dispatched using node.dispatchEvent(), then
     // 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
     aVisitor.mEventTargetAtParent = parent;
   } else if (parent && aVisitor.mOriginalTargetIsInAnon) {
     nsCOMPtr<nsIContent> content(do_QueryInterface(aVisitor.mEvent->target));
     if (content && content->GetBindingParent() == parent) {
       aVisitor.mEventTargetAtParent = parent;
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -4889,17 +4889,17 @@ nsContentUtils::GetAccelKeyCandidates(ns
   aDOMKeyEvent->GetType(eventType);
   // Don't process if aDOMKeyEvent is not a keypress event.
   if (!eventType.EqualsLiteral("keypress"))
     return;
 
   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
     // execute a command with/without shift key state. If this is TRUE, the
     // shifted key state should be ignored. Otherwise, don't ignore the state.
     // the priority of the charCodes are (shift key is not pressed):
     //   0: charCode/false,
     //   1: unshiftedCharCodes[0]/false, 2: unshiftedCharCodes[1]/false...
--- a/content/html/content/src/HTMLCanvasElement.cpp
+++ b/content/html/content/src/HTMLCanvasElement.cpp
@@ -288,17 +288,17 @@ HTMLCanvasElement::CopyInnerTo(Element* 
       rv = err.ErrorCode();
     }
   }
   return rv;
 }
 
 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();
       if (!frame)
         return NS_OK;
       nsPoint ptInRoot = nsLayoutUtils::GetEventCoordinatesRelativeTo(evt, frame);
       nsRect paddingRect = frame->GetContentRectRelativeToSelf();
       Point hitpoint;
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -3246,17 +3246,17 @@ HTMLInputElement::NeedToInitializeEditor
                     EventChainPreVisitor& aVisitor) const
 {
   // We only need to initialize the editor for single line input controls because they
   // are lazily initialized.  We don't need to initialize the control for
   // certain types of events, because we know that those events are safe to be
   // 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;
   }
 
   switch (aVisitor.mEvent->message) {
   case NS_MOUSE_MOVE:
   case NS_MOUSE_ENTER:
   case NS_MOUSE_EXIT:
   case NS_MOUSE_ENTER_SYNTH:
@@ -4264,19 +4264,19 @@ HTMLInputElement::PostHandleEvent(EventC
 }
 
 void
 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;
   }
 
   nsRangeFrame* rangeFrame = do_QueryFrame(GetPrimaryFrame());
   if (!rangeFrame && mIsDraggingRange) {
     CancelRangeThumbDrag();
     return;
   }
--- a/content/xul/content/src/nsXULElement.cpp
+++ b/content/xul/content/src/nsXULElement.cpp
@@ -1284,17 +1284,17 @@ nsXULElement::PreHandleEvent(EventChainP
          aVisitor.mEvent->message == NS_DRAGDROP_START ||
          aVisitor.mEvent->message == NS_DRAGDROP_GESTURE)) {
         // Don't propagate these events from native anonymous scrollbar.
         aVisitor.mCanHandle = true;
         aVisitor.mParentTarget = nullptr;
         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
         // in a special way.
         nsCOMPtr<nsIDOMXULCommandEvent> xulEvent =
             do_QueryInterface(aVisitor.mDOMEvent);
         // See if we have a command elt.  If so, we execute on the command
         // instead of on our content element.
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -13489,17 +13489,17 @@ nsGlobalWindow::BeginWindowMove(Event& a
 #endif
 
   if (!widget) {
     return;
   }
 
   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;
   }
 
   aError = widget->BeginMoveDrag(mouseEvent);
 }
 
 //Note: This call will lock the cursor, it will not change as it moves.
--- a/dom/events/CompositionEvent.cpp
+++ b/dom/events/CompositionEvent.cpp
@@ -12,17 +12,17 @@ namespace mozilla {
 namespace dom {
 
 CompositionEvent::CompositionEvent(EventTarget* aOwner,
                                    nsPresContext* aPresContext,
                                    WidgetCompositionEvent* aEvent)
   : 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) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
 
--- a/dom/events/DragEvent.cpp
+++ b/dom/events/DragEvent.cpp
@@ -111,17 +111,17 @@ DragEvent::GetDataTransfer(nsIDOMDataTra
 
 DataTransfer*
 DragEvent::GetDataTransfer()
 {
   // the dataTransfer field of the event caches the DataTransfer associated
   // 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;
   }
 
   WidgetDragEvent* dragEvent = mEvent->AsDragEvent();
   // for synthetic events, just use the supplied data transfer object even if null
   if (!mEventIsInternal) {
     nsresult rv = nsContentUtils::SetDataTransferInEvent(dragEvent);
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -152,17 +152,17 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(Eve
   NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Event)
   if (tmp->mEventIsInternal) {
     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:
       case NS_SIMPLE_GESTURE_EVENT:
       case NS_POINTER_EVENT:
         tmp->mEvent->AsMouseEventBase()->relatedTarget = nullptr;
         break;
       case NS_DRAG_EVENT: {
@@ -190,17 +190,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Ev
   NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Event)
   if (tmp->mEventIsInternal) {
     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:
       case NS_SIMPLE_GESTURE_EVENT:
       case NS_POINTER_EVENT:
         NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
         cb.NoteXPCOMChild(tmp->mEvent->AsMouseEventBase()->relatedTarget);
         break;
@@ -520,17 +520,17 @@ Event::PreventDefaultInternal(bool aCall
 }
 
 void
 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;
     mEvent->message = NS_USER_DEFINED_EVENT;
     mEvent->typeString = aEventTypeArg;
   }
 }
 
@@ -656,17 +656,17 @@ PopupAllowedForEvent(const char *eventNa
 // static
 PopupControlState
 Event::GetEventPopupControlState(WidgetEvent* aEvent)
 {
   // generally if an event handler is running, new windows are disallowed.
   // 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
     // nsPresShell::HandleEventInternal() for details.
     if (EventStateManager::IsHandlingUserInput()) {
       switch(aEvent->message) {
       case NS_FORM_SELECTED :
         if (PopupAllowedForEvent("select")) {
@@ -842,23 +842,23 @@ Event::GetScreenCoords(nsPresContext* aP
                        WidgetEvent* aEvent,
                        LayoutDeviceIntPoint aPoint)
 {
   if (EventStateManager::sIsPointerLocked) {
     return EventStateManager::sLastScreenPoint;
   }
 
   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);
   }
 
   WidgetGUIEvent* guiEvent = aEvent->AsGUIEvent();
   if (!guiEvent->widget) {
     return LayoutDeviceIntPoint::ToUntyped(aPoint);
   }
 
@@ -898,23 +898,23 @@ Event::GetClientCoords(nsPresContext* aP
                        LayoutDeviceIntPoint aPoint,
                        CSSIntPoint aDefaultPoint)
 {
   if (EventStateManager::sIsPointerLocked) {
     return EventStateManager::sLastClientPoint;
   }
 
   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;
   }
 
   nsIPresShell* shell = aPresContext->GetPresShell();
   if (!shell) {
     return CSSIntPoint(0, 0);
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -679,17 +679,17 @@ EventDispatcher::CreateEvent(EventTarget
                              nsPresContext* aPresContext,
                              WidgetEvent* aEvent,
                              const nsAString& aEventType,
                              nsIDOMEvent** aDOMEvent)
 {
   *aDOMEvent = nullptr;
 
   if (aEvent) {
-    switch(aEvent->eventStructType) {
+    switch(aEvent->mClass) {
     case NS_MUTATION_EVENT:
       return NS_NewDOMMutationEvent(aDOMEvent, aOwner, aPresContext,
                                     aEvent->AsMutationEvent());
     case NS_GUI_EVENT:
     case NS_SCROLLPORT_EVENT:
     case NS_UI_EVENT:
       return NS_NewDOMUIEvent(aDOMEvent, aOwner, aPresContext,
                               aEvent->AsGUIEvent());
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -492,32 +492,32 @@ EventStateManager::PreHandleEvent(nsPres
       "sIsPointerLocked is true. Drag events should be suppressed when the pointer is locked.");
   }
 #endif
   // Store last known screenPoint and clientPoint so pointer lock
   // can use these values as constants.
   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);
     sLastClientPoint =
       UIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
   }
 
   // Do not take account NS_MOUSE_ENTER/EXIT so that loading a page
   // when user is not active doesn't change the state to active.
   if (aEvent->mFlags.mIsTrusted &&
       ((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();
       if (obs) {
         obs->NotifyObservers(nullptr, "user-interaction-active", nullptr);
         UpdateUserActivityTimer();
       }
     }
@@ -1084,17 +1084,17 @@ EventStateManager::DispatchCrossProcessE
                                              nsFrameLoader* aFrameLoader,
                                              nsEventStatus *aStatus) {
   PBrowserParent* remoteBrowser = aFrameLoader->GetRemoteBrowser();
   TabParent* remote = static_cast<TabParent*>(remoteBrowser);
   if (!remote) {
     return false;
   }
 
-  switch (aEvent->eventStructType) {
+  switch (aEvent->mClass) {
   case NS_MOUSE_EVENT: {
     return remote->SendRealMouseEvent(*aEvent->AsMouseEvent());
   }
   case NS_KEY_EVENT: {
     return remote->SendRealKeyEvent(*aEvent->AsKeyboardEvent());
   }
   case NS_WHEEL_EVENT: {
     return remote->SendMouseWheelEvent(*aEvent->AsWheelEvent());
@@ -1151,17 +1151,17 @@ EventStateManager::GetChildProcessOffset
   nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(&aEvent,
                                                             targetFrame);
   return LayoutDeviceIntPoint::FromAppUnitsToNearest(pt, presContext->AppUnitsPerDevPixel());
 }
 
 bool
 CrossProcessSafeEvent(const WidgetEvent& aEvent)
 {
-  switch (aEvent.eventStructType) {
+  switch (aEvent.mClass) {
   case NS_KEY_EVENT:
   case NS_WHEEL_EVENT:
     return true;
   case NS_MOUSE_EVENT:
     switch (aEvent.message) {
     case NS_MOUSE_BUTTON_DOWN:
     case NS_MOUSE_BUTTON_UP:
     case NS_MOUSE_MOVE:
@@ -1195,17 +1195,17 @@ EventStateManager::HandleCrossProcessEve
     return false;
   }
 
   // Collect the remote event targets we're going to forward this
   // event to.
   //
   // 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.
     nsIFrame* frame = GetEventTarget();
     nsIContent* target = frame ? frame->GetContent() : nullptr;
     if (IsRemoteTarget(target)) {
       targets.AppendElement(target);
     }
@@ -3008,17 +3008,17 @@ EventStateManager::PostHandleEvent(nsPre
         DecideGestureEvent(aEvent->AsGestureNotifyEvent(), mCurrentTarget);
       }
     }
     break;
 
   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)
         break;
 
       // Reset the flag.
       dragSession->SetOnlyChromeDrop(false);
       if (mPresContext) {
@@ -3782,17 +3782,17 @@ EventStateManager::NotifyMouseOut(Widget
   // Store the first mouseOut event we fire and don't refire mouseOut
   // to that element while the first mouseOut is still ongoing.
   wrapper->mFirstOutEventElement = wrapper->mLastOverElement;
 
   // Don't touch hover state if aMovingInto is non-null.  Caller will update
   // 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);
   }
 
   EnterLeaveDispatcher leaveDispatcher(this, wrapper->mLastOverElement,
                                        aMovingInto, aMouseEvent,
                                        isPointer ? NS_POINTER_LEAVE :
@@ -3845,17 +3845,17 @@ EventStateManager::NotifyMouseOver(Widge
   // of havoc.  Reverify and take care.
   if (wrapper->mLastOverElement == aContent && dispatch)
     return;
 
   // Remember mLastOverElement as the related content for the
   // 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) {
     enterDispatcher.construct(this, aContent, lastOverElement, aMouseEvent,
                               isPointer ? NS_POINTER_ENTER : NS_MOUSEENTER);
   }
 
   NotifyMouseOut(aMouseEvent, aContent);
--- a/dom/events/IMEStateManager.cpp
+++ b/dom/events/IMEStateManager.cpp
@@ -125,19 +125,19 @@ GetIMEStateSetOpenName(IMEState::Open aO
     case IMEState::CLOSED:
       return "CLOSED";
     default:
       return "illegal value";
   }
 }
 
 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:
       return "NS_TEXT_EVENT";
     default:
       return "unacceptable event struct type";
   }
 }
@@ -845,26 +845,26 @@ void
 IMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
                                           nsPresContext* aPresContext,
                                           WidgetEvent* aEvent,
                                           nsEventStatus* aStatus,
                                           EventDispatchingCallback* aCallBack)
 {
   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;
   }
 
   EnsureTextCompositionArray();
 
   WidgetGUIEvent* GUIEvent = aEvent->AsGUIEvent();
 
--- a/dom/events/InputEvent.cpp
+++ b/dom/events/InputEvent.cpp
@@ -11,17 +11,17 @@ namespace mozilla {
 namespace dom {
 
 InputEvent::InputEvent(EventTarget* aOwner,
                        nsPresContext* aPresContext,
                        InternalEditorInputEvent* aEvent)
   : 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) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
--- a/dom/events/InternalMutationEvent.h
+++ b/dom/events/InternalMutationEvent.h
@@ -22,17 +22,17 @@ public:
     WidgetEvent(aIsTrusted, aMessage, NS_MUTATION_EVENT),
     mAttrChange(0)
   {
     mFlags.mCancelable = false;
   }
 
   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);
     result->mFlags = mFlags;
     return result;
   }
 
   nsCOMPtr<nsIDOMNode> mRelatedNode;
--- a/dom/events/KeyboardEvent.cpp
+++ b/dom/events/KeyboardEvent.cpp
@@ -14,17 +14,17 @@ namespace dom {
 KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
                              nsPresContext* aPresContext,
                              WidgetKeyboardEvent* aEvent)
   : UIEvent(aOwner, aPresContext,
             aEvent ? aEvent : new WidgetKeyboardEvent(false, 0, nullptr))
   , 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;
   }
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
     mEvent->AsKeyboardEvent()->mKeyNameIndex = KEY_NAME_INDEX_USE_STRING;
--- a/dom/events/MouseEvent.cpp
+++ b/dom/events/MouseEvent.cpp
@@ -64,17 +64,17 @@ MouseEvent::InitMouseEvent(const nsAStri
                            bool aMetaKey,
                            uint16_t aButton,
                            nsIDOMEventTarget* aRelatedTarget)
 {
   nsresult rv =
     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:
     case NS_DRAG_EVENT:
     case NS_POINTER_EVENT:
     case NS_SIMPLE_GESTURE_EVENT: {
       WidgetMouseEventBase* mouseEventBase = mEvent->AsMouseEventBase();
       mouseEventBase->relatedTarget = aRelatedTarget;
@@ -118,17 +118,17 @@ MouseEvent::InitMouseEvent(const nsAStri
                                aDetail, aScreenX, aScreenY, aClientX, aClientY,
                                (modifiers & MODIFIER_CONTROL) != 0,
                                (modifiers & MODIFIER_ALT) != 0,
                                (modifiers & MODIFIER_SHIFT) != 0,
                                (modifiers & MODIFIER_META) != 0,
                                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:
     case NS_DRAG_EVENT:
     case NS_POINTER_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
       mEvent->AsInputEvent()->modifiers = modifiers;
       return NS_OK;
@@ -149,17 +149,17 @@ MouseEvent::Constructor(const GlobalObje
   e->InitMouseEvent(aType, aParam.mBubbles, aParam.mCancelable,
                     aParam.mView, aParam.mDetail, aParam.mScreenX,
                     aParam.mScreenY, aParam.mClientX, aParam.mClientY,
                     aParam.mCtrlKey, aParam.mAltKey, aParam.mShiftKey,
                     aParam.mMetaKey, aParam.mButton, aParam.mRelatedTarget,
                     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:
     case NS_DRAG_EVENT:
     case NS_POINTER_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
       e->mEvent->AsMouseEventBase()->buttons = aParam.mButtons;
       break;
@@ -208,18 +208,17 @@ MouseEvent::GetButton(int16_t* aButton)
   NS_ENSURE_ARG_POINTER(aButton);
   *aButton = Button();
   return NS_OK;
 }
 
 int16_t
 MouseEvent::Button()
 {
-  switch(mEvent->eventStructType)
-  {
+  switch(mEvent->mClass) {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_POINTER_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
       return mEvent->AsMouseEventBase()->button;
     default:
@@ -234,18 +233,17 @@ MouseEvent::GetButtons(uint16_t* aButton
   NS_ENSURE_ARG_POINTER(aButtons);
   *aButtons = Buttons();
   return NS_OK;
 }
 
 uint16_t
 MouseEvent::Buttons()
 {
-  switch(mEvent->eventStructType)
-  {
+  switch(mEvent->mClass) {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_POINTER_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
       return mEvent->AsMouseEventBase()->buttons;
     default:
@@ -260,18 +258,17 @@ MouseEvent::GetRelatedTarget(nsIDOMEvent
   *aRelatedTarget = GetRelatedTarget().take();
   return NS_OK;
 }
 
 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:
     case NS_DRAG_EVENT:
     case NS_POINTER_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
       relatedTarget =
         do_QueryInterface(mEvent->AsMouseEventBase()->relatedTarget);
--- a/dom/events/PointerEvent.cpp
+++ b/dom/events/PointerEvent.cpp
@@ -13,17 +13,17 @@ namespace mozilla {
 namespace dom {
 
 PointerEvent::PointerEvent(EventTarget* aOwner,
                            nsPresContext* aPresContext,
                            WidgetPointerEvent* aEvent)
   : 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();
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
--- a/dom/events/SimpleGestureEvent.cpp
+++ b/dom/events/SimpleGestureEvent.cpp
@@ -12,17 +12,18 @@ namespace dom {
 
 SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
                                        nsPresContext* aPresContext,
                                        WidgetSimpleGestureEvent* aEvent)
   : MouseEvent(aOwner, aPresContext,
                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;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
     mEvent->refPoint.x = mEvent->refPoint.y = 0;
     static_cast<WidgetMouseEventBase*>(mEvent)->inputSource =
--- a/dom/events/TextComposition.cpp
+++ b/dom/events/TextComposition.cpp
@@ -105,17 +105,17 @@ TextComposition::NotityUpdateComposition
     if (selectedTextEvent.mSucceeded) {
       mCompositionStartOffset = selectedTextEvent.mReply.mOffset;
     } else {
       // Unknown offset
       NS_WARNING("Cannot get start offset of IME composition");
       mCompositionStartOffset = 0;
     }
     mCompositionTargetOffset = mCompositionStartOffset;
-  } else if (aEvent->eventStructType != NS_TEXT_EVENT) {
+  } else if (aEvent->mClass != NS_TEXT_EVENT) {
     return;
   } else {
     mCompositionTargetOffset =
       mCompositionStartOffset + aEvent->AsTextEvent()->TargetClauseOffset();
   }
 
   NotifyIME(NOTIFY_IME_OF_COMPOSITION_UPDATE);
 }
--- a/dom/events/UIEvent.cpp
+++ b/dom/events/UIEvent.cpp
@@ -41,18 +41,17 @@ UIEvent::UIEvent(EventTarget* aOwner,
   }
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
   
   // 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;
       break;
     }
 
     case NS_SCROLLPORT_EVENT:
     {
@@ -114,22 +113,22 @@ DevPixelsToCSSPixels(const LayoutDeviceI
 nsIntPoint
 UIEvent::GetMovementPoint()
 {
   if (mPrivateDataDuplicated) {
     return mMovementPoint;
   }
 
   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);
   }
 
   // Calculate the delta between the last screen point and the current one.
   nsIntPoint current = DevPixelsToCSSPixels(mEvent->refPoint, mPresContext);
   nsIntPoint last = DevPixelsToCSSPixels(mEvent->lastRefPoint, mPresContext);
   return current - last;
@@ -292,23 +291,23 @@ UIEvent::SetCancelBubble(bool aCancelBub
   mEvent->mFlags.mPropagationStopped = aCancelBubble;
   return NS_OK;
 }
 
 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;
   }
   // XXX I'm not really sure this is correct; it's my best shot, though
   nsIFrame* targetFrame = mPresContext->EventStateManager()->GetEventTarget();
   if (!targetFrame)
     return mLayerPoint;
--- a/dom/events/UIEvent.h
+++ b/dom/events/UIEvent.h
@@ -38,22 +38,22 @@ public:
   NS_IMETHOD DuplicatePrivateData() MOZ_OVERRIDE;
   NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) MOZ_OVERRIDE;
   NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) MOZ_OVERRIDE;
 
   static nsIntPoint CalculateScreenPoint(nsPresContext* aPresContext,
                                          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);
     }
 
     WidgetGUIEvent* event = aEvent->AsGUIEvent();
     if (!event->widget) {
       return LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
     }
 
@@ -65,22 +65,22 @@ public:
                       nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
   }
 
   static CSSIntPoint CalculateClientPoint(nsPresContext* aPresContext,
                                           WidgetEvent* aEvent,
                                           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
              ? *aDefaultClientPoint
              : CSSIntPoint(0, 0);
     }
 
     nsIPresShell* shell = aPresContext->GetPresShell();
@@ -127,19 +127,19 @@ public:
     return GetLayerPoint().y;
   }
 
   int32_t PageX() const;
   int32_t PageY() const;
 
   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;
   }
 
   already_AddRefed<nsINode> GetRangeParent();
 
   int32_t RangeOffset() const;
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -774,17 +774,17 @@ TabParent::MapEventCoordinatesForChildPr
   MapEventCoordinatesForChildProcess(offset, aEvent);
   return true;
 }
 
 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();
     // Then offset all the touch points by that distance, to put them
     // in the space where top-left is 0,0.
     const WidgetTouchEvent::TouchArray& touches =
       aEvent->AsTouchEvent()->touches;
     for (uint32_t i = 0; i < touches.Length(); ++i) {
@@ -1010,17 +1010,17 @@ TabParent::GetEventCapturer()
   return sEventCapturer;
 }
 
 bool
 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;
   }
 
   WidgetTouchEvent event(*aEvent.AsTouchEvent());
 
   bool isTouchPointUp = (event.message == NS_TOUCH_END ||
                          event.message == NS_TOUCH_CANCEL);
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1633,17 +1633,17 @@ nsresult nsPluginInstanceOwner::Dispatch
   if (!mPluginWindow || (mPluginWindow->type == NPWindowTypeWindow))
     return aKeyEvent->PreventDefault(); // consume event
   // continue only for cases without child window
 #endif
 
   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();
         aKeyEvent->StopPropagation();
       }
     }
   }
 
@@ -1668,17 +1668,17 @@ nsPluginInstanceOwner::ProcessMouseDown(
     if (fm) {
       nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(mContent);
       fm->SetFocus(elem, 0);
     }
   }
 
   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) {
       return aMouseEvent->PreventDefault(); // consume event
     }
   }
 
   return NS_OK;
@@ -1693,17 +1693,17 @@ nsresult nsPluginInstanceOwner::Dispatch
   // continue only for cases without child window
 #endif
   // don't send mouse events if we are hidden
   if (!mWidgetVisible)
     return NS_OK;
 
   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();
       if (!aAllowPropagate) {
         aMouseEvent->StopPropagation();
       }
     }
     if (mouseEvent->message == NS_MOUSE_BUTTON_UP) {
@@ -1899,17 +1899,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
 #endif
 
 #ifdef XP_WIN
   // this code supports windowless plugins
   const NPEvent *pPluginEvent = static_cast<const NPEvent*>(anEvent.mPluginEvent);
   // 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
       pluginEvent.event = 0;
       const WidgetMouseEvent* mouseEvent = anEvent.AsMouseEvent();
       switch (anEvent.message) {
       case NS_MOUSE_MOVE:
         pluginEvent.event = WM_MOUSEMOVE;
@@ -2006,18 +2006,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
 #endif
 
 #ifdef MOZ_X11
   // this code supports windowless plugins
   nsIWidget* widget = anEvent.widget;
   XEvent pluginEvent = XEvent();
   pluginEvent.type = 0;
 
-  switch(anEvent.eventStructType)
-    {
+  switch(anEvent.mClass) {
     case NS_MOUSE_EVENT:
       {
         switch (anEvent.message)
           {
           case NS_MOUSE_CLICK:
           case NS_MOUSE_DOUBLECLICK:
             // Button up/down events sent instead.
             return rv;
@@ -2208,18 +2207,17 @@ nsEventStatus nsPluginInstanceOwner::Pro
   {
     // The plugin needs focus to receive keyboard and touch events
     nsIFocusManager* fm = nsFocusManager::GetFocusManager();
     if (fm) {
       nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(mContent);
       fm->SetFocus(elem, 0);
     }
   }
-  switch(anEvent.eventStructType)
-    {
+  switch(anEvent.mClass) {
     case NS_MOUSE_EVENT:
       {
         switch (anEvent.message)
           {
           case NS_MOUSE_CLICK:
           case NS_MOUSE_DOUBLECLICK:
             // Button up/down events sent instead.
             return rv;
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -688,17 +688,17 @@ APZCTreeManager::ReceiveInputEvent(Widge
                                    ScrollableLayerGuid* aOutTargetGuid)
 {
   // This function will be removed as part of bug 930939.
   // In general it is preferable to use the version of ReceiveInputEvent
   // that takes an InputData, as that is usable from off-main-thread.
 
   MOZ_ASSERT(NS_IsMainThread());
 
-  switch (aEvent.eventStructType) {
+  switch (aEvent.mClass) {
     case NS_TOUCH_EVENT: {
       WidgetTouchEvent& touchEvent = *aEvent.AsTouchEvent();
       MultiTouchInput touchInput(touchEvent);
       nsEventStatus result = ProcessTouchInput(touchInput, aOutTargetGuid);
       // touchInput was modified in-place to possibly remove some
       // touch points (if we are overscrolled), and the coordinates were
       // modified using the APZ untransform. We need to copy these changes
       // back into the WidgetInputEvent.
--- a/layout/base/PositionedEventTargeting.cpp
+++ b/layout/base/PositionedEventTargeting.cpp
@@ -69,24 +69,24 @@ struct EventRadiusPrefs
   bool mRegistered;
   bool mTouchOnly;
 };
 
 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;
   } else {
     return nullptr;
   }
 
   if (!prefs->mRegistered) {
@@ -100,17 +100,17 @@ GetPrefsFor(nsEventStructType aEventStru
 
     static const char prefNames[4][9] =
       { "topmm", "rightmm", "bottommm", "leftmm" };
     for (int32_t i = 0; i < 4; ++i) {
       nsPrintfCString radiusPref("ui.%s.radius.%s", prefBranch, prefNames[i]);
       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 {
       prefs->mTouchOnly = false;
     }
   }
 
   return prefs;
@@ -358,24 +358,24 @@ FindFrameTargetedByInputEvent(const Widg
                               const nsPoint& aPointRelativeToRootFrame,
                               uint32_t aFlags)
 {
   uint32_t flags = (aFlags & INPUT_IGNORE_ROOT_SCROLL_FRAME) ?
      nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0;
   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) {
     return target;
   }
 
   // If the exact target is non-null, only consider candidate targets in the same
   // document as the exact target. Otherwise, if an ancestor document has
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1864,25 +1864,25 @@ nsLayoutUtils::GetDOMEventCoordinatesRel
     return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
   return GetEventCoordinatesRelativeTo(event, aFrame);
 }
 
 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,
            LayoutDeviceIntPoint::ToUntyped(aEvent->AsGUIEvent()->refPoint),
            aFrame);
 }
 
 nsPoint
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -460,17 +460,17 @@ public:
 
 class MOZ_STACK_CLASS nsPresShellEventCB : public EventDispatchingCallback
 {
 public:
   nsPresShellEventCB(PresShell* aPresShell) : mPresShell(aPresShell) {}
 
   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
         // which call GetContentOffsetsFromPoint which requires up-to-date layout.
         // Bring layout up-to-date now so that GetCurrentEventFrame() below
         // will return a real frame and we don't have to worry about
         // destroying it by flushing later.
         mPresShell->FlushPendingNotifications(Flush_Layout);
@@ -6699,17 +6699,17 @@ FlushThrottledStyles(nsIDocument *aDocum
 static nsresult
 DispatchPointerFromMouseOrTouch(PresShell* aShell,
                                 nsIFrame* aFrame,
                                 WidgetGUIEvent* aEvent,
                                 bool aDontRetargetEvents,
                                 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) {
       return NS_OK;
     }
     int16_t button = mouseEvent->button;
     switch (mouseEvent->message) {
     case NS_MOUSE_MOVE:
@@ -6731,17 +6731,17 @@ DispatchPointerFromMouseOrTouch(PresShel
     WidgetPointerEvent event(*mouseEvent);
     event.message = pointerMessage;
     event.button = button;
     event.pressure = event.buttons ?
                      mouseEvent->pressure ? mouseEvent->pressure : 0.5f :
                      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
     switch (touchEvent->message) {
     case NS_TOUCH_MOVE:
       pointerMessage = NS_POINTER_MOVE;
       break;
     case NS_TOUCH_END:
@@ -6893,18 +6893,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
       NS_WARNING(warning.get());
     }
 #endif
     return NS_OK;
   }
 
   nsIContent* capturingContent =
     (aEvent->HasMouseEventMessage() ||
-     aEvent->eventStructType == NS_WHEEL_EVENT ? GetCapturingContent() :
-                                                 nullptr);
+     aEvent->mClass == NS_WHEEL_EVENT ? GetCapturingContent() : nullptr);
 
   nsCOMPtr<nsIDocument> retargetEventDoc;
   if (!aDontRetargetEvents) {
     // key and IME related events should not cross top level window boundary.
     // Basically, such input events should be fired only on focused widget.
     // However, some IMEs might need to clean up composition after focused
     // window is deactivated.  And also some tests on MozMill want to test key
     // handling on deactivated window because MozMill window can be activated
@@ -6923,17 +6922,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
       retargetEventDoc = window->GetExtantDoc();
       if (!retargetEventDoc)
         return NS_OK;
     } else if (capturingContent) {
       // if the mouse is being captured then retarget the mouse event at the
       // 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
     }
 
     if (retargetEventDoc) {
       nsCOMPtr<nsIPresShell> presShell = retargetEventDoc->GetShell();
       if (!presShell)
         return NS_OK;
@@ -6953,17 +6952,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
           return NS_OK;
 
         nsCOMPtr<nsIPresShell> shell = frame->PresContext()->GetPresShell();
         return shell->HandleEvent(frame, aEvent, true, aEventStatus);
       }
     }
   }
 
-  if (aEvent->eventStructType == NS_KEY_EVENT &&
+  if (aEvent->mClass == NS_KEY_EVENT &&
       mDocument && mDocument->EventHandlingSuppressed()) {
     if (aEvent->message == NS_KEY_DOWN) {
       mNoDelayedKeyEvents = true;
     } else if (!mNoDelayedKeyEvents) {
       DelayedEvent* event = new DelayedKeyEvent(aEvent->AsKeyboardEvent());
       if (!mDelayedEvents.AppendElement(event)) {
         delete event;
       }
@@ -6971,17 +6970,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
     return NS_OK;
   }
 
   nsIFrame* frame = aFrame;
 
   if (aEvent->IsUsingCoordinates()) {
     ReleasePointerCaptureCaller releasePointerCaptureCaller;
     if (nsLayoutUtils::AreAsyncAnimationsEnabled() && mDocument) {
-      if (aEvent->eventStructType == NS_TOUCH_EVENT) {
+      if (aEvent->mClass == NS_TOUCH_EVENT) {
         nsIDocument::UnlockPointer();
       }
 
       {  // scope for scriptBlocker.
         nsAutoScriptBlocker scriptBlocker;
         GetRootPresShell()->GetDocument()->
           EnumerateSubDocuments(FlushThrottledStyles, nullptr);
       }
@@ -7052,17 +7051,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
       }
       else {
         ClearMouseCapture(nullptr);
         capturingContent = nullptr;
       }
     }
 
     // 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;
     }
 
     WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
     bool isWindowLevelMouseExit = (aEvent->message == NS_MOUSE_EXIT) &&
       (mouseEvent && mouseEvent->exit == WidgetMouseEvent::eTopLevel);
 
@@ -7150,17 +7149,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
             if (oldTouch) {
               touch->SetTarget(oldTouch->mTarget);
             }
           }
         }
       } 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;
       }
       nsIFrame* target =
         FindFrameTargetedByInputEvent(aEvent, frame, eventPoint, flags);
       if (target) {
         frame = target;
       }
@@ -7179,17 +7178,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
       NS_ASSERTION(capturingContent->GetCrossShadowCurrentDoc() == GetDocument(),
                    "Unexpected document");
       nsIFrame* capturingFrame = capturingContent->GetPrimaryFrame();
       if (capturingFrame) {
         frame = capturingFrame;
       }
     }
 
-    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;
         nsIContent* pointerCapturingContent = GetPointerCapturingContent(pointerId);
 
         if (pointerCapturingContent) {
           if (nsIFrame* capturingFrame = pointerCapturingContent->GetPrimaryFrame()) {
             // If pointer capture is set, we should suppress pointerover/pointerenter events
@@ -7205,17 +7204,17 @@ PresShell::HandleEvent(nsIFrame* aFrame,
             releasePointerCaptureCaller.SetTarget(pointerId, pointerCapturingContent);
           }
         }
       }
     }
 
     // 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;
       } else if (!mNoDelayedMouseEvents && aEvent->message == NS_MOUSE_BUTTON_UP) {
         DelayedEvent* event = new DelayedMouseEvent(aEvent->AsMouseEvent());
         if (!mDelayedEvents.AppendElement(event)) {
           delete event;
         }
@@ -7751,24 +7750,24 @@ PresShell::HandleEventInternal(WidgetEve
     // 1. Give event to event manager for pre event state changes and
     //    generation of synthetic events.
     rv = manager->PreHandleEvent(mPresContext, aEvent, mCurrentEventFrame, aStatus);
 
     // 2. Give event to the DOM for third party and JS use.
     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();
           nsPresShellEventCB* eventCBPtr = &eventCB;
           if (!eventTarget) {
             nsCOMPtr<nsIContent> targetContent;
             if (mCurrentEventFrame) {
               rv = mCurrentEventFrame->
@@ -7779,18 +7778,18 @@ PresShell::HandleEventInternal(WidgetEve
             } else if (mDocument) {
               eventTarget = do_QueryInterface(mDocument);
               // If we don't have any content, the callback wouldn't probably
               // do nothing.
               eventCBPtr = nullptr;
             }
           }
           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 {
               EventDispatcher::Dispatch(eventTarget, mPresContext,
                                         aEvent, nullptr, aStatus, eventCBPtr);
             }
           }
         }
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -558,18 +558,17 @@ nsNumberControlFrame::GetNumberControlFr
     }
   }
   return nullptr;
 }
 
 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
     return eSpinButtonNone;
   }
   if (aEvent->originalTarget == mSpinUp) {
     return eSpinButtonUp;
   }
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -461,18 +461,18 @@ nsRangeFrame::GetValueAsFractionOfRange(
   MOZ_ASSERT(value >= minimum && value <= maximum, "Unsanitized value");
   
   return ((value - minimum) / (maximum - minimum)).toDouble();
 }
 
 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");
   dom::HTMLInputElement* input = static_cast<dom::HTMLInputElement*>(mContent);
 
   MOZ_ASSERT(input->GetType() == NS_FORM_INPUT_RANGE);
 
   Decimal minimum = input->GetMinimum();
@@ -480,17 +480,17 @@ nsRangeFrame::GetValueAtEventPoint(Widge
   MOZ_ASSERT(minimum.isFinite() && maximum.isFinite(),
              "type=range should have a default maximum/minimum");
   if (maximum <= minimum) {
     return minimum;
   }
   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(
       aEvent->AsTouchEvent()->touches[0]->mRefPoint);
   } else {
     absPoint = aEvent->refPoint;
   }
   nsPoint point =
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2460,19 +2460,19 @@ nsFrame::HandleEvent(nsPresContext* aPre
 {
 
   if (aEvent->message == NS_MOUSE_MOVE) {
     // XXX If the second argument of HandleDrag() is WidgetMouseEvent,
     //     the implementation becomes simpler.
     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) {
       HandleRelease(aPresContext, aEvent, aEventStatus);
     }
   }
   return NS_OK;
 }
@@ -2674,17 +2674,17 @@ nsFrame::HandlePress(nsPresContext* aPre
                      nsEventStatus* aEventStatus)
 {
   NS_ENSURE_ARG_POINTER(aEventStatus);
   if (nsEventStatus_eConsumeNoDefault == *aEventStatus) {
     return NS_OK;
   }
 
   NS_ENSURE_ARG_POINTER(aEvent);
-  if (aEvent->eventStructType == NS_TOUCH_EVENT) {
+  if (aEvent->mClass == NS_TOUCH_EVENT) {
     return NS_OK;
   }
 
   //We often get out of sync state issues with mousedown events that
   //get interrupted by alerts/dialogs.
   //Check with the ESM to see if we should process this one
   if (!aPresContext->EventStateManager()->EventStatusOK(aEvent)) 
     return NS_OK;
@@ -3068,17 +3068,18 @@ nsFrame::PeekBackwardAndForward(nsSelect
   // maintain selection
   return frameSelection->MaintainSelection(aAmountBack);
 }
 
 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);
 
   // XXX Do we really need to exclude non-selectable content here?
   // GetContentOffsetsFromPoint can handle it just fine, although some
   // other stuff might not like it.
   if (!selectable)
@@ -3203,17 +3204,17 @@ HandleFrameSelection(nsFrameSelection*  
 
   return NS_OK;
 }
 
 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;
   }
 
   nsIFrame* activeFrame = GetActiveSelectionFrame(aPresContext, this);
 
   nsCOMPtr<nsIContent> captureContent = nsIPresShell::GetCapturingContent();
 
   // We can unconditionally stop capturing because
--- a/layout/xul/nsResizerFrame.cpp
+++ b/layout/xul/nsResizerFrame.cpp
@@ -59,18 +59,18 @@ nsResizerFrame::HandleEvent(nsPresContex
   }
 
   nsWeakFrame weakFrame(this);
   bool doDefault = true;
 
   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();
         nsIContent* contentToResize =
           GetContentToResize(presShell, getter_AddRefs(window));
         if (contentToResize) {
           nsIFrame* frameToResize = contentToResize->GetPrimaryFrame();
           if (!frameToResize)
@@ -124,18 +124,18 @@ nsResizerFrame::HandleEvent(nsPresContex
 
         nsIPresShell::SetCapturingContent(GetContent(), CAPTURE_IGNOREALLOWED);
       }
     }
     break;
 
   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;
 
       nsIPresShell::SetCapturingContent(nullptr, 0);
 
       doDefault = false;
     }
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -465,17 +465,17 @@ nsSliderFrame::HandleEvent(nsPresContext
         else {
           // vertical scrollbar - check if mouse is left or right of thumb
           if (eventPoint.x < -gSnapMultiplier * thumbSize.width ||
               eventPoint.x > thumbSize.width +
                                gSnapMultiplier * thumbSize.width)
             isMouseOutsideThumb = true;
         }
       }
-      if (aEvent->eventStructType == NS_TOUCH_EVENT) {
+      if (aEvent->mClass == NS_TOUCH_EVENT) {
         *aEventStatus = nsEventStatus_eConsumeNoDefault;
       }
       if (isMouseOutsideThumb)
       {
         SetCurrentThumbPosition(scrollbar, mThumbStart, false, false);
         return NS_OK;
       }
 
@@ -518,17 +518,17 @@ nsSliderFrame::HandleEvent(nsPresContext
 
     // set it
     nsWeakFrame weakFrame(this);
     // should aMaySnap be true here?
     SetCurrentThumbPosition(scrollbar, pos - thumbLength/2, false, false);
     NS_ENSURE_TRUE(weakFrame.IsAlive(), NS_OK);
 
     DragThumb(true);
-    if (aEvent->eventStructType == NS_TOUCH_EVENT) {
+    if (aEvent->mClass == NS_TOUCH_EVENT) {
       *aEventStatus = nsEventStatus_eConsumeNoDefault;
     }
 
     if (isHorizontal)
       mThumbStart = thumbFrame->GetPosition().x;
     else
       mThumbStart = thumbFrame->GetPosition().y;
 
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -541,19 +541,19 @@ nsXULPopupManager::InitTriggerEvent(nsID
         nsPresContext* presContext;
         if (presShell && (presContext = presShell->GetPresContext())) {
           nsPresContext* rootDocPresContext =
             presContext->GetRootPresContext();
           if (!rootDocPresContext)
             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);
             nsIntPoint clientPt;
             mouseEvent->GetClientX(&clientPt.x);
             mouseEvent->GetClientY(&clientPt.y);
 
             // XXX this doesn't handle IFRAMEs in transforms
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -2541,17 +2541,17 @@ nsTreeBodyFrame::GetCursor(const nsPoint
     }
   }
 
   return nsLeafBoxFrame::GetCursor(aPoint, aCursor);
 }
 
 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);
 
   uint32_t action = 0;
   if (dragEvent->dataTransfer)
     dragEvent->dataTransfer->GetDropEffectInt(&action);
   return action;
 }
@@ -2719,17 +2719,17 @@ nsTreeBodyFrame::HandleEvent(nsPresConte
     // Remove the drop folder and all its parents from the array.
     int32_t parentIndex;
     nsresult rv = mView->GetParentIndex(mSlots->mDropRow, &parentIndex);
     while (NS_SUCCEEDED(rv) && parentIndex >= 0) {
       mSlots->mArray.RemoveElement(parentIndex);
       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);
 
     mView->Drop(mSlots->mDropRow, mSlots->mDropOrient, dragEvent->dataTransfer);
     mSlots->mDropRow = -1;
     mSlots->mDropOrient = -1;
     mSlots->mIsDragging = false;
     *aEventStatus = nsEventStatus_eConsumeNoDefault; // already handled the drop
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -12,22 +12,23 @@
 #include "mozilla/TimeStamp.h"
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsISupportsImpl.h"
 #include "nsIWidget.h"
 #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
   NS_GUI_EVENT,                      // WidgetGUIEvent
   NS_INPUT_EVENT,                    // WidgetInputEvent
   NS_UI_EVENT,                       // InternalUIEvent
 
   // TextEvents.h
@@ -65,16 +66,18 @@ enum nsEventStructType
   NS_COMMAND_EVENT,                  // WidgetCommandEvent
   NS_CONTENT_COMMAND_EVENT,          // WidgetContentCommandEvent
   NS_PLUGIN_EVENT,                   // WidgetPluginEvent
 
   // InternalMutationEvent.h (dom/events)
   NS_MUTATION_EVENT                  // InternalMutationEvent
 };
 
+} // namespace mozilla
+
 /******************************************************************************
  * Messages
  *
  * TODO: Make them enum.
  ******************************************************************************/
 
 #define NS_EVENT_NULL                   0
 
@@ -616,37 +619,46 @@ struct EventFlags : public BaseEventFlag
 
 /******************************************************************************
  * mozilla::WidgetEvent
  ******************************************************************************/
 
 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();
     mFlags.mIsTrusted = aIsTrusted;
     mFlags.mCancelable = true;
     mFlags.mBubbles = true;
   }
 
   WidgetEvent()
   {
     MOZ_COUNT_CTOR(WidgetEvent);
   }
 
 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();
     mFlags.mIsTrusted = aIsTrusted;
     mFlags.mCancelable = true;
     mFlags.mBubbles = true;
   }
 
@@ -658,26 +670,25 @@ public:
   WidgetEvent(const WidgetEvent& aOther)
   {
     MOZ_COUNT_CTOR(WidgetEvent);
     *this = aOther;
   }
 
   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);
     result->mFlags = mFlags;
     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
   // in screen coordinates. Not modified by layout code.
   LayoutDeviceIntPoint refPoint;
   // The previous refPoint, if known, used to calculate mouse movement deltas.
   LayoutDeviceIntPoint lastRefPoint;
   // Elapsed time, in milliseconds, from a platform-specific zero time
@@ -696,20 +707,17 @@ public:
 
   // Event targets, needed by DOM Events
   nsCOMPtr<dom::EventTarget> target;
   nsCOMPtr<dom::EventTarget> currentTarget;
   nsCOMPtr<dom::EventTarget> originalTarget;
 
   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.
     time = aEvent.time;
     timeStamp = aEvent.timeStamp;
     // mFlags should be copied manually if it's necessary.
     userType = aEvent.userType;
     // typeString should be copied manually if it's necessary.
@@ -832,19 +840,19 @@ public:
 /******************************************************************************
  * mozilla::WidgetGUIEvent
  ******************************************************************************/
 
 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)
   {
   }
 
   WidgetGUIEvent()
   {
   }
 
 public:
@@ -853,17 +861,17 @@ public:
   WidgetGUIEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget) :
     WidgetEvent(aIsTrusted, aMessage, NS_GUI_EVENT),
     widget(aWidget)
   {
   }
 
   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);
     result->AssignGUIEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
@@ -992,19 +1000,19 @@ typedef uint16_t Modifiers;
 /******************************************************************************
  * mozilla::WidgetInputEvent
  ******************************************************************************/
 
 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)
   {
   }
 
   WidgetInputEvent()
   {
   }
 
 public:
@@ -1013,17 +1021,17 @@ public:
   WidgetInputEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget) :
     WidgetGUIEvent(aIsTrusted, aMessage, aWidget, NS_INPUT_EVENT),
     modifiers(0)
   {
   }
 
   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);
     result->AssignInputEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
@@ -1141,41 +1149,41 @@ class InternalUIEvent : public WidgetGUI
 {
 protected:
   InternalUIEvent()
     : detail(0)
   {
   }
 
   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)
   {
   }
 
 public:
   virtual InternalUIEvent* AsUIEvent() MOZ_OVERRIDE { return this; }
 
   InternalUIEvent(bool aIsTrusted, uint32_t aMessage)
     : WidgetGUIEvent(aIsTrusted, aMessage, nullptr, NS_UI_EVENT)
     , detail(0)
   {
   }
 
   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);
     result->mFlags = mFlags;
     return result;
   }
 
   int32_t detail;
--- a/widget/ContentEvents.h
+++ b/widget/ContentEvents.h
@@ -42,17 +42,17 @@ public:
                           nsIWidget* aWidget) :
     WidgetGUIEvent(aIsTrusted, aMessage, aWidget, NS_SCROLLPORT_EVENT),
     orient(vertical)
   {
   }
 
   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 =
       new InternalScrollPortEvent(false, message, nullptr);
     result->AssignScrollPortEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
@@ -83,17 +83,17 @@ public:
   InternalScrollAreaEvent(bool aIsTrusted, uint32_t aMessage,
                           nsIWidget* aWidget) :
     WidgetGUIEvent(aIsTrusted, aMessage, aWidget, NS_SCROLLAREA_EVENT)
   {
   }
 
   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 =
       new InternalScrollAreaEvent(false, message, nullptr);
     result->AssignScrollAreaEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
@@ -124,17 +124,17 @@ public:
   InternalFormEvent(bool aIsTrusted, uint32_t aMessage) :
     WidgetEvent(aIsTrusted, aMessage, NS_FORM_EVENT),
     originator(nullptr)
   {
   }
 
   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);
     result->mFlags = mFlags;
     return result;
   }
 
   nsIContent *originator;
@@ -161,17 +161,17 @@ public:
 
   InternalClipboardEvent(bool aIsTrusted, uint32_t aMessage) :
     WidgetEvent(aIsTrusted, aMessage, NS_CLIPBOARD_EVENT)
   {
   }
 
   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);
     result->mFlags = mFlags;
     return result;
   }
 
   nsCOMPtr<dom::DataTransfer> clipboardData;
@@ -197,17 +197,17 @@ public:
   InternalFocusEvent(bool aIsTrusted, uint32_t aMessage) :
     InternalUIEvent(aIsTrusted, aMessage, NS_FOCUS_EVENT),
     fromRaise(false), isRefocus(false)
   {
   }
 
   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);
     result->mFlags = mFlags;
     return result;
   }
 
   /// The possible related target
@@ -242,17 +242,17 @@ public:
     : WidgetEvent(aIsTrusted, aMessage, NS_TRANSITION_EVENT)
     , elapsedTime(0.0)
   {
     mFlags.mCancelable = false;
   }
 
   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);
     result->AssignTransitionEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
@@ -287,17 +287,17 @@ public:
     : WidgetEvent(aIsTrusted, aMessage, NS_ANIMATION_EVENT)
     , elapsedTime(0.0)
   {
     mFlags.mCancelable = false;
   }
 
   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);
     result->mFlags = mFlags;
     return result;
   }
 
   nsString animationName;
@@ -327,17 +327,17 @@ public:
   InternalSVGZoomEvent(bool aIsTrusted, uint32_t aMessage) :
     WidgetGUIEvent(aIsTrusted, aMessage, nullptr, NS_SVGZOOM_EVENT)
   {
     mFlags.mCancelable = false;
   }
 
   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);
     result->AssignSVGZoomEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
@@ -364,17 +364,17 @@ public:
     InternalUIEvent(aIsTrusted, aMessage, NS_SMIL_TIME_EVENT)
   {
     mFlags.mBubbles = false;
     mFlags.mCancelable = false;
   }
 
   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);
     result->mFlags = mFlags;
     return result;
   }
 
   void AssignSMILTimeEventData(const InternalSMILTimeEvent& aEvent,
--- a/widget/MiscEvents.h
+++ b/widget/MiscEvents.h
@@ -105,17 +105,17 @@ public:
                    NS_COMMAND_EVENT),
     command(aCommand)
   {
     userType = aEventType;
   }
 
   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 =
       new WidgetCommandEvent(false, userType, command, nullptr);
     result->AssignCommandEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
@@ -148,17 +148,17 @@ public:
     retargetToFocusedDocument(false)
   {
   }
 
   virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
   {
     // 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);
     result->AssignPluginEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -73,20 +73,22 @@ private:
   friend class dom::PBrowserChild;
 
 protected:
   WidgetMouseEventBase()
   {
   }
 
   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)
  {
  }
 
 public:
   virtual WidgetMouseEventBase* AsMouseEventBase() MOZ_OVERRIDE { return this; }
 
   virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
   {
@@ -183,20 +185,24 @@ public:
   };
 
 protected:
   WidgetMouseEvent()
   {
   }
 
   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:
       case NS_MOUSELEAVE:
         mFlags.mBubbles = false;
         mFlags.mCancelable = false;
         break;
       default:
@@ -234,17 +240,17 @@ public:
                      button ==
                        ((context == eNormal) ? eRightButton : eLeftButton),
                      "Wrong button set to NS_CONTEXTMENU event?");
   }
 #endif
 
   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 =
       new WidgetMouseEvent(false, message, nullptr, reason, context);
     result->AssignMouseEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
@@ -306,17 +312,17 @@ public:
     mFlags.mCancelable =
       (aMessage != NS_DRAGDROP_EXIT_SYNTH &&
        aMessage != NS_DRAGDROP_LEAVE_SYNTH &&
        aMessage != NS_DRAGDROP_END);
   }
 
   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);
     result->AssignDragEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
@@ -365,17 +371,17 @@ public:
                          nsIWidget* aWidget) :
     WidgetMouseEventBase(aIsTrusted, aMessage, aWidget, NS_MOUSE_SCROLL_EVENT),
     delta(0), isHorizontal(false)
   {
   }
 
   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 =
       new WidgetMouseScrollEvent(false, message, nullptr);
     result->AssignMouseScrollEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
@@ -427,17 +433,17 @@ public:
     lineOrPageDeltaX(0), lineOrPageDeltaY(0), scrollType(SCROLL_DEFAULT),
     overflowDeltaX(0.0), overflowDeltaY(0.0),
     mViewPortIsOverscrolled(false)
   {
   }
 
   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);
     result->AssignWheelEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
@@ -570,17 +576,17 @@ public:
   }
 
   WidgetPointerEvent(const WidgetMouseEvent& aEvent)
     : WidgetMouseEvent(aEvent)
     , width(0)
     , height(0)
     , isPrimary(true)
   {
-    eventStructType = NS_POINTER_EVENT;
+    mClass = NS_POINTER_EVENT;
     UpdateFlags();
   }
 
   void UpdateFlags()
   {
     switch (message) {
       case NS_POINTER_ENTER:
       case NS_POINTER_LEAVE:
@@ -594,17 +600,17 @@ public:
         break;
       default:
         break;
     }
   }
 
   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 =
       new WidgetPointerEvent(false, message, nullptr);
     result->AssignPointerEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -94,17 +94,17 @@ public:
     , mCodeNameIndex(CODE_NAME_INDEX_UNKNOWN)
     , mNativeKeyEvent(nullptr)
     , mUniqueId(0)
   {
   }
 
   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 =
       new WidgetKeyboardEvent(false, message, nullptr);
     result->AssignKeyEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
@@ -227,17 +227,17 @@ public:
     : WidgetGUIEvent(aIsTrusted, aMessage, aWidget, NS_TEXT_EVENT)
     , mSeqno(kLatestSeqno)
     , isChar(false)
   {
   }
 
   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);
     result->AssignTextEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
@@ -308,17 +308,17 @@ public:
     // XXX compositionstart is cancelable in draft of DOM3 Events.
     //     However, it doesn't make sense for us, we cannot cancel composition
     //     when we send compositionstart event.
     mFlags.mCancelable = false;
   }
 
   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 =
       new WidgetCompositionEvent(false, message, nullptr);
     result->AssignCompositionEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
@@ -561,17 +561,17 @@ public:
     }
 
     mFlags.mBubbles = true;
     mFlags.mCancelable = false;
   }
 
   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 =
       new InternalEditorInputEvent(false, message, nullptr);
     result->AssignEditorInputEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
--- a/widget/TouchEvents.h
+++ b/widget/TouchEvents.h
@@ -45,17 +45,17 @@ public:
 
   virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
   {
     // XXX Looks like this event is handled only in PostHandleEvent() of
     //     EventStateManager.  Therefore, it might be possible to handle this
     //     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 =
       new WidgetGestureNotifyEvent(false, message, nullptr);
     result->AssignGestureNotifyEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
@@ -111,17 +111,17 @@ public:
     , direction(aOther.direction)
     , delta(aOther.delta)
     , clickCount(0)
   {
   }
 
   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 =
       new WidgetSimpleGestureEvent(false, message, nullptr);
     result->AssignSimpleGestureEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
@@ -185,17 +185,17 @@ public:
 
   virtual ~WidgetTouchEvent()
   {
     MOZ_COUNT_DTOR(WidgetTouchEvent);
   }
 
   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);
     result->AssignTouchEventData(*this, true);
     result->mFlags = mFlags;
     return result;
   }
 
--- a/widget/gtk/nsGtkKeyUtils.cpp
+++ b/widget/gtk/nsGtkKeyUtils.cpp
@@ -641,17 +641,17 @@ KeymapWrapper::InitInputEvent(WidgetInpu
          GetBoolName(aInputEvent.modifiers & MODIFIER_ALT),
          GetBoolName(aInputEvent.modifiers & MODIFIER_META),
          GetBoolName(aInputEvent.modifiers & MODIFIER_OS),
          GetBoolName(aInputEvent.modifiers & MODIFIER_ALTGRAPH),
          GetBoolName(aInputEvent.modifiers & MODIFIER_CAPSLOCK),
          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:
         case NS_DRAG_EVENT:
         case NS_SIMPLE_GESTURE_EVENT:
             break;
         default:
             return;
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6206,17 +6206,17 @@ nsWindow::GetDragInfo(WidgetMouseEvent* 
 
     return true;
 }
 
 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;
     gint button, screenX, screenY;
     if (!GetDragInfo(aEvent, &gdk_window, &button, &screenX, &screenY)) {
         return NS_ERROR_FAILURE;
     }
 
@@ -6229,17 +6229,17 @@ nsWindow::BeginMoveDrag(WidgetMouseEvent
 
 NS_IMETHODIMP
 nsWindow::BeginResizeDrag(WidgetGUIEvent* aEvent,
                           int32_t aHorizontal,
                           int32_t aVertical)
 {
     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;
     }
 
     GdkWindow *gdk_window;
     gint button, screenX, screenY;
     if (!GetDragInfo(aEvent->AsMouseEvent(), &gdk_window, &button,
                      &screenX, &screenY)) {
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -40,34 +40,35 @@ struct ParamTraits<mozilla::BaseEventFla
 
 template<>
 struct ParamTraits<mozilla::WidgetEvent>
 {
   typedef mozilla::WidgetEvent paramType;
 
   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);
     WriteParam(aMsg, aParam.timeStamp);
     WriteParam(aMsg, aParam.mFlags);
   }
 
   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;
   }
 };
 
 template<>
 struct ParamTraits<mozilla::WidgetGUIEvent>
 {
   typedef mozilla::WidgetGUIEvent paramType;
--- a/widget/shared/WidgetEventImpl.cpp
+++ b/widget/shared/WidgetEventImpl.cpp
@@ -41,35 +41,35 @@ WidgetEvent::As##aName() const \
  * mozilla::WidgetEvent
  *
  * Event struct type checking methods.
  ******************************************************************************/
 
 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;
 }
 
 
 /******************************************************************************
  * mozilla::WidgetEvent
  *
  * Event message checking methods.
  ******************************************************************************/
@@ -210,17 +210,17 @@ WidgetEvent::IsTargetedAtFocusedContent(
   }
   return HasKeyEventMessage() || IsIMERelatedEvent() ||
          IsRetargetedNativeEventDelivererForPlugin();
 }
 
 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
       // DOM events (EventStateManager::PreHandleEvent), but not mousemove
       // DOM events.
       // Synthesized button up events also do not cause DOM events because they
       // do not have a reliable refPoint.
       return AsMouseEvent()->reason == WidgetMouseEvent::eReal;
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -275,36 +275,36 @@ ModifierKeyState::Set(Modifiers aAddingM
   EnsureAltGr();
 }
 
 void
 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:
     case NS_DRAG_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
       InitMouseEvent(aInputEvent);
       break;
     default:
       break;
   }
 }
 
 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) {
     // Buttons for immersive mode are handled in MetroInput.
     return;
   }
 
   WidgetMouseEventBase& mouseEvent = *aMouseEvent.AsMouseEventBase();
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1533,17 +1533,17 @@ NS_METHOD nsWindow::Resize(double aX, do
 
 NS_IMETHODIMP
 nsWindow::BeginResizeDrag(WidgetGUIEvent* aEvent,
                           int32_t aHorizontal,
                           int32_t aVertical)
 {
   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;
   }
 
   if (aEvent->AsMouseEvent()->button != WidgetMouseEvent::eLeftButton) {
     // you can only begin a resize drag with the left mouse button
     return NS_ERROR_INVALID_ARG;
   }
--- a/widget/windows/winrt/MetroWidget.cpp
+++ b/widget/windows/winrt/MetroWidget.cpp
@@ -646,17 +646,17 @@ CloseGesture()
 
 // Async event sending for mouse and keyboard input.
 
 // defined in nsWindowBase, called from shared module WinMouseScrollHandler.
 bool
 MetroWidget::DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent)
 {
   WidgetGUIEvent* newEvent = nullptr;
-  switch(aEvent->eventStructType) {
+  switch(aEvent->mClass) {
     case NS_WHEEL_EVENT:
     {
       WidgetWheelEvent* oldEvent = aEvent->AsWheelEvent();
       WidgetWheelEvent* wheelEvent =
         new WidgetWheelEvent(oldEvent->mFlags.mIsTrusted, oldEvent->message, oldEvent->widget);
       wheelEvent->AssignWheelEventData(*oldEvent, true);
       newEvent = static_cast<WidgetGUIEvent*>(wheelEvent);
     }
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -285,17 +285,17 @@ PuppetWidget::DispatchEvent(WidgetGUIEve
   }
 
   aStatus = nsEventStatus_eIgnore;
 
   if (event->message == NS_COMPOSITION_START) {
     mIMEComposing = true;
   }
   uint32_t seqno = kLatestSeqno;
-  switch (event->eventStructType) {
+  switch (event->mClass) {
   case NS_COMPOSITION_EVENT:
     seqno = event->AsCompositionEvent()->mSeqno;
     break;
   case NS_TEXT_EVENT:
     seqno = event->AsTextEvent()->mSeqno;
     break;
   case NS_SELECTION_EVENT:
     seqno = event->AsSelectionEvent()->mSeqno;