Bug 920377 part.2 Get rid of nsPluginEvent r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 27 Sep 2013 15:20:54 +0900
changeset 148946 f9a539f98ccc3febfc4bdec145affabad34934b2
parent 148945 b825037b2d43420eeb455a157181c738857902a5
child 148947 1ba8d22427b0241ac424f24ed983f5b803cad7c2
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs920377
milestone27.0a1
Bug 920377 part.2 Get rid of nsPluginEvent r=roc
dom/plugins/base/nsPluginInstanceOwner.cpp
widget/EventForwards.h
widget/MiscEvents.h
widget/cocoa/TextInputHandler.mm
widget/cocoa/nsChildView.mm
widget/cocoa/nsCocoaUtils.h
widget/cocoa/nsCocoaUtils.mm
widget/nsGUIEventIPC.h
widget/windows/nsWindowBase.h
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -3208,17 +3208,17 @@ void* nsPluginInstanceOwner::FixUpPlugin
   }
 
   // After the first NPP_SetWindow call we need to send an initial
   // top-level window focus event.
   if (!mSentInitialTopLevelWindowEvent) {
     // Set this before calling ProcessEvent to avoid endless recursion.
     mSentInitialTopLevelWindowEvent = true;
 
-    nsPluginEvent pluginEvent(true, NS_PLUGIN_FOCUS_EVENT, nullptr);
+    WidgetPluginEvent pluginEvent(true, NS_PLUGIN_FOCUS_EVENT, nullptr);
     NPCocoaEvent cocoaEvent;
     InitializeNPCocoaEvent(&cocoaEvent);
     cocoaEvent.type = NPCocoaEventWindowFocusChanged;
     cocoaEvent.data.focus.hasFocus = NS_NPAPI_CocoaWindowIsMain(cocoaTopLevelWindow);
     pluginEvent.pluginEvent = &cocoaEvent;
     ProcessEvent(pluginEvent);
   }
 
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -133,11 +133,10 @@ typedef mozilla::InternalScrollPortEvent
 typedef mozilla::InternalScrollAreaEvent   nsScrollAreaEvent;
 typedef mozilla::InternalFormEvent         nsFormEvent;
 typedef mozilla::InternalClipboardEvent    nsClipboardEvent;
 typedef mozilla::InternalFocusEvent        nsFocusEvent;
 typedef mozilla::InternalTransitionEvent   nsTransitionEvent;
 typedef mozilla::InternalAnimationEvent    nsAnimationEvent;
 typedef mozilla::WidgetContentCommandEvent nsContentCommandEvent;
 typedef mozilla::WidgetCommandEvent        nsCommandEvent;
-typedef mozilla::WidgetPluginEvent         nsPluginEvent;
 
 #endif // mozilla_EventForwards_h__
--- a/widget/MiscEvents.h
+++ b/widget/MiscEvents.h
@@ -113,11 +113,10 @@ public:
   bool retargetToFocusedDocument;
 };
 
 } // namespace mozilla
 
 // TODO: Remove following typedefs
 typedef mozilla::WidgetContentCommandEvent nsContentCommandEvent;
 typedef mozilla::WidgetCommandEvent        nsCommandEvent;
-typedef mozilla::WidgetPluginEvent         nsPluginEvent;
 
 #endif // mozilla_MiscEvents_h__
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -3732,17 +3732,17 @@ PluginTextInputHandler::HandleCarbonPlug
       return;
     }
 
     NPCocoaEvent cocoaTextEvent;
     nsCocoaUtils::InitNPCocoaEvent(&cocoaTextEvent);
     cocoaTextEvent.type = NPCocoaEventTextInput;
     cocoaTextEvent.data.text.text = (NPNSString*)text;
 
-    nsPluginEvent pluginEvent(true, NS_PLUGIN_INPUT_EVENT, mWidget);
+    WidgetPluginEvent pluginEvent(true, NS_PLUGIN_INPUT_EVENT, mWidget);
     nsCocoaUtils::InitPluginEvent(pluginEvent, cocoaTextEvent);
     DispatchEvent(pluginEvent);
 
     ::CFRelease(text);
     free(chars);
 
     return;
   }
@@ -3881,17 +3881,17 @@ PluginTextInputHandler::HandleKeyDownEve
 
     return;
   }
 
   // Reset complex text input request flag.
   mPluginComplexTextInputRequested = false;
 
   // Send key down event to the plugin.
-  nsPluginEvent pluginEvent(true, NS_PLUGIN_INPUT_EVENT, mWidget);
+  WidgetPluginEvent pluginEvent(true, NS_PLUGIN_INPUT_EVENT, mWidget);
   NPCocoaEvent cocoaEvent;
   ConvertCocoaKeyEventToNPCocoaEvent(aNativeKeyEvent, cocoaEvent);
   nsCocoaUtils::InitPluginEvent(pluginEvent, cocoaEvent);
   DispatchEvent(pluginEvent);
   if (Destroyed()) {
     return;
   }
 
@@ -3916,17 +3916,17 @@ PluginTextInputHandler::HandleKeyDownEve
 
       // Don't send key up events for key downs associated with compositions.
       mIgnoreNextKeyUpEvent = true;
     } else {
       // Reset complex text input request flag.
       mPluginComplexTextInputRequested = false;
 
       // Send key down event to the plugin.
-      nsPluginEvent pluginEvent(true, NS_PLUGIN_INPUT_EVENT, mWidget);
+      WidgetPluginEvent pluginEvent(true, NS_PLUGIN_INPUT_EVENT, mWidget);
       NPCocoaEvent cocoaEvent;
       ConvertCocoaKeyEventToNPCocoaEvent(aNativeKeyEvent, cocoaEvent);
       nsCocoaUtils::InitPluginEvent(pluginEvent, cocoaEvent);
       DispatchEvent(pluginEvent);
       if (Destroyed()) {
         return;
       }
 
@@ -4016,17 +4016,17 @@ PluginTextInputHandler::DispatchCocoaNPA
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   NPCocoaEvent cocoaTextEvent;
   nsCocoaUtils::InitNPCocoaEvent(&cocoaTextEvent);
   cocoaTextEvent.type = NPCocoaEventTextInput;
   cocoaTextEvent.data.text.text = (NPNSString*)aString;
 
-  nsPluginEvent pluginEvent(true, NS_PLUGIN_INPUT_EVENT, mWidget);
+  WidgetPluginEvent pluginEvent(true, NS_PLUGIN_INPUT_EVENT, mWidget);
   nsCocoaUtils::InitPluginEvent(pluginEvent, cocoaTextEvent);
   return DispatchEvent(pluginEvent);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
 }
 
 
 #pragma mark -
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -2929,17 +2929,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (void)updatePluginTopLevelWindowStatus:(BOOL)hasMain
 {
   if (!mGeckoChild)
     return;
 
-  nsPluginEvent pluginEvent(true, NS_PLUGIN_FOCUS_EVENT, mGeckoChild);
+  WidgetPluginEvent pluginEvent(true, NS_PLUGIN_FOCUS_EVENT, mGeckoChild);
   NPCocoaEvent cocoaEvent;
   nsCocoaUtils::InitNPCocoaEvent(&cocoaEvent);
   cocoaEvent.type = NPCocoaEventWindowFocusChanged;
   cocoaEvent.data.focus.hasFocus = hasMain;
   nsCocoaUtils::InitPluginEvent(pluginEvent, cocoaEvent);
   mGeckoChild->DispatchWindowEvent(pluginEvent);
 }
 
@@ -5321,17 +5321,17 @@ static int32_t RoundUp(double aDouble)
 {
   if (!mGeckoChild)
     return NO;
 
   if (![self shouldFocusPlugin:getFocus])
     return NO;
 
   if (mPluginEventModel == NPEventModelCocoa) {
-    nsPluginEvent pluginEvent(true, NS_PLUGIN_FOCUS_EVENT, mGeckoChild);
+    WidgetPluginEvent pluginEvent(true, NS_PLUGIN_FOCUS_EVENT, mGeckoChild);
     NPCocoaEvent cocoaEvent;
     nsCocoaUtils::InitNPCocoaEvent(&cocoaEvent);
     cocoaEvent.type = NPCocoaEventFocusChanged;
     cocoaEvent.data.focus.hasFocus = getFocus;
     nsCocoaUtils::InitPluginEvent(pluginEvent, cocoaEvent);
     mGeckoChild->DispatchWindowEvent(pluginEvent);
 
     if (getFocus)
--- a/widget/cocoa/nsCocoaUtils.h
+++ b/widget/cocoa/nsCocoaUtils.h
@@ -281,17 +281,17 @@ class nsCocoaUtils
   /**
    * Initializes aNPCocoaEvent.
    */
   static void InitNPCocoaEvent(NPCocoaEvent* aNPCocoaEvent);
 
   /**
    * Initializes aPluginEvent for aCocoaEvent.
    */
-  static void InitPluginEvent(nsPluginEvent &aPluginEvent,
+  static void InitPluginEvent(mozilla::WidgetPluginEvent &aPluginEvent,
                               NPCocoaEvent &aCocoaEvent);
   /**
    * Initializes nsInputEvent for aNativeEvent or aModifiers.
    */
   static void InitInputEvent(nsInputEvent &aInputEvent,
                              NSEvent* aNativeEvent);
   static void InitInputEvent(nsInputEvent &aInputEvent,
                              NSUInteger aModifiers);
--- a/widget/cocoa/nsCocoaUtils.mm
+++ b/widget/cocoa/nsCocoaUtils.mm
@@ -415,17 +415,17 @@ nsCocoaUtils::MakeNewCocoaEventWithType(
 void
 nsCocoaUtils::InitNPCocoaEvent(NPCocoaEvent* aNPCocoaEvent)
 {
   memset(aNPCocoaEvent, 0, sizeof(NPCocoaEvent));
 }
 
 // static
 void
-nsCocoaUtils::InitPluginEvent(nsPluginEvent &aPluginEvent,
+nsCocoaUtils::InitPluginEvent(WidgetPluginEvent &aPluginEvent,
                               NPCocoaEvent &aCocoaEvent)
 {
   aPluginEvent.time = PR_IntervalNow();
   aPluginEvent.pluginEvent = (void*)&aCocoaEvent;
   aPluginEvent.retargetToFocusedDocument = false;
 }
 
 // static
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -482,19 +482,19 @@ struct ParamTraits<nsIMEUpdatePreference
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
   {
     return ReadParam(aMsg, aIter, &aResult->mWantUpdates) &&
            ReadParam(aMsg, aIter, &aResult->mWantHints);
   }
 };
 
 template<>
-struct ParamTraits<nsPluginEvent>
+struct ParamTraits<mozilla::WidgetPluginEvent>
 {
-  typedef nsPluginEvent paramType;
+  typedef mozilla::WidgetPluginEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<nsGUIEvent>(aParam));
     WriteParam(aMsg, aParam.retargetToFocusedDocument);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
--- a/widget/windows/nsWindowBase.h
+++ b/widget/windows/nsWindowBase.h
@@ -58,17 +58,17 @@ public:
   /*
    * Default dispatch of a plugin event.
    */
   virtual bool DispatchPluginEvent(const MSG &aMsg)
   {
     if (!PluginHasFocus()) {
       return false;
     }
-    nsPluginEvent pluginEvent(true, NS_PLUGIN_INPUT_EVENT, this);
+    mozilla::WidgetPluginEvent pluginEvent(true, NS_PLUGIN_INPUT_EVENT, this);
     nsIntPoint point(0, 0);
     InitEvent(pluginEvent, &point);
     NPEvent npEvent;
     npEvent.event = aMsg.message;
     npEvent.wParam = aMsg.wParam;
     npEvent.lParam = aMsg.lParam;
     pluginEvent.pluginEvent = (void *)&npEvent;
     pluginEvent.retargetToFocusedDocument = true;