Bug 920377 part.21 Get rid of nsTextEvent r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 01 Oct 2013 16:22:59 +0900
changeset 164197 d04a5b8e1499d2d4a0bdac8d4f8ff4d3f6a71552
parent 164196 2e92ba62e3e6d3d171b8cb0d25ce9d6474aa9cf7
child 164198 d569f145443df13c10894dec9b0baa82560848b5
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.21 Get rid of nsTextEvent r=roc
content/events/src/TextComposition.cpp
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMTextEvent.cpp
content/events/src/nsDOMTextEvent.h
content/events/src/nsDOMUIEvent.cpp
content/events/src/nsEventDispatcher.cpp
content/events/src/nsEventStateManager.cpp
content/events/src/nsIMEStateManager.cpp
dom/base/CompositionStringSynthesizer.cpp
dom/interfaces/events/nsIDOMEvent.idl
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
dom/plugins/ipc/PPluginInstance.ipdl
widget/EventForwards.h
widget/TextEvents.h
widget/android/nsWindow.cpp
widget/cocoa/TextInputHandler.mm
widget/gtk/nsGtkIMModule.cpp
widget/gtk/nsWindow.cpp
widget/nsGUIEventIPC.h
widget/os2/nsWindow.cpp
widget/qt/mozqwidget.cpp
widget/qt/nsWindow.cpp
widget/windows/nsIMM32Handler.cpp
widget/windows/nsTextStore.cpp
widget/xpwidgets/PuppetWidget.cpp
--- a/content/events/src/TextComposition.cpp
+++ b/content/events/src/TextComposition.cpp
@@ -128,17 +128,17 @@ TextComposition::CompositionEventDispatc
     case NS_COMPOSITION_END: {
       nsCompositionEvent compEvent(true, mEventMessage, mWidget);
       compEvent.data = mData;
       nsIMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
                                                   &compEvent, &status, nullptr);
       break;
     }
     case NS_TEXT_TEXT: {
-      nsTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
+      WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
       textEvent.theText = mData;
       nsIMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
                                                   &textEvent, &status, nullptr);
       break;
     }
     default:
       MOZ_CRASH("Unsupported event");
   }
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -581,18 +581,18 @@ nsDOMEvent::DuplicatePrivateData()
       InternalScriptErrorEvent* scriptErrorEvent =
         new InternalScriptErrorEvent(false, msg);
       scriptErrorEvent->AssignScriptErrorEventData(*oldScriptErrorEvent, true);
       newEvent = scriptErrorEvent;
       break;
     }
     case NS_TEXT_EVENT:
     {
-      nsTextEvent* oldTextEvent = static_cast<nsTextEvent*>(mEvent);
-      nsTextEvent* textEvent = new nsTextEvent(false, msg, nullptr);
+      WidgetTextEvent* oldTextEvent = static_cast<WidgetTextEvent*>(mEvent);
+      WidgetTextEvent* textEvent = new WidgetTextEvent(false, msg, nullptr);
       textEvent->AssignTextEventData(*oldTextEvent, true);
       newEvent = textEvent;
       break;
     }
     case NS_COMPOSITION_EVENT:
     {
       nsCompositionEvent* compositionEvent =
         new nsCompositionEvent(false, msg, nullptr);
--- a/content/events/src/nsDOMTextEvent.cpp
+++ b/content/events/src/nsDOMTextEvent.cpp
@@ -4,36 +4,38 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsDOMTextEvent.h"
 #include "nsPrivateTextRange.h"
 #include "prtime.h"
 #include "mozilla/TextEvents.h"
 
+using namespace mozilla;
+
 nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
                                nsPresContext* aPresContext,
-                               nsTextEvent* aEvent)
+                               WidgetTextEvent* aEvent)
   : nsDOMUIEvent(aOwner, aPresContext,
-                 aEvent ? aEvent : new nsTextEvent(false, 0, nullptr))
+                 aEvent ? aEvent : new WidgetTextEvent(false, 0, nullptr))
 {
   NS_ASSERTION(mEvent->eventStructType == NS_TEXT_EVENT, "event type mismatch");
 
   if (aEvent) {
     mEventIsInternal = false;
   }
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
 
   //
   // extract the IME composition string
   //
-  nsTextEvent *te = static_cast<nsTextEvent*>(mEvent);
+  WidgetTextEvent *te = static_cast<WidgetTextEvent*>(mEvent);
   mText = te->theText;
 
   //
   // build the range list -- ranges need to be DOM-ified since the
   // IME transaction will hold a ref, the widget representation
   // isn't persistent
   //
   mTextRange = new nsPrivateTextRangeList(te->rangeCount);
@@ -71,13 +73,13 @@ NS_METHOD_(already_AddRefed<nsIPrivateTe
     return textRange.forget();
   }
   return nullptr;
 }
 
 nsresult NS_NewDOMTextEvent(nsIDOMEvent** aInstancePtrResult,
                             mozilla::dom::EventTarget* aOwner,
                             nsPresContext* aPresContext,
-                            nsTextEvent *aEvent)
+                            WidgetTextEvent* aEvent)
 {
   nsDOMTextEvent* it = new nsDOMTextEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(it, aInstancePtrResult);
 }
--- a/content/events/src/nsDOMTextEvent.h
+++ b/content/events/src/nsDOMTextEvent.h
@@ -12,17 +12,18 @@
 #include "nsIPrivateTextEvent.h"
 #include "nsPrivateTextRange.h"
 
 class nsDOMTextEvent : public nsDOMUIEvent,
                        public nsIPrivateTextEvent
 {
 public:
   nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
-                 nsPresContext* aPresContext, nsTextEvent* aEvent);
+                 nsPresContext* aPresContext,
+                 mozilla::WidgetTextEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Forward to base class
   NS_FORWARD_TO_NSDOMUIEVENT
 
   // nsIPrivateTextEvent interface
   NS_IMETHOD GetText(nsString& aText) MOZ_OVERRIDE;
--- a/content/events/src/nsDOMUIEvent.cpp
+++ b/content/events/src/nsDOMUIEvent.cpp
@@ -346,17 +346,17 @@ nsDOMUIEvent::GetIsChar(bool* aIsChar)
 bool
 nsDOMUIEvent::IsChar() const
 {
   switch (mEvent->eventStructType)
   {
     case NS_KEY_EVENT:
       return static_cast<WidgetKeyboardEvent*>(mEvent)->isChar;
     case NS_TEXT_EVENT:
-      return static_cast<nsTextEvent*>(mEvent)->isChar;
+      return static_cast<WidgetTextEvent*>(mEvent)->isChar;
     default:
       return false;
   }
   MOZ_CRASH("Switch handles all cases.");
 }
 
 NS_IMETHODIMP
 nsDOMUIEvent::DuplicatePrivateData()
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -720,17 +720,17 @@ nsEventDispatcher::CreateEvent(mozilla::
     case NS_WHEEL_EVENT:
       return NS_NewDOMWheelEvent(aDOMEvent, aOwner, aPresContext,
                                  static_cast<WheelEvent*>(aEvent));
     case NS_DRAG_EVENT:
       return NS_NewDOMDragEvent(aDOMEvent, aOwner, aPresContext,
                                  static_cast<nsDragEvent*>(aEvent));
     case NS_TEXT_EVENT:
       return NS_NewDOMTextEvent(aDOMEvent, aOwner, aPresContext,
-                                static_cast<nsTextEvent*>(aEvent));
+                                static_cast<WidgetTextEvent*>(aEvent));
     case NS_CLIPBOARD_EVENT:
       return NS_NewDOMClipboardEvent(aDOMEvent, aOwner, aPresContext,
                static_cast<InternalClipboardEvent*>(aEvent));
     case NS_SVGZOOM_EVENT:
       return NS_NewDOMSVGZoomEvent(aDOMEvent, aOwner, aPresContext,
                                    static_cast<nsGUIEvent*>(aEvent));
     case NS_SMIL_TIME_EVENT:
       return NS_NewDOMTimeEvent(aDOMEvent, aOwner, aPresContext, aEvent);
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -1079,17 +1079,17 @@ nsEventStateManager::PreHandleEvent(nsPr
   case NS_CONTENT_COMMAND_SCROLL:
     {
       DoContentCommandScrollEvent(
         static_cast<WidgetContentCommandEvent*>(aEvent));
     }
     break;
   case NS_TEXT_TEXT:
     {
-      nsTextEvent *textEvent = static_cast<nsTextEvent*>(aEvent);
+      WidgetTextEvent *textEvent = static_cast<WidgetTextEvent*>(aEvent);
       if (IsTargetCrossProcess(textEvent)) {
         // Will not be handled locally, remote the event
         if (GetCrossProcessTarget()->SendTextEvent(*textEvent)) {
           // Cancel local dispatching
           aEvent->mFlags.mPropagationStopped = true;
         }
       }
     }
--- a/content/events/src/nsIMEStateManager.cpp
+++ b/content/events/src/nsIMEStateManager.cpp
@@ -594,17 +594,17 @@ nsIMEStateManager::NotifyIME(Notificatio
   // NOTE: The dispatched events are discarded if it's not safe to run script.
   switch (aNotification) {
     case REQUEST_TO_COMMIT_COMPOSITION: {
       nsCOMPtr<nsIWidget> widget(aWidget);
       TextComposition backup = *composition;
 
       nsEventStatus status = nsEventStatus_eIgnore;
       if (!backup.GetLastData().IsEmpty()) {
-        nsTextEvent textEvent(true, NS_TEXT_TEXT, widget);
+        WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
         textEvent.theText = backup.GetLastData();
         textEvent.mFlags.mIsSynthesizedForTests = true;
         widget->DispatchEvent(&textEvent, status);
         if (widget->Destroyed()) {
           return NS_OK;
         }
       }
 
@@ -626,17 +626,17 @@ nsIMEStateManager::NotifyIME(Notificatio
         updateEvent.data = backup.GetLastData();
         updateEvent.mFlags.mIsSynthesizedForTests = true;
         widget->DispatchEvent(&updateEvent, status);
         if (widget->Destroyed()) {
           return NS_OK;
         }
 
         status = nsEventStatus_eIgnore;
-        nsTextEvent textEvent(true, NS_TEXT_TEXT, widget);
+        WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
         textEvent.theText = backup.GetLastData();
         textEvent.mFlags.mIsSynthesizedForTests = true;
         widget->DispatchEvent(&textEvent, status);
         if (widget->Destroyed()) {
           return NS_OK;
         }
       }
 
--- a/dom/base/CompositionStringSynthesizer.cpp
+++ b/dom/base/CompositionStringSynthesizer.cpp
@@ -129,17 +129,17 @@ CompositionStringSynthesizer::DispatchEv
     if (mCaret.mEndOffset > mString.Length()) {
       NS_WARNING("Caret position is out of the composition string");
       ClearInternal();
       return NS_ERROR_ILLEGAL_VALUE;
     }
     mClauses.AppendElement(mCaret);
   }
 
-  nsTextEvent textEvent(true, NS_TEXT_TEXT, widget);
+  WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
   textEvent.time = PR_IntervalNow();
   textEvent.theText = mString;
   textEvent.rangeCount = mClauses.Length();
   textEvent.rangeArray = mClauses.Elements();
 
   // XXX How should we set false for this on b2g?
   textEvent.mFlags.mIsSynthesizedForTests = true;
 
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -288,17 +288,17 @@ nsresult
 NS_NewDOMDeviceMotionEvent(nsIDOMEvent** aResult,
                            mozilla::dom::EventTarget* aOwner,
                            nsPresContext* aPresContext,
                            nsEvent* aEvent);
 nsresult
 NS_NewDOMTextEvent(nsIDOMEvent** aResult,
                    mozilla::dom::EventTarget* aOwner,
                    nsPresContext* aPresContext,
-                   nsTextEvent* aEvent);
+                   mozilla::WidgetTextEvent* aEvent);
 nsresult
 NS_NewDOMBeforeUnloadEvent(nsIDOMEvent** aResult,
                            mozilla::dom::EventTarget* aOwner,
                            nsPresContext* aPresContext,
                            nsEvent* aEvent);
 nsresult
 NS_NewDOMSVGEvent(nsIDOMEvent** aResult,
                   mozilla::dom::EventTarget* aOwner,
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -43,17 +43,17 @@ using nsIntRect;
 using nsIntSize;
 using mozilla::WidgetKeyboardEvent;
 using nsMouseEvent;
 using nsMouseScrollEvent;
 using mozilla::WheelEvent;
 using nsQueryContentEvent;
 using nsRect;
 using nsSelectionEvent;
-using nsTextEvent;
+using mozilla::WidgetTextEvent;
 using mozilla::WidgetTouchEvent;
 using RemoteDOMEvent;
 using mozilla::dom::ScreenOrientation;
 using mozilla::layers::TextureFactoryIdentifier;
 using mozilla::CSSIntPoint;
 using mozilla::CSSToScreenScale;
 namespace mozilla {
 namespace dom {
@@ -378,17 +378,17 @@ child:
     KeyEvent(nsString aType,
              int32_t aKeyCode,
              int32_t aCharCode,
              int32_t aModifiers,
              bool aPreventDefault);
 
     CompositionEvent(nsCompositionEvent event);
 
-    TextEvent(nsTextEvent event);
+    TextEvent(WidgetTextEvent event);
 
     SelectionEvent(nsSelectionEvent event);
 
     /**
      * Activate event forwarding from client to parent.
      */
     ActivateFrameEvent(nsString aType, bool capture);
 
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1885,21 +1885,21 @@ bool
 TabChild::RecvCompositionEvent(const nsCompositionEvent& event)
 {
   nsCompositionEvent localEvent(event);
   DispatchWidgetEvent(localEvent);
   return true;
 }
 
 bool
-TabChild::RecvTextEvent(const nsTextEvent& event)
+TabChild::RecvTextEvent(const WidgetTextEvent& event)
 {
-  nsTextEvent localEvent(event);
+  WidgetTextEvent localEvent(event);
   DispatchWidgetEvent(localEvent);
-  IPC::ParamTraits<nsTextEvent>::Free(event);
+  IPC::ParamTraits<WidgetTextEvent>::Free(event);
   return true;
 }
 
 bool
 TabChild::RecvSelectionEvent(const nsSelectionEvent& event)
 {
   nsSelectionEvent localEvent(event);
   DispatchWidgetEvent(localEvent);
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -221,17 +221,17 @@ public:
     virtual bool RecvRealTouchEvent(const WidgetTouchEvent& event);
     virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& event);
     virtual bool RecvKeyEvent(const nsString& aType,
                               const int32_t&  aKeyCode,
                               const int32_t&  aCharCode,
                               const int32_t&  aModifiers,
                               const bool&     aPreventDefault);
     virtual bool RecvCompositionEvent(const nsCompositionEvent& event);
-    virtual bool RecvTextEvent(const nsTextEvent& event);
+    virtual bool RecvTextEvent(const mozilla::WidgetTextEvent& event);
     virtual bool RecvSelectionEvent(const nsSelectionEvent& event);
     virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture);
     virtual bool RecvLoadRemoteScript(const nsString& aURL);
     virtual bool RecvAsyncMessage(const nsString& aMessage,
                                   const ClonedMessageData& aData,
                                   const InfallibleTArray<CpowEntry>& aCpows);
 
     virtual PDocumentRendererChild*
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1002,17 +1002,17 @@ TabParent::SendCompositionEvent(nsCompos
  * During REQUEST_TO_COMMIT_COMPOSITION or REQUEST_TO_CANCEL_COMPOSITION,
  * widget usually sends a NS_TEXT_TEXT event to finalize or clear the
  * composition, respectively
  *
  * Because the event will not reach content in time, we intercept it
  * here and pass the text as the EndIMEComposition return value
  */
 bool
-TabParent::SendTextEvent(nsTextEvent& event)
+TabParent::SendTextEvent(WidgetTextEvent& event)
 {
   if (mIsDestroyed) {
     return false;
   }
   if (mIMECompositionEnding) {
     mIMECompositionText = event.theText;
     return true;
   }
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -221,17 +221,17 @@ public:
     NS_DECL_NSIAUTHPROMPTPROVIDER
     NS_DECL_NSISECUREBROWSERUI
 
     void HandleDelayedDialogs();
 
     static TabParent *GetIMETabParent() { return mIMETabParent; }
     bool HandleQueryContentEvent(nsQueryContentEvent& aEvent);
     bool SendCompositionEvent(nsCompositionEvent& event);
-    bool SendTextEvent(nsTextEvent& event);
+    bool SendTextEvent(mozilla::WidgetTextEvent& event);
     bool SendSelectionEvent(nsSelectionEvent& event);
 
     static TabParent* GetFrom(nsFrameLoader* aFrameLoader);
     static TabParent* GetFrom(nsIContent* aContent);
 
     ContentParent* Manager() { return mManager; }
 
 protected:
--- a/dom/plugins/ipc/PPluginInstance.ipdl
+++ b/dom/plugins/ipc/PPluginInstance.ipdl
@@ -27,17 +27,16 @@ using mozilla::plugins::NativeWindowHand
 using gfxSurfaceType;
 using gfxIntSize;
 using mozilla::null_t;
 using mozilla::plugins::WindowsSharedMemoryHandle;
 using mozilla::plugins::DXGISharedSurfaceHandle;
 using mozilla::CrossProcessMutexHandle;
 using SurfaceDescriptorX11;
 using nsIntRect;
-using nsTextEvent;
 
 namespace mozilla {
 namespace plugins {
 
 struct IOSurfaceDescriptor {
   uint32_t surfaceId;
   double contentsScaleFactor;
 };
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -102,17 +102,16 @@ class WidgetPluginEvent;
 class InternalMutationEvent;
 } // namespace mozilla
 
 // TODO: Remove following typedefs
 typedef mozilla::WidgetEvent               nsEvent;
 typedef mozilla::WidgetGUIEvent            nsGUIEvent;
 typedef mozilla::WidgetInputEvent          nsInputEvent;
 typedef mozilla::InternalUIEvent           nsUIEvent;
-typedef mozilla::WidgetTextEvent           nsTextEvent;
 typedef mozilla::WidgetCompositionEvent    nsCompositionEvent;
 typedef mozilla::WidgetQueryContentEvent   nsQueryContentEvent;
 typedef mozilla::WidgetSelectionEvent      nsSelectionEvent;
 typedef mozilla::WidgetMouseEventBase      nsMouseEvent_base;
 typedef mozilla::WidgetMouseEvent          nsMouseEvent;
 typedef mozilla::WidgetDragEvent           nsDragEvent;
 typedef mozilla::WidgetMouseScrollEvent    nsMouseScrollEvent;
 
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -529,14 +529,13 @@ public:
   bool mExpandToClusterBoundary;
   // true if setting selection succeeded.
   bool mSucceeded;
 };
 
 } // namespace mozilla
 
 // TODO: Remove following typedefs
-typedef mozilla::WidgetTextEvent         nsTextEvent;
 typedef mozilla::WidgetCompositionEvent  nsCompositionEvent;
 typedef mozilla::WidgetQueryContentEvent nsQueryContentEvent;
 typedef mozilla::WidgetSelectionEvent    nsSelectionEvent;
 
 #endif // mozilla_TextEvents_h__
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -684,17 +684,17 @@ nsWindow::DispatchEvent(nsGUIEvent *aEve
             break;
         case NS_COMPOSITION_END:
             MOZ_ASSERT(mIMEComposing);
             mIMEComposing = false;
             mIMEComposingText.Truncate();
             break;
         case NS_TEXT_TEXT:
             MOZ_ASSERT(mIMEComposing);
-            mIMEComposingText = static_cast<nsTextEvent*>(aEvent)->theText;
+            mIMEComposingText = static_cast<WidgetTextEvent*>(aEvent)->theText;
             break;
         }
         return status;
     }
     return nsEventStatus_eIgnore;
 }
 
 NS_IMETHODIMP
@@ -1724,17 +1724,17 @@ nsWindow::OnKeyEvent(AndroidGeckoEvent *
     case AKEY_EVENT_ACTION_DOWN:
         msg = NS_KEY_DOWN;
         break;
     case AKEY_EVENT_ACTION_UP:
         msg = NS_KEY_UP;
         break;
     case AKEY_EVENT_ACTION_MULTIPLE:
         {
-            nsTextEvent event(true, NS_TEXT_TEXT, this);
+            WidgetTextEvent event(true, NS_TEXT_TEXT, this);
             event.theText.Assign(ae->Characters());
             DispatchEvent(&event);
         }
         return;
     default:
         ALOG("Unknown key action event!");
         return;
     }
@@ -1812,17 +1812,17 @@ nsWindow::RemoveIMEComposition()
     // Remove composition on Gecko side
     if (!mIMEComposing)
         return;
 
     nsRefPtr<nsWindow> kungFuDeathGrip(this);
     AutoIMEMask selMask(mIMEMaskSelectionUpdate);
     AutoIMEMask textMask(mIMEMaskTextUpdate);
 
-    nsTextEvent textEvent(true, NS_TEXT_TEXT, this);
+    WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this);
     InitEvent(textEvent, nullptr);
     textEvent.theText = mIMEComposingText;
     DispatchEvent(&textEvent);
 
     nsCompositionEvent event(true, NS_COMPOSITION_END, this);
     InitEvent(event, nullptr);
     DispatchEvent(&event);
 }
@@ -1923,17 +1923,17 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
             }
 
             {
                 nsCompositionEvent event(true, NS_COMPOSITION_START, this);
                 InitEvent(event, nullptr);
                 DispatchEvent(&event);
             }
             {
-                nsTextEvent event(true, NS_TEXT_TEXT, this);
+                WidgetTextEvent event(true, NS_TEXT_TEXT, this);
                 InitEvent(event, nullptr);
                 event.theText = ae->Characters();
                 DispatchEvent(&event);
             }
             {
                 nsCompositionEvent event(true, NS_COMPOSITION_END, this);
                 InitEvent(event, nullptr);
                 event.data = ae->Characters();
@@ -2008,17 +2008,17 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
 
                 Selection and text updates are masked so the result of
                   temporary events are not passed on to Java
             */
             AutoIMEMask selMask(mIMEMaskSelectionUpdate);
             AutoIMEMask textMask(mIMEMaskTextUpdate);
             RemoveIMEComposition();
 
-            nsTextEvent event(true, NS_TEXT_TEXT, this);
+            WidgetTextEvent event(true, NS_TEXT_TEXT, this);
             InitEvent(event, nullptr);
 
             event.rangeArray = mIMERanges.Elements();
             event.rangeCount = mIMERanges.Length();
 
             {
                 nsSelectionEvent event(true, NS_SELECTION_SET, this);
                 InitEvent(event, nullptr);
@@ -2122,17 +2122,17 @@ nsWindow::NotifyIME(NotificationToIME aN
             return NS_OK;
         case REQUEST_TO_CANCEL_COMPOSITION:
             ALOGIME("IME: REQUEST_TO_CANCEL_COMPOSITION");
 
             // Cancel composition on Gecko side
             if (mIMEComposing) {
                 nsRefPtr<nsWindow> kungFuDeathGrip(this);
 
-                nsTextEvent textEvent(true, NS_TEXT_TEXT, this);
+                WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this);
                 InitEvent(textEvent, nullptr);
                 DispatchEvent(&textEvent);
 
                 nsCompositionEvent compEvent(true, NS_COMPOSITION_END, this);
                 InitEvent(compEvent, nullptr);
                 DispatchEvent(&compEvent);
             }
 
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2624,17 +2624,17 @@ IMEInputHandler::DispatchTextEvent(const
      GetCharacters([aAttrString string]),
      aSelectedRange.location, aSelectedRange.length,
      TrueOrFalse(aDoCommit), TrueOrFalse(Destroyed())));
 
   NS_ENSURE_TRUE(!Destroyed(), false);
 
   nsRefPtr<IMEInputHandler> kungFuDeathGrip(this);
 
-  nsTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
+  WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
   textEvent.time = PR_IntervalNow();
   textEvent.theText = aText;
   nsAutoTArray<TextRange, 4> textRanges;
   if (!aDoCommit) {
     SetTextRangeList(textRanges, aAttrString, aSelectedRange);
   }
   textEvent.rangeArray = textRanges.Elements();
   textEvent.rangeCount = textRanges.Length();
--- a/widget/gtk/nsGtkIMModule.cpp
+++ b/widget/gtk/nsGtkIMModule.cpp
@@ -1080,17 +1080,17 @@ nsGtkIMModule::DispatchTextEvent(const n
                                                    mLastFocusedWindow);
         mLastFocusedWindow->DispatchEvent(&querySelectedTextEvent, status);
         if (querySelectedTextEvent.mSucceeded) {
             mSelectedString = querySelectedTextEvent.mReply.mString;
             mCompositionStart = querySelectedTextEvent.mReply.mOffset;
         }
     }
 
-    nsTextEvent textEvent(true, NS_TEXT_TEXT, mLastFocusedWindow);
+    WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mLastFocusedWindow);
     InitEvent(textEvent);
 
     uint32_t targetOffset = mCompositionStart;
 
     nsAutoTArray<TextRange, 4> textRanges;
     if (!aIsCommit) {
         // NOTE: SetTextRangeList() assumes that mDispatchedCompositionString
         //       has been updated already.
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -3034,17 +3034,17 @@ nsWindow::OnKeyPressEvent(GdkEventKey *a
     }
     else {
         // If the character code is in the BMP, send the key press event.
         // Otherwise, send a text event with the equivalent UTF-16 string.
         if (IS_IN_BMP(event.charCode)) {
             DispatchEvent(&event, status);
         }
         else {
-            nsTextEvent textEvent(true, NS_TEXT_TEXT, this);
+            WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this);
             PRUnichar textString[3];
             textString[0] = H_SURROGATE(event.charCode);
             textString[1] = L_SURROGATE(event.charCode);
             textString[2] = 0;
             textEvent.theText = textString;
             textEvent.time = event.time;
             DispatchEvent(&textEvent, status);
         }
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -332,19 +332,19 @@ struct ParamTraits<mozilla::TextRange>
     return ReadParam(aMsg, aIter, &aResult->mStartOffset) &&
            ReadParam(aMsg, aIter, &aResult->mEndOffset) &&
            ReadParam(aMsg, aIter, &aResult->mRangeType) &&
            ReadParam(aMsg, aIter, &aResult->mRangeStyle);
   }
 };
 
 template<>
-struct ParamTraits<nsTextEvent>
+struct ParamTraits<mozilla::WidgetTextEvent>
 {
-  typedef nsTextEvent paramType;
+  typedef mozilla::WidgetTextEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<nsGUIEvent>(aParam));
     WriteParam(aMsg, aParam.seqno);
     WriteParam(aMsg, aParam.theText);
     WriteParam(aMsg, aParam.isChar);
     WriteParam(aMsg, aParam.rangeCount);
--- a/widget/os2/nsWindow.cpp
+++ b/widget/os2/nsWindow.cpp
@@ -2491,17 +2491,17 @@ bool nsWindow::ImeResultString(HIMI himi
   if (mLastDispatchedCompositionString != compositionString) {
     nsCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
     InitEvent(update);
     update.data = compositionString;
     mLastDispatchedCompositionString = compositionString;
     DispatchWindowEvent(&update);
   }
 
-  nsTextEvent text(true, NS_TEXT_TEXT, this);
+  WidgetTextEvent text(true, NS_TEXT_TEXT, this);
   InitEvent(text);
   text.theText = compositionString;
   DispatchWindowEvent(&text);
 
   nsCompositionEvent end(true, NS_COMPOSITION_END, this);
   InitEvent(end);
   end.data = compositionString;
   DispatchWindowEvent(&end);
@@ -2659,17 +2659,17 @@ bool nsWindow::ImeConversionString(HIMI 
     }
 
     if (ulCursorPos != NO_IME_CARET) {
       newRange.mStartOffset = newRange.mEndOffset = ulCursorPos;
       newRange.mRangeType = NS_TEXTRANGE_CARETPOSITION;
       textRanges.AppendElement(newRange);
     }
   }
-  nsTextEvent text(true, NS_TEXT_TEXT, this);
+  WidgetTextEvent text(true, NS_TEXT_TEXT, this);
   InitEvent(text);
   text.theText = compositionString;
   text.rangeArray = textRanges.Elements();
   text.rangeCount = textRanges.Length();
   DispatchWindowEvent(&text);
 
   if (compositionString.IsEmpty()) { // IME conversion was canceled ?
     nsCompositionEvent end(true, NS_COMPOSITION_END, this);
--- a/widget/qt/mozqwidget.cpp
+++ b/widget/qt/mozqwidget.cpp
@@ -292,17 +292,17 @@ void MozQWidget::sendPressReleaseKeyEven
         modifiers = Qt::ShiftModifier;
     }
 
     if (letter) {
         // Handle as TextEvent
         nsCompositionEvent start(true, NS_COMPOSITION_START, mReceiver);
         mReceiver->DispatchEvent(&start);
 
-        nsTextEvent text(true, NS_TEXT_TEXT, mReceiver);
+        mozilla::WidgetTextEvent text(true, NS_TEXT_TEXT, mReceiver);
         QString commitString = QString(*letter);
         text.theText.Assign(commitString.utf16());
         mReceiver->DispatchEvent(&text);
 
         nsCompositionEvent end(true, NS_COMPOSITION_END, mReceiver);
         mReceiver->DispatchEvent(&end);
         return;
     }
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -2769,17 +2769,17 @@ nsWindow::imComposeEvent(QInputMethodEve
     nsAutoString compositionStr(event->commitString().utf16());
 
     if (!compositionStr.IsEmpty()) {
       nsCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
       update.data = compositionStr;
       DispatchEvent(&update);
     }
 
-    nsTextEvent text(true, NS_TEXT_TEXT, this);
+    WidgetTextEvent text(true, NS_TEXT_TEXT, this);
     text.theText = compositionStr;
     DispatchEvent(&text);
 
     nsCompositionEvent end(true, NS_COMPOSITION_END, this);
     end.data = compositionStr;
     DispatchEvent(&end);
 
     return nsEventStatus_eIgnore;
--- a/widget/windows/nsIMM32Handler.cpp
+++ b/widget/windows/nsIMM32Handler.cpp
@@ -1578,17 +1578,17 @@ nsIMM32Handler::DispatchTextEvent(nsWind
     aWindow->DispatchWindowEvent(&compositionUpdate);
 
     if (!mIsComposing || aWindow->Destroyed()) {
       return;
     }
     SetIMERelatedWindowsPos(aWindow, aIMEContext);
   }
 
-  nsTextEvent event(true, NS_TEXT_TEXT, aWindow);
+  WidgetTextEvent event(true, NS_TEXT_TEXT, aWindow);
 
   aWindow->InitEvent(event, &point);
 
   nsAutoTArray<TextRange, 4> textRanges;
 
   if (aCheckAttr) {
     SetTextRangeList(textRanges);
   }
--- a/widget/windows/nsTextStore.cpp
+++ b/widget/windows/nsTextStore.cpp
@@ -936,17 +936,17 @@ nsTextStore::FlushPendingActions()
           }
         }
 
         MOZ_ASSERT(action.mData == mComposition.mLastData);
 
         PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
                ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
                 "dispatching text event...", this));
-        nsTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
+        WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
         mWidget->InitEvent(textEvent);
         textEvent.theText = mComposition.mLastData;
         if (action.mRanges.IsEmpty()) {
           TextRange wholeRange;
           wholeRange.mStartOffset = 0;
           wholeRange.mEndOffset = textEvent.theText.Length();
           wholeRange.mRangeType = NS_TEXTRANGE_RAWINPUT;
           action.mRanges.AppendElement(wholeRange);
@@ -982,17 +982,17 @@ nsTextStore::FlushPendingActions()
           }
         }
 
         MOZ_ASSERT(action.mData == mComposition.mLastData);
 
         PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
                ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
                 "dispatching text event...", this));
-        nsTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
+        WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
         mWidget->InitEvent(textEvent);
         textEvent.theText = mComposition.mLastData;
         mWidget->DispatchWindowEvent(&textEvent);
         if (!mWidget || mWidget->Destroyed()) {
           break;
         }
 
         PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -275,17 +275,17 @@ PuppetWidget::DispatchEvent(nsGUIEvent* 
   }
   switch (event->eventStructType) {
   case NS_COMPOSITION_EVENT:
     mIMELastReceivedSeqno = static_cast<nsCompositionEvent*>(event)->seqno;
     if (mIMELastReceivedSeqno < mIMELastBlurSeqno)
       return NS_OK;
     break;
   case NS_TEXT_EVENT:
-    mIMELastReceivedSeqno = static_cast<nsTextEvent*>(event)->seqno;
+    mIMELastReceivedSeqno = static_cast<WidgetTextEvent*>(event)->seqno;
     if (mIMELastReceivedSeqno < mIMELastBlurSeqno)
       return NS_OK;
     break;
   case NS_SELECTION_EVENT:
     mIMELastReceivedSeqno = static_cast<nsSelectionEvent*>(event)->seqno;
     if (mIMELastReceivedSeqno < mIMELastBlurSeqno)
       return NS_OK;
     break;
@@ -342,17 +342,17 @@ PuppetWidget::GetThebesSurface()
 nsresult
 PuppetWidget::IMEEndComposition(bool aCancel)
 {
 #ifndef MOZ_CROSS_PROCESS_IME
   return NS_OK;
 #endif
 
   nsEventStatus status;
-  nsTextEvent textEvent(true, NS_TEXT_TEXT, this);
+  WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this);
   InitEvent(textEvent, nullptr);
   textEvent.seqno = mIMELastReceivedSeqno;
   // SendEndIMEComposition is always called since ResetInputState
   // should always be called even if we aren't composing something.
   if (!mTabChild ||
       !mTabChild->SendEndIMEComposition(aCancel, &textEvent.theText)) {
     return NS_ERROR_FAILURE;
   }