Bug 920377 part.27 Get rid of nsMouseEvent_base r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 01 Oct 2013 16:23:02 +0900
changeset 164203 d3a3d276eb33e8c8311270ba6d65039367c07e26
parent 164202 e88b33939f5058ba29b2ccad47d8cecfa3a4a549
child 164204 94b92dd29c9f8fcb638bb211644d1175f831f890
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs920377
milestone27.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 920377 part.27 Get rid of nsMouseEvent_base r=roc
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMMouseEvent.cpp
content/events/src/nsDOMMouseEvent.h
widget/EventForwards.h
widget/MouseEvents.h
widget/cocoa/nsChildView.h
widget/cocoa/nsChildView.mm
widget/gtk/nsGtkKeyUtils.cpp
widget/nsGUIEventIPC.h
widget/windows/KeyboardLayout.cpp
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -138,21 +138,23 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
     tmp->mEvent->target = nullptr;
     tmp->mEvent->currentTarget = nullptr;
     tmp->mEvent->originalTarget = nullptr;
     switch (tmp->mEvent->eventStructType) {
       case NS_MOUSE_EVENT:
       case NS_MOUSE_SCROLL_EVENT:
       case NS_WHEEL_EVENT:
       case NS_SIMPLE_GESTURE_EVENT:
-        static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget = nullptr;
+        static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget =
+          nullptr;
         break;
       case NS_DRAG_EVENT:
         static_cast<nsDragEvent*>(tmp->mEvent)->dataTransfer = nullptr;
-        static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget = nullptr;
+        static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget =
+          nullptr;
         break;
       case NS_CLIPBOARD_EVENT:
         static_cast<InternalClipboardEvent*>(tmp->mEvent)->clipboardData =
           nullptr;
         break;
       case NS_MUTATION_EVENT:
         static_cast<InternalMutationEvent*>(tmp->mEvent)->mRelatedNode =
           nullptr;
@@ -177,25 +179,25 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(
     NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEvent->originalTarget)
     switch (tmp->mEvent->eventStructType) {
       case NS_MOUSE_EVENT:
       case NS_MOUSE_SCROLL_EVENT:
       case NS_WHEEL_EVENT:
       case NS_SIMPLE_GESTURE_EVENT:
         NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
         cb.NoteXPCOMChild(
-          static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget);
+          static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget);
         break;
       case NS_DRAG_EVENT:
         NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->dataTransfer");
         cb.NoteXPCOMChild(
           static_cast<nsDragEvent*>(tmp->mEvent)->dataTransfer);
         NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
         cb.NoteXPCOMChild(
-          static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget);
+          static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget);
         break;
       case NS_CLIPBOARD_EVENT:
         NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->clipboardData");
         cb.NoteXPCOMChild(
           static_cast<InternalClipboardEvent*>(tmp->mEvent)->clipboardData);
         break;
       case NS_MUTATION_EVENT:
         NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mRelatedNode");
--- a/content/events/src/nsDOMMouseEvent.cpp
+++ b/content/events/src/nsDOMMouseEvent.cpp
@@ -81,18 +81,19 @@ nsDOMMouseEvent::InitMouseEvent(const ns
   switch(mEvent->eventStructType)
   {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
     {
-       static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget = aRelatedTarget;
-       static_cast<nsMouseEvent_base*>(mEvent)->button = aButton;
+       static_cast<WidgetMouseEventBase*>(mEvent)->relatedTarget =
+         aRelatedTarget;
+       static_cast<WidgetMouseEventBase*>(mEvent)->button = aButton;
        WidgetInputEvent* inputEvent = static_cast<WidgetInputEvent*>(mEvent);
        inputEvent->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
        mClientPoint.x = aClientX;
        mClientPoint.y = aClientY;
        inputEvent->refPoint.x = aScreenX;
        inputEvent->refPoint.y = aScreenY;
 
        if (mEvent->eventStructType == NS_MOUSE_EVENT) {
@@ -164,17 +165,17 @@ nsDOMMouseEvent::Constructor(const mozil
   e->SetTrusted(trusted);
 
   switch (e->mEvent->eventStructType) {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
-      static_cast<nsMouseEvent_base*>(e->mEvent)->buttons = aParam.mButtons;
+      static_cast<WidgetMouseEventBase*>(e->mEvent)->buttons = aParam.mButtons;
       break;
     default:
       break;
   }
 
   return e.forget();
 }
 
@@ -187,18 +188,18 @@ nsDOMMouseEvent::InitNSMouseEvent(const 
                                   float aPressure, uint16_t aInputSource)
 {
   nsresult rv = nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
                                                 aView, aDetail, aScreenX, aScreenY,
                                                 aClientX, aClientY, aCtrlKey, aAltKey, aShiftKey,
                                                 aMetaKey, aButton, aRelatedTarget);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  static_cast<nsMouseEvent_base*>(mEvent)->pressure = aPressure;
-  static_cast<nsMouseEvent_base*>(mEvent)->inputSource = aInputSource;
+  static_cast<WidgetMouseEventBase*>(mEvent)->pressure = aPressure;
+  static_cast<WidgetMouseEventBase*>(mEvent)->inputSource = aInputSource;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMMouseEvent::GetButton(uint16_t* aButton)
 {
   NS_ENSURE_ARG_POINTER(aButton);
   *aButton = Button();
@@ -210,17 +211,17 @@ nsDOMMouseEvent::Button()
 {
   switch(mEvent->eventStructType)
   {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
-      return static_cast<nsMouseEvent_base*>(mEvent)->button;
+      return static_cast<WidgetMouseEventBase*>(mEvent)->button;
     default:
       NS_WARNING("Tried to get mouse button for non-mouse event!");
       return nsMouseEvent::eLeftButton;
   }
 }
 
 NS_IMETHODIMP
 nsDOMMouseEvent::GetButtons(uint16_t* aButtons)
@@ -235,17 +236,17 @@ nsDOMMouseEvent::Buttons()
 {
   switch(mEvent->eventStructType)
   {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
-      return static_cast<nsMouseEvent_base*>(mEvent)->buttons;
+      return static_cast<WidgetMouseEventBase*>(mEvent)->buttons;
     default:
       MOZ_CRASH("Tried to get mouse buttons for non-mouse event!");
   }
 }
 
 NS_IMETHODIMP
 nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
 {
@@ -260,17 +261,18 @@ nsDOMMouseEvent::GetRelatedTarget()
   nsCOMPtr<mozilla::dom::EventTarget> relatedTarget;
   switch(mEvent->eventStructType)
   {
     case NS_MOUSE_EVENT:
     case NS_MOUSE_SCROLL_EVENT:
     case NS_WHEEL_EVENT:
     case NS_DRAG_EVENT:
     case NS_SIMPLE_GESTURE_EVENT:
-      relatedTarget = do_QueryInterface(static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget);
+      relatedTarget = do_QueryInterface(
+        static_cast<WidgetMouseEventBase*>(mEvent)->relatedTarget);
       break;
     default:
       break;
   }
 
   if (relatedTarget) {
     nsCOMPtr<nsIContent> content = do_QueryInterface(relatedTarget);
     if (content && content->ChromeOnlyAccess() &&
--- a/content/events/src/nsDOMMouseEvent.h
+++ b/content/events/src/nsDOMMouseEvent.h
@@ -90,21 +90,21 @@ public:
     return GetMovementPoint().x;
   }
   int32_t MozMovementY()
   {
     return GetMovementPoint().y;
   }
   float MozPressure() const
   {
-    return static_cast<nsMouseEvent_base*>(mEvent)->pressure;
+    return static_cast<mozilla::WidgetMouseEventBase*>(mEvent)->pressure;
   }
   uint16_t MozInputSource() const
   {
-    return static_cast<nsMouseEvent_base*>(mEvent)->inputSource;
+    return static_cast<mozilla::WidgetMouseEventBase*>(mEvent)->inputSource;
   }
   void InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
                         nsIDOMWindow *aView, int32_t aDetail, int32_t aScreenX,
                         int32_t aScreenY, int32_t aClientX, int32_t aClientY,
                         bool aCtrlKey, bool aAltKey, bool aShiftKey,
                         bool aMetaKey, uint16_t aButton,
                         mozilla::dom::EventTarget *aRelatedTarget,
                         float aPressure, uint16_t aInputSource,
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -100,17 +100,16 @@ class WidgetPluginEvent;
 
 // MutationEvent.h (content/events/public)
 class InternalMutationEvent;
 } // namespace mozilla
 
 // TODO: Remove following typedefs
 typedef mozilla::WidgetEvent               nsEvent;
 typedef mozilla::WidgetGUIEvent            nsGUIEvent;
-typedef mozilla::WidgetMouseEventBase      nsMouseEvent_base;
 typedef mozilla::WidgetMouseEvent          nsMouseEvent;
 typedef mozilla::WidgetDragEvent           nsDragEvent;
 typedef mozilla::WidgetMouseScrollEvent    nsMouseScrollEvent;
 
 namespace mozilla {
 typedef WidgetWheelEvent                   WheelEvent;
 }
 
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -419,14 +419,13 @@ public:
 };
 
 // TODO: Remove following typedef
 typedef WidgetWheelEvent                WheelEvent;
 
 } // namespace mozilla
 
 // TODO: Remove following typedefs
-typedef mozilla::WidgetMouseEventBase   nsMouseEvent_base;
 typedef mozilla::WidgetMouseEvent       nsMouseEvent;
 typedef mozilla::WidgetDragEvent        nsDragEvent;
 typedef mozilla::WidgetMouseScrollEvent nsMouseScrollEvent;
 
 #endif // mozilla_MouseEvents_h__
--- a/widget/cocoa/nsChildView.h
+++ b/widget/cocoa/nsChildView.h
@@ -376,17 +376,17 @@ public:
   static void OnDestroyWindow(NSWindow* aWindow);
   static BOOL WindowAcceptsEvent(NSWindow* aWindow, NSEvent* aEvent,
                                  ChildView* aView, BOOL isClickThrough = NO);
   static void MouseExitedWindow(NSEvent* aEvent);
   static void MouseEnteredWindow(NSEvent* aEvent);
   static void ReEvaluateMouseEnterState(NSEvent* aEvent = nil, ChildView* aOldView = nil);
   static void ResendLastMouseMoveEvent();
   static ChildView* ViewForEvent(NSEvent* aEvent);
-  static void AttachPluginEvent(nsMouseEvent_base& aMouseEvent,
+  static void AttachPluginEvent(mozilla::WidgetMouseEventBase& aMouseEvent,
                                 ChildView* aView,
                                 NSEvent* aNativeMouseEvent,
                                 int aPluginEventType,
                                 void* aPluginEventHolder);
 
   static ChildView* sLastMouseEventView;
   static NSEvent* sLastMouseMoveEvent;
   static NSWindow* sWindowUnderMouse;
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -4847,18 +4847,18 @@ static int32_t RoundUp(double aDouble)
 
   // convert point to view coordinate system
   NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(aMouseEvent, [self window]);
   NSPoint localPoint = [self convertPoint:locationInWindow fromView:nil];
 
   outGeckoEvent->refPoint = LayoutDeviceIntPoint::FromUntyped(
     mGeckoChild->CocoaPointsToDevPixels(localPoint));
 
-  nsMouseEvent_base* mouseEvent =
-    static_cast<nsMouseEvent_base*>(outGeckoEvent);
+  WidgetMouseEventBase* mouseEvent =
+    static_cast<WidgetMouseEventBase*>(outGeckoEvent);
   mouseEvent->buttons = 0;
   NSUInteger mouseButtons = [NSEvent pressedMouseButtons];
 
   if (mouseButtons & 0x01) {
     mouseEvent->buttons |= nsMouseEvent::eLeftButtonFlag;
   }
   if (mouseButtons & 0x02) {
     mouseEvent->buttons |= nsMouseEvent::eRightButtonFlag;
@@ -6132,17 +6132,17 @@ ChildViewMouseTracker::ViewForEvent(NSEv
   ChildView* childView = (ChildView*)view;
   // If childView is being destroyed return nil.
   if (![childView widget])
     return nil;
   return WindowAcceptsEvent(window, aEvent, childView) ? childView : nil;
 }
 
 void
-ChildViewMouseTracker::AttachPluginEvent(nsMouseEvent_base& aMouseEvent,
+ChildViewMouseTracker::AttachPluginEvent(WidgetMouseEventBase& aMouseEvent,
                                          ChildView* aView,
                                          NSEvent* aNativeMouseEvent,
                                          int aPluginEventType,
                                          void* aPluginEventHolder)
 {
   if (![aView isPluginView] ||
       [aView pluginEventModel] != NPEventModelCocoa) {
     return;
--- a/widget/gtk/nsGtkKeyUtils.cpp
+++ b/widget/gtk/nsGtkKeyUtils.cpp
@@ -555,17 +555,18 @@ KeymapWrapper::InitInputEvent(WidgetInpu
         case NS_WHEEL_EVENT:
         case NS_DRAG_EVENT:
         case NS_SIMPLE_GESTURE_EVENT:
             break;
         default:
             return;
     }
 
-    nsMouseEvent_base& mouseEvent = static_cast<nsMouseEvent_base&>(aInputEvent);
+    WidgetMouseEventBase& mouseEvent =
+      static_cast<WidgetMouseEventBase&>(aInputEvent);
     mouseEvent.buttons = 0;
     if (aModifierState & GDK_BUTTON1_MASK) {
         mouseEvent.buttons |= nsMouseEvent::eLeftButtonFlag;
     }
     if (aModifierState & GDK_BUTTON3_MASK) {
         mouseEvent.buttons |= nsMouseEvent::eRightButtonFlag;
     }
     if (aModifierState & GDK_BUTTON2_MASK) {
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -95,19 +95,19 @@ struct ParamTraits<mozilla::WidgetInputE
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     return ReadParam(aMsg, aIter, static_cast<nsGUIEvent*>(aResult)) &&
            ReadParam(aMsg, aIter, &aResult->modifiers);
   }
 };
 
 template<>
-struct ParamTraits<nsMouseEvent_base>
+struct ParamTraits<mozilla::WidgetMouseEventBase>
 {
-  typedef nsMouseEvent_base paramType;
+  typedef mozilla::WidgetMouseEventBase paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<mozilla::WidgetInputEvent>(aParam));
     WriteParam(aMsg, aParam.button);
     WriteParam(aMsg, aParam.buttons);
     WriteParam(aMsg, aParam.pressure);
     WriteParam(aMsg, aParam.inputSource);
@@ -126,17 +126,17 @@ struct ParamTraits<nsMouseEvent_base>
 
 template<>
 struct ParamTraits<mozilla::WheelEvent>
 {
   typedef mozilla::WheelEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
-    WriteParam(aMsg, static_cast<nsMouseEvent_base>(aParam));
+    WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
     WriteParam(aMsg, aParam.deltaX);
     WriteParam(aMsg, aParam.deltaY);
     WriteParam(aMsg, aParam.deltaZ);
     WriteParam(aMsg, aParam.deltaMode);
     WriteParam(aMsg, aParam.customizedByUserPrefs);
     WriteParam(aMsg, aParam.isMomentum);
     WriteParam(aMsg, aParam.isPixelOnlyDevice);
     WriteParam(aMsg, aParam.lineOrPageDeltaX);
@@ -145,17 +145,18 @@ struct ParamTraits<mozilla::WheelEvent>
     WriteParam(aMsg, aParam.overflowDeltaX);
     WriteParam(aMsg, aParam.overflowDeltaY);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     int32_t scrollType = 0;
     bool rv =
-      ReadParam(aMsg, aIter, static_cast<nsMouseEvent_base*>(aResult)) &&
+      ReadParam(aMsg, aIter,
+                static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
       ReadParam(aMsg, aIter, &aResult->deltaX) &&
       ReadParam(aMsg, aIter, &aResult->deltaY) &&
       ReadParam(aMsg, aIter, &aResult->deltaZ) &&
       ReadParam(aMsg, aIter, &aResult->deltaMode) &&
       ReadParam(aMsg, aIter, &aResult->customizedByUserPrefs) &&
       ReadParam(aMsg, aIter, &aResult->isMomentum) &&
       ReadParam(aMsg, aIter, &aResult->isPixelOnlyDevice) &&
       ReadParam(aMsg, aIter, &aResult->lineOrPageDeltaX) &&
@@ -171,29 +172,30 @@ struct ParamTraits<mozilla::WheelEvent>
 
 template<>
 struct ParamTraits<nsMouseEvent>
 {
   typedef nsMouseEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
-    WriteParam(aMsg, static_cast<nsMouseEvent_base>(aParam));
+    WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
     WriteParam(aMsg, aParam.ignoreRootScrollFrame);
     WriteParam(aMsg, (uint8_t) aParam.reason);
     WriteParam(aMsg, (uint8_t) aParam.context);
     WriteParam(aMsg, (uint8_t) aParam.exit);
     WriteParam(aMsg, aParam.clickCount);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     bool rv;
     uint8_t reason = 0, context = 0, exit = 0;
-    rv = ReadParam(aMsg, aIter, static_cast<nsMouseEvent_base*>(aResult)) &&
+    rv = ReadParam(aMsg, aIter,
+                   static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
          ReadParam(aMsg, aIter, &aResult->ignoreRootScrollFrame) &&
          ReadParam(aMsg, aIter, &reason) &&
          ReadParam(aMsg, aIter, &context) &&
          ReadParam(aMsg, aIter, &exit) &&
          ReadParam(aMsg, aIter, &aResult->clickCount);
     aResult->reason = static_cast<nsMouseEvent::reasonType>(reason);
     aResult->context = static_cast<nsMouseEvent::contextType>(context);
     aResult->exit = static_cast<nsMouseEvent::exitType>(exit);
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -146,17 +146,18 @@ 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,
                "called with non-mouse event");
 
-  nsMouseEvent_base& mouseEvent = static_cast<nsMouseEvent_base&>(aMouseEvent);
+  WidgetMouseEventBase& mouseEvent =
+    static_cast<WidgetMouseEventBase&>(aMouseEvent);
   mouseEvent.buttons = 0;
   if (::GetKeyState(VK_LBUTTON) < 0) {
     mouseEvent.buttons |= nsMouseEvent::eLeftButtonFlag;
   }
   if (::GetKeyState(VK_RBUTTON) < 0) {
     mouseEvent.buttons |= nsMouseEvent::eRightButtonFlag;
   }
   if (::GetKeyState(VK_MBUTTON) < 0) {