Bug 920377 part.22 Get rid of nsCompositionEvent r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 01 Oct 2013 16:23:00 +0900
changeset 163246 d569f145443df13c10894dec9b0baa82560848b5
parent 163245 d04a5b8e1499d2d4a0bdac8d4f8ff4d3f6a71552
child 163247 d0b1a13f856d40b5e75505210d57151f8565d203
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [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.22 Get rid of nsCompositionEvent r=roc
content/events/src/TextComposition.cpp
content/events/src/nsDOMCompositionEvent.cpp
content/events/src/nsDOMCompositionEvent.h
content/events/src/nsDOMEvent.cpp
content/events/src/nsEventDispatcher.cpp
content/events/src/nsEventStateManager.cpp
content/events/src/nsIMEStateManager.cpp
dom/base/nsDOMWindowUtils.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
widget/EventForwards.h
widget/TextEvents.h
widget/android/nsWindow.cpp
widget/cocoa/TextInputHandler.h
widget/cocoa/TextInputHandler.mm
widget/gtk/nsGtkIMModule.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
@@ -46,17 +46,17 @@ TextComposition::MatchesNativeContext(ns
 }
 
 void
 TextComposition::DispatchEvent(nsGUIEvent* aEvent,
                                nsEventStatus* aStatus,
                                nsDispatchingCallback* aCallBack)
 {
   if (aEvent->message == NS_COMPOSITION_UPDATE) {
-    mLastData = static_cast<nsCompositionEvent*>(aEvent)->data;
+    mLastData = static_cast<WidgetCompositionEvent*>(aEvent)->data;
   }
 
   nsEventDispatcher::Dispatch(mNode, mPresContext,
                               aEvent, nullptr, aStatus, aCallBack);
 }
 
 void
 TextComposition::DispatchCompsotionEventRunnable(uint32_t aEventMessage,
@@ -109,29 +109,29 @@ TextComposition::CompositionEventDispatc
   if (!mPresContext->GetPresShell() ||
       mPresContext->GetPresShell()->IsDestroying()) {
     return NS_OK; // cannot dispatch any events anymore
   }
 
   nsEventStatus status = nsEventStatus_eIgnore;
   switch (mEventMessage) {
     case NS_COMPOSITION_START: {
-      nsCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
+      WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
       nsQueryContentEvent selectedText(true, NS_QUERY_SELECTED_TEXT, mWidget);
       nsContentEventHandler handler(mPresContext);
       handler.OnQuerySelectedText(&selectedText);
       NS_ASSERTION(selectedText.mSucceeded, "Failed to get selected text");
       compStart.data = selectedText.mReply.mString;
       nsIMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
                                                   &compStart, &status, nullptr);
       break;
     }
     case NS_COMPOSITION_UPDATE:
     case NS_COMPOSITION_END: {
-      nsCompositionEvent compEvent(true, mEventMessage, mWidget);
+      WidgetCompositionEvent compEvent(true, mEventMessage, mWidget);
       compEvent.data = mData;
       nsIMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
                                                   &compEvent, &status, nullptr);
       break;
     }
     case NS_TEXT_TEXT: {
       WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
       textEvent.theText = mData;
--- a/content/events/src/nsDOMCompositionEvent.cpp
+++ b/content/events/src/nsDOMCompositionEvent.cpp
@@ -3,45 +3,47 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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 "nsDOMCompositionEvent.h"
 #include "prtime.h"
 #include "mozilla/TextEvents.h"
 
+using namespace mozilla;
+
 nsDOMCompositionEvent::nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
                                              nsPresContext* aPresContext,
-                                             nsCompositionEvent* aEvent)
+                                             WidgetCompositionEvent* aEvent)
   : nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
-                 new nsCompositionEvent(false, 0, nullptr))
+                 new WidgetCompositionEvent(false, 0, nullptr))
 {
   NS_ASSERTION(mEvent->eventStructType == NS_COMPOSITION_EVENT,
                "event type mismatch");
 
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
 
     // XXX compositionstart is cancelable in draft of DOM3 Events.
     //     However, it doesn't make sence for us, we cannot cancel composition
     //     when we sends compositionstart event.
     mEvent->mFlags.mCancelable = false;
   }
 
-  mData = static_cast<nsCompositionEvent*>(mEvent)->data;
+  mData = static_cast<WidgetCompositionEvent*>(mEvent)->data;
   // TODO: Native event should have locale information.
 }
 
 nsDOMCompositionEvent::~nsDOMCompositionEvent()
 {
   if (mEventIsInternal) {
-    delete static_cast<nsCompositionEvent*>(mEvent);
+    delete static_cast<WidgetCompositionEvent*>(mEvent);
     mEvent = nullptr;
   }
 }
 
 NS_IMPL_ADDREF_INHERITED(nsDOMCompositionEvent, nsDOMUIEvent)
 NS_IMPL_RELEASE_INHERITED(nsDOMCompositionEvent, nsDOMUIEvent)
 
 NS_INTERFACE_MAP_BEGIN(nsDOMCompositionEvent)
@@ -78,14 +80,14 @@ nsDOMCompositionEvent::InitCompositionEv
   mLocale = aLocale;
   return NS_OK;
 }
 
 nsresult
 NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult,
                           mozilla::dom::EventTarget* aOwner,
                           nsPresContext* aPresContext,
-                          nsCompositionEvent *aEvent)
+                          WidgetCompositionEvent* aEvent)
 {
   nsDOMCompositionEvent* event =
     new nsDOMCompositionEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(event, aInstancePtrResult);
 }
--- a/content/events/src/nsDOMCompositionEvent.h
+++ b/content/events/src/nsDOMCompositionEvent.h
@@ -13,17 +13,17 @@
 #include "mozilla/TextEvents.h"
 
 class nsDOMCompositionEvent : public nsDOMUIEvent,
                               public nsIDOMCompositionEvent
 {
 public:
   nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
                         nsPresContext* aPresContext,
-                        nsCompositionEvent* aEvent);
+                        mozilla::WidgetCompositionEvent* aEvent);
   virtual ~nsDOMCompositionEvent();
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_FORWARD_TO_NSDOMUIEVENT
   NS_DECL_NSIDOMCOMPOSITIONEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -589,20 +589,20 @@ nsDOMEvent::DuplicatePrivateData()
       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);
-      nsCompositionEvent* oldCompositionEvent =
-        static_cast<nsCompositionEvent*>(mEvent);
+      WidgetCompositionEvent* compositionEvent =
+        new WidgetCompositionEvent(false, msg, nullptr);
+      WidgetCompositionEvent* oldCompositionEvent =
+        static_cast<WidgetCompositionEvent*>(mEvent);
       compositionEvent->AssignCompositionEventData(*oldCompositionEvent, true);
       newEvent = compositionEvent;
       break;
     }
     case NS_MOUSE_SCROLL_EVENT:
     {
       nsMouseScrollEvent* oldMouseScrollEvent =
         static_cast<nsMouseScrollEvent*>(mEvent);
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -702,17 +702,17 @@ nsEventDispatcher::CreateEvent(mozilla::
       return NS_NewDOMScrollAreaEvent(aDOMEvent, aOwner, aPresContext,
                static_cast<InternalScrollAreaEvent*>(aEvent));
     case NS_KEY_EVENT:
       return NS_NewDOMKeyboardEvent(aDOMEvent, aOwner, aPresContext,
                                     static_cast<WidgetKeyboardEvent*>(aEvent));
     case NS_COMPOSITION_EVENT:
       return NS_NewDOMCompositionEvent(
         aDOMEvent, aOwner,
-        aPresContext, static_cast<nsCompositionEvent*>(aEvent));
+        aPresContext, static_cast<WidgetCompositionEvent*>(aEvent));
     case NS_MOUSE_EVENT:
       return NS_NewDOMMouseEvent(aDOMEvent, aOwner, aPresContext,
                                  static_cast<nsInputEvent*>(aEvent));
     case NS_FOCUS_EVENT:
       return NS_NewDOMFocusEvent(aDOMEvent, aOwner, aPresContext,
                                  static_cast<InternalFocusEvent*>(aEvent));
     case NS_MOUSE_SCROLL_EVENT:
       return NS_NewDOMMouseScrollEvent(aDOMEvent, aOwner, aPresContext,
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -1093,30 +1093,30 @@ nsEventStateManager::PreHandleEvent(nsPr
         }
       }
     }
     break;
   case NS_COMPOSITION_START:
     if (aEvent->mFlags.mIsTrusted) {
       // If the event is trusted event, set the selected text to data of
       // composition event.
-      nsCompositionEvent *compositionEvent =
-        static_cast<nsCompositionEvent*>(aEvent);
+      WidgetCompositionEvent *compositionEvent =
+        static_cast<WidgetCompositionEvent*>(aEvent);
       nsQueryContentEvent selectedText(true, NS_QUERY_SELECTED_TEXT,
                                        compositionEvent->widget);
       DoQuerySelectedText(&selectedText);
       NS_ASSERTION(selectedText.mSucceeded, "Failed to get selected text");
       compositionEvent->data = selectedText.mReply.mString;
     }
     // through to compositionend handling
   case NS_COMPOSITION_UPDATE:
   case NS_COMPOSITION_END:
     {
-      nsCompositionEvent *compositionEvent =
-          static_cast<nsCompositionEvent*>(aEvent);
+      WidgetCompositionEvent *compositionEvent =
+          static_cast<WidgetCompositionEvent*>(aEvent);
       if (IsTargetCrossProcess(compositionEvent)) {
         // Will not be handled locally, remote the event
         if (GetCrossProcessTarget()->SendCompositionEvent(*compositionEvent)) {
           // Cancel local dispatching
           aEvent->mFlags.mPropagationStopped = true;
         }
       }
     }
--- a/content/events/src/nsIMEStateManager.cpp
+++ b/content/events/src/nsIMEStateManager.cpp
@@ -604,30 +604,30 @@ nsIMEStateManager::NotifyIME(Notificatio
         textEvent.mFlags.mIsSynthesizedForTests = true;
         widget->DispatchEvent(&textEvent, status);
         if (widget->Destroyed()) {
           return NS_OK;
         }
       }
 
       status = nsEventStatus_eIgnore;
-      nsCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
+      WidgetCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
       endEvent.data = backup.GetLastData();
       endEvent.mFlags.mIsSynthesizedForTests = true;
       widget->DispatchEvent(&endEvent, status);
 
       return NS_OK;
     }
     case REQUEST_TO_CANCEL_COMPOSITION: {
       nsCOMPtr<nsIWidget> widget(aWidget);
       TextComposition backup = *composition;
 
       nsEventStatus status = nsEventStatus_eIgnore;
       if (!backup.GetLastData().IsEmpty()) {
-        nsCompositionEvent updateEvent(true, NS_COMPOSITION_UPDATE, widget);
+        WidgetCompositionEvent updateEvent(true, NS_COMPOSITION_UPDATE, widget);
         updateEvent.data = backup.GetLastData();
         updateEvent.mFlags.mIsSynthesizedForTests = true;
         widget->DispatchEvent(&updateEvent, status);
         if (widget->Destroyed()) {
           return NS_OK;
         }
 
         status = nsEventStatus_eIgnore;
@@ -636,17 +636,17 @@ nsIMEStateManager::NotifyIME(Notificatio
         textEvent.mFlags.mIsSynthesizedForTests = true;
         widget->DispatchEvent(&textEvent, status);
         if (widget->Destroyed()) {
           return NS_OK;
         }
       }
 
       status = nsEventStatus_eIgnore;
-      nsCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
+      WidgetCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
       endEvent.data = backup.GetLastData();
       endEvent.mFlags.mIsSynthesizedForTests = true;
       widget->DispatchEvent(&endEvent, status);
 
       return NS_OK;
     }
     default:
       return NS_OK;
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1819,17 +1819,17 @@ nsDOMWindowUtils::SendCompositionEvent(c
   } else if (aType.EqualsLiteral("compositionend")) {
     msg = NS_COMPOSITION_END;
   } else if (aType.EqualsLiteral("compositionupdate")) {
     msg = NS_COMPOSITION_UPDATE;
   } else {
     return NS_ERROR_FAILURE;
   }
 
-  nsCompositionEvent compositionEvent(true, msg, widget);
+  WidgetCompositionEvent compositionEvent(true, msg, widget);
   InitEvent(compositionEvent);
   if (msg != NS_COMPOSITION_START) {
     compositionEvent.data = aData;
   }
 
   compositionEvent.mFlags.mIsSynthesizedForTests = true;
 
   nsEventStatus status;
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -273,17 +273,17 @@ nsresult
 NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult,
                        mozilla::dom::EventTarget* aOwner,
                        nsPresContext* aPresContext,
                        mozilla::WidgetKeyboardEvent* aEvent);
 nsresult
 NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult,
                           mozilla::dom::EventTarget* aOwner,
                           nsPresContext* aPresContext,
-                          nsCompositionEvent* aEvent);
+                          mozilla::WidgetCompositionEvent* aEvent);
 nsresult
 NS_NewDOMMutationEvent(nsIDOMEvent** aResult,
                        mozilla::dom::EventTarget* aOwner,
                        nsPresContext* aPresContext,
                        mozilla::InternalMutationEvent* aEvent);
 nsresult
 NS_NewDOMDeviceMotionEvent(nsIDOMEvent** aResult,
                            mozilla::dom::EventTarget* aOwner,
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -31,17 +31,17 @@ using gfxMatrix;
 using gfxSize;
 using CSSRect;
 using mozilla::layers::FrameMetrics;
 using FrameMetrics::ViewID;
 using mozilla::layout::ScrollingBehavior;
 using mozilla::void_t;
 using mozilla::WindowsHandle;
 using nscolor;
-using nsCompositionEvent;
+using mozilla::WidgetCompositionEvent;
 using nsIMEUpdatePreference;
 using nsIntPoint;
 using nsIntRect;
 using nsIntSize;
 using mozilla::WidgetKeyboardEvent;
 using nsMouseEvent;
 using nsMouseScrollEvent;
 using mozilla::WheelEvent;
@@ -376,17 +376,17 @@ child:
      * @see nsIDOMWindowUtils sendKeyEvent.
      */
     KeyEvent(nsString aType,
              int32_t aKeyCode,
              int32_t aCharCode,
              int32_t aModifiers,
              bool aPreventDefault);
 
-    CompositionEvent(nsCompositionEvent event);
+    CompositionEvent(WidgetCompositionEvent event);
 
     TextEvent(WidgetTextEvent event);
 
     SelectionEvent(nsSelectionEvent event);
 
     /**
      * Activate event forwarding from client to parent.
      */
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1877,19 +1877,19 @@ TabChild::RecvKeyEvent(const nsString& a
   NS_ENSURE_TRUE(utils, true);
   bool ignored = false;
   utils->SendKeyEvent(aType, aKeyCode, aCharCode,
                       aModifiers, aPreventDefault, &ignored);
   return true;
 }
 
 bool
-TabChild::RecvCompositionEvent(const nsCompositionEvent& event)
+TabChild::RecvCompositionEvent(const WidgetCompositionEvent& event)
 {
-  nsCompositionEvent localEvent(event);
+  WidgetCompositionEvent localEvent(event);
   DispatchWidgetEvent(localEvent);
   return true;
 }
 
 bool
 TabChild::RecvTextEvent(const WidgetTextEvent& event)
 {
   WidgetTextEvent localEvent(event);
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -220,17 +220,17 @@ public:
     virtual bool RecvMouseWheelEvent(const mozilla::WheelEvent& event);
     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 RecvCompositionEvent(const mozilla::WidgetCompositionEvent& 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);
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -980,17 +980,17 @@ TabParent::HandleQueryContentEvent(nsQue
       aEvent.mSucceeded = true;
     }
     break;
   }
   return true;
 }
 
 bool
-TabParent::SendCompositionEvent(nsCompositionEvent& event)
+TabParent::SendCompositionEvent(WidgetCompositionEvent& event)
 {
   if (mIsDestroyed) {
     return false;
   }
   mIMEComposing = event.message != NS_COMPOSITION_END;
   mIMECompositionStart = std::min(mIMESelectionAnchor, mIMESelectionFocus);
   if (mIMECompositionEnding)
     return true;
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -220,17 +220,17 @@ public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIAUTHPROMPTPROVIDER
     NS_DECL_NSISECUREBROWSERUI
 
     void HandleDelayedDialogs();
 
     static TabParent *GetIMETabParent() { return mIMETabParent; }
     bool HandleQueryContentEvent(nsQueryContentEvent& aEvent);
-    bool SendCompositionEvent(nsCompositionEvent& event);
+    bool SendCompositionEvent(mozilla::WidgetCompositionEvent& event);
     bool SendTextEvent(mozilla::WidgetTextEvent& event);
     bool SendSelectionEvent(nsSelectionEvent& event);
 
     static TabParent* GetFrom(nsFrameLoader* aFrameLoader);
     static TabParent* GetFrom(nsIContent* aContent);
 
     ContentParent* Manager() { return mManager; }
 
--- 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::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;
 
 namespace mozilla {
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -529,13 +529,12 @@ public:
   bool mExpandToClusterBoundary;
   // true if setting selection succeeded.
   bool mSucceeded;
 };
 
 } // namespace mozilla
 
 // TODO: Remove following typedefs
-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
@@ -1817,17 +1817,17 @@ nsWindow::RemoveIMEComposition()
     AutoIMEMask selMask(mIMEMaskSelectionUpdate);
     AutoIMEMask textMask(mIMEMaskTextUpdate);
 
     WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this);
     InitEvent(textEvent, nullptr);
     textEvent.theText = mIMEComposingText;
     DispatchEvent(&textEvent);
 
-    nsCompositionEvent event(true, NS_COMPOSITION_END, this);
+    WidgetCompositionEvent event(true, NS_COMPOSITION_END, this);
     InitEvent(event, nullptr);
     DispatchEvent(&event);
 }
 
 void
 nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
 {
     MOZ_ASSERT(!mIMEMaskTextUpdate);
@@ -1918,28 +1918,28 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
                 }
                 mIMEKeyEvents.Clear();
                 FlushIMEChanges();
                 AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
                 break;
             }
 
             {
-                nsCompositionEvent event(true, NS_COMPOSITION_START, this);
+                WidgetCompositionEvent event(true, NS_COMPOSITION_START, this);
                 InitEvent(event, nullptr);
                 DispatchEvent(&event);
             }
             {
                 WidgetTextEvent event(true, NS_TEXT_TEXT, this);
                 InitEvent(event, nullptr);
                 event.theText = ae->Characters();
                 DispatchEvent(&event);
             }
             {
-                nsCompositionEvent event(true, NS_COMPOSITION_END, this);
+                WidgetCompositionEvent event(true, NS_COMPOSITION_END, this);
                 InitEvent(event, nullptr);
                 event.data = ae->Characters();
                 DispatchEvent(&event);
             }
             FlushIMEChanges();
             AndroidBridge::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT);
         }
         break;
@@ -2031,26 +2031,26 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *
                 nsQueryContentEvent queryEvent(true,
                         NS_QUERY_SELECTED_TEXT, this);
                 InitEvent(queryEvent, nullptr);
                 DispatchEvent(&queryEvent);
                 MOZ_ASSERT(queryEvent.mSucceeded && !queryEvent.mWasAsync);
                 event.theText = queryEvent.mReply.mString;
             }
             {
-                nsCompositionEvent event(true, NS_COMPOSITION_START, this);
+                WidgetCompositionEvent event(true, NS_COMPOSITION_START, this);
                 InitEvent(event, nullptr);
                 DispatchEvent(&event);
             }
 
             if (mIMEComposing &&
                 event.theText != mIMEComposingText) {
-                nsCompositionEvent compositionUpdate(true,
-                                                     NS_COMPOSITION_UPDATE,
-                                                     this);
+                WidgetCompositionEvent compositionUpdate(true,
+                                                         NS_COMPOSITION_UPDATE,
+                                                         this);
                 InitEvent(compositionUpdate, nullptr);
                 compositionUpdate.data = event.theText;
                 DispatchEvent(&compositionUpdate);
                 if (Destroyed())
                     return;
             }
 
 #ifdef DEBUG_ANDROID_IME
@@ -2126,17 +2126,18 @@ nsWindow::NotifyIME(NotificationToIME aN
             // Cancel composition on Gecko side
             if (mIMEComposing) {
                 nsRefPtr<nsWindow> kungFuDeathGrip(this);
 
                 WidgetTextEvent textEvent(true, NS_TEXT_TEXT, this);
                 InitEvent(textEvent, nullptr);
                 DispatchEvent(&textEvent);
 
-                nsCompositionEvent compEvent(true, NS_COMPOSITION_END, this);
+                WidgetCompositionEvent compEvent(true, NS_COMPOSITION_END,
+                                                 this);
                 InitEvent(compEvent, nullptr);
                 DispatchEvent(&compEvent);
             }
 
             AndroidBridge::NotifyIME(REQUEST_TO_CANCEL_COMPOSITION);
             return NS_OK;
         case NOTIFY_IME_OF_FOCUS:
             ALOGIME("IME: NOTIFY_IME_OF_FOCUS");
--- a/widget/cocoa/TextInputHandler.h
+++ b/widget/cocoa/TextInputHandler.h
@@ -1076,17 +1076,17 @@ private:
                         NSRange& aSelectedRange);
 
   /**
    * InitCompositionEvent() initializes aCompositionEvent.
    *
    * @param aCompositionEvent     A composition event which you want to
    *                              initialize.
    */
-  void InitCompositionEvent(nsCompositionEvent& aCompositionEvent);
+  void InitCompositionEvent(WidgetCompositionEvent& aCompositionEvent);
 
   /**
    * When a composition starts, OnStartIMEComposition() is called.
    */
   void OnStartIMEComposition();
 
   /**
    * When a composition is updated, OnUpdateIMEComposition() is called.
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -2635,18 +2635,18 @@ IMEInputHandler::DispatchTextEvent(const
   nsAutoTArray<TextRange, 4> textRanges;
   if (!aDoCommit) {
     SetTextRangeList(textRanges, aAttrString, aSelectedRange);
   }
   textEvent.rangeArray = textRanges.Elements();
   textEvent.rangeCount = textRanges.Length();
 
   if (textEvent.theText != mLastDispatchedCompositionString) {
-    nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
-                                         mWidget);
+    WidgetCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
+                                             mWidget);
     compositionUpdate.time = textEvent.time;
     compositionUpdate.data = textEvent.theText;
     mLastDispatchedCompositionString = textEvent.theText;
     DispatchEvent(compositionUpdate);
     if (mIsInFocusProcessing || Destroyed()) {
       PR_LOG(gLog, PR_LOG_ALWAYS,
         ("%p IMEInputHandler::DispatchTextEvent, compositionupdate causes "
          "aborting the composition, mIsInFocusProcessing=%s, Destryoed()=%s",
@@ -2656,17 +2656,17 @@ IMEInputHandler::DispatchTextEvent(const
       }
     }
   }
 
   return DispatchEvent(textEvent);
 }
 
 void
-IMEInputHandler::InitCompositionEvent(nsCompositionEvent& aCompositionEvent)
+IMEInputHandler::InitCompositionEvent(WidgetCompositionEvent& aCompositionEvent)
 {
   aCompositionEvent.time = PR_IntervalNow();
 }
 
 void
 IMEInputHandler::InsertTextAsCommittingComposition(
                    NSAttributedString* aAttrString,
                    NSRange* aReplacementRange)
@@ -2722,17 +2722,17 @@ IMEInputHandler::InsertTextAsCommittingC
     // range as selection.
     if (aReplacementRange && aReplacementRange->location != NSNotFound &&
         !NSEqualRanges(SelectedRange(), *aReplacementRange)) {
       NS_ENSURE_TRUE_VOID(SetSelection(*aReplacementRange));
     }
 
     // XXXmnakano Probably, we shouldn't emulate composition in this case.
     // I think that we should just fire DOM3 textInput event if we implement it.
-    nsCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
+    WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
     InitCompositionEvent(compStart);
 
     DispatchEvent(compStart);
     if (Destroyed()) {
       PR_LOG(gLog, PR_LOG_ALWAYS,
         ("%p IMEInputHandler::InsertTextAsCommittingComposition, "
          "destroyed by compositionstart event", this));
       return;
@@ -2747,17 +2747,17 @@ IMEInputHandler::InsertTextAsCommittingC
     PR_LOG(gLog, PR_LOG_ALWAYS,
       ("%p IMEInputHandler::InsertTextAsCommittingComposition, "
        "destroyed by text event", this));
     return;
   }
 
   OnUpdateIMEComposition([aAttrString string]);
 
-  nsCompositionEvent compEnd(true, NS_COMPOSITION_END, mWidget);
+  WidgetCompositionEvent compEnd(true, NS_COMPOSITION_END, mWidget);
   InitCompositionEvent(compEnd);
   compEnd.data = mLastDispatchedCompositionString;
   DispatchEvent(compEnd);
   if (Destroyed()) {
     PR_LOG(gLog, PR_LOG_ALWAYS,
       ("%p IMEInputHandler::InsertTextAsCommittingComposition, "
        "destroyed by compositionend event", this));
     return;
@@ -2829,17 +2829,17 @@ IMEInputHandler::SetMarkedText(NSAttribu
     // range as selection.
     if (aReplacementRange && aReplacementRange->location != NSNotFound &&
         !NSEqualRanges(SelectedRange(), *aReplacementRange)) {
       NS_ENSURE_TRUE_VOID(SetSelection(*aReplacementRange));
     }
 
     mMarkedRange.location = SelectedRange().location;
 
-    nsCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
+    WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
     InitCompositionEvent(compStart);
 
     DispatchEvent(compStart);
     if (Destroyed()) {
       PR_LOG(gLog, PR_LOG_ALWAYS,
         ("%p IMEInputHandler::SetMarkedText, "
          "destroyed by compositionstart event", this));
       return;
@@ -2856,17 +2856,17 @@ IMEInputHandler::SetMarkedText(NSAttribu
     if (Destroyed()) {
       PR_LOG(gLog, PR_LOG_ALWAYS,
         ("%p IMEInputHandler::SetMarkedText, "
          "destroyed by text event", this));
       return;
     }
 
     if (doCommit) {
-      nsCompositionEvent compEnd(true, NS_COMPOSITION_END, mWidget);
+      WidgetCompositionEvent compEnd(true, NS_COMPOSITION_END, mWidget);
       InitCompositionEvent(compEnd);
       compEnd.data = mLastDispatchedCompositionString;
       DispatchEvent(compEnd);
       if (Destroyed()) {
         PR_LOG(gLog, PR_LOG_ALWAYS,
           ("%p IMEInputHandler::SetMarkedText, "
            "destroyed by compositionend event", this));
         return;
--- a/widget/gtk/nsGtkIMModule.cpp
+++ b/widget/gtk/nsGtkIMModule.cpp
@@ -969,18 +969,18 @@ nsGtkIMModule::DispatchCompositionStart(
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    WARNING, mIgnoreNativeCompositionEvent is already TRUE, but we forcedly reset"));
         mIgnoreNativeCompositionEvent = false;
     }
 
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("    mCompositionStart=%u", mCompositionStart));
     mCompositionState = eCompositionState_CompositionStartDispatched;
-    nsCompositionEvent compEvent(true, NS_COMPOSITION_START,
-                                 mLastFocusedWindow);
+    WidgetCompositionEvent compEvent(true, NS_COMPOSITION_START,
+                                     mLastFocusedWindow);
     InitEvent(compEvent);
     nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
     mLastFocusedWindow->DispatchEvent(&compEvent, status);
     if (static_cast<nsWindow*>(kungFuDeathGrip.get())->IsDestroyed() ||
         kungFuDeathGrip != mLastFocusedWindow) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    NOTE, the focused widget was destroyed/changed by compositionstart event"));
         return false;
@@ -1005,18 +1005,18 @@ nsGtkIMModule::DispatchCompositionEnd()
 
     if (!mLastFocusedWindow) {
         mDispatchedCompositionString.Truncate();
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no focused window in this module"));
         return false;
     }
 
-    nsCompositionEvent compEvent(true, NS_COMPOSITION_END,
-                                 mLastFocusedWindow);
+    WidgetCompositionEvent compEvent(true, NS_COMPOSITION_END,
+                                     mLastFocusedWindow);
     InitEvent(compEvent);
     compEvent.data = mDispatchedCompositionString;
     nsEventStatus status;
     nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
     mLastFocusedWindow->DispatchEvent(&compEvent, status);
     mCompositionState = eCompositionState_NotComposing;
     mCompositionStart = UINT32_MAX;
     mDispatchedCompositionString.Truncate();
@@ -1052,18 +1052,18 @@ nsGtkIMModule::DispatchTextEvent(const n
             return false;
         }
     }
 
     nsEventStatus status;
     nsRefPtr<nsWindow> lastFocusedWindow = mLastFocusedWindow;
 
     if (aCompositionString != mDispatchedCompositionString) {
-      nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
-                                           mLastFocusedWindow);
+      WidgetCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
+                                               mLastFocusedWindow);
       InitEvent(compositionUpdate);
       compositionUpdate.data = aCompositionString;
       mDispatchedCompositionString = aCompositionString;
       mLastFocusedWindow->DispatchEvent(&compositionUpdate, status);
       if (lastFocusedWindow->IsDestroyed() ||
           lastFocusedWindow != mLastFocusedWindow) {
           PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
               ("    NOTE, the focused widget was destroyed/changed by compositionupdate"));
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -381,19 +381,19 @@ struct ParamTraits<mozilla::WidgetTextEv
   static void Free(const paramType& aResult)
   {
     if (aResult.rangeArray)
       delete [] aResult.rangeArray;
   }
 };
 
 template<>
-struct ParamTraits<nsCompositionEvent>
+struct ParamTraits<mozilla::WidgetCompositionEvent>
 {
-  typedef nsCompositionEvent paramType;
+  typedef mozilla::WidgetCompositionEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<nsGUIEvent>(aParam));
     WriteParam(aMsg, aParam.seqno);
     WriteParam(aMsg, aParam.data);
   }
 
--- a/widget/os2/nsWindow.cpp
+++ b/widget/os2/nsWindow.cpp
@@ -2473,40 +2473,40 @@ bool nsWindow::ImeResultString(HIMI himi
   compositionStringA.SetCapacity(ulBufLen / sizeof(CHAR));
 
   if (spfnImGetResultString(himi, IMR_RESULT_RESULTSTRING,
                             compositionStringA.Elements(), &ulBufLen)) {
     return false;
   }
   if (!mIsComposing) {
     mLastDispatchedCompositionString.Truncate();
-    nsCompositionEvent start(true, NS_COMPOSITION_START, this);
+    WidgetCompositionEvent start(true, NS_COMPOSITION_START, this);
     InitEvent(start);
     DispatchWindowEvent(&start);
     mIsComposing = true;
   }
   nsAutoChar16Buffer outBuf;
   int32_t outBufLen;
   MultiByteToWideChar(0, compositionStringA.Elements(), ulBufLen,
                       outBuf, outBufLen);
   nsAutoString compositionString(outBuf.Elements());
   if (mLastDispatchedCompositionString != compositionString) {
-    nsCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
+    WidgetCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
     InitEvent(update);
     update.data = compositionString;
     mLastDispatchedCompositionString = compositionString;
     DispatchWindowEvent(&update);
   }
 
   WidgetTextEvent text(true, NS_TEXT_TEXT, this);
   InitEvent(text);
   text.theText = compositionString;
   DispatchWindowEvent(&text);
 
-  nsCompositionEvent end(true, NS_COMPOSITION_END, this);
+  WidgetCompositionEvent end(true, NS_COMPOSITION_END, this);
   InitEvent(end);
   end.data = compositionString;
   DispatchWindowEvent(&end);
   mIsComposing = false;
   mLastDispatchedCompositionString.Truncate();
   return true;
 }
 static uint32_t
@@ -2544,29 +2544,29 @@ bool nsWindow::ImeConversionString(HIMI 
   compositionStringA.SetCapacity(ulBufLen / sizeof(CHAR));
 
   if (spfnImGetConversionString(himi, IMR_CONV_CONVERSIONSTRING,
                                 compositionStringA.Elements(), &ulBufLen)) {
     return false;
   }
   if (!mIsComposing) {
     mLastDispatchedCompositionString.Truncate();
-    nsCompositionEvent start(true, NS_COMPOSITION_START, this);
+    WidgetCompositionEvent start(true, NS_COMPOSITION_START, this);
     InitEvent(start);
     DispatchWindowEvent(&start);
     mIsComposing = true;
   }
   nsAutoChar16Buffer outBuf;
   int32_t outBufLen;
   MultiByteToWideChar(0, compositionStringA.Elements(), ulBufLen,
                       outBuf, outBufLen);
   nsAutoString compositionString(outBuf.Elements());
   // Is a conversion string changed ?
   if (mLastDispatchedCompositionString != compositionString) {
-    nsCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
+    WidgetCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
     InitEvent(update);
     update.data = compositionString;
     mLastDispatchedCompositionString = compositionString;
     DispatchWindowEvent(&update);
   }
   nsAutoTArray<TextRange, 4> textRanges;
   if (!compositionString.IsEmpty()) {
     bool oneClause = false;
@@ -2667,17 +2667,17 @@ bool nsWindow::ImeConversionString(HIMI 
   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);
+    WidgetCompositionEvent end(true, NS_COMPOSITION_END, this);
     InitEvent(end);
     end.data = compositionString;
     DispatchWindowEvent(&end);
 
     mIsComposing = false;
     mLastDispatchedCompositionString.Truncate();
   }
 
--- a/widget/qt/mozqwidget.cpp
+++ b/widget/qt/mozqwidget.cpp
@@ -289,25 +289,27 @@ void MozQWidget::sendPressReleaseKeyEven
 {
     Qt::KeyboardModifiers modifiers  = Qt::NoModifier;
     if (letter && letter->isUpper()) {
         modifiers = Qt::ShiftModifier;
     }
 
     if (letter) {
         // Handle as TextEvent
-        nsCompositionEvent start(true, NS_COMPOSITION_START, mReceiver);
+        mozilla::WidgetCompositionEvent start(true, NS_COMPOSITION_START,
+                                              mReceiver);
         mReceiver->DispatchEvent(&start);
 
         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);
+        mozilla::WidgetCompositionEvent end(true, NS_COMPOSITION_END,
+                                            mReceiver);
         mReceiver->DispatchEvent(&end);
         return;
     }
 
     QKeyEvent press(QEvent::KeyPress, key, modifiers, QString(), autorep, count);
     mReceiver->OnKeyPressEvent(&press);
     QKeyEvent release(QEvent::KeyRelease, key, modifiers, QString(), autorep, count);
     mReceiver->OnKeyReleaseEvent(&release);
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -2758,32 +2758,32 @@ nsWindow::contextMenuEvent(QGraphicsScen
 }
 
 nsEventStatus
 nsWindow::imComposeEvent(QInputMethodEvent *event, bool &handled)
 {
     // XXX Needs to check whether this widget has been destroyed or not after
     //     each DispatchEvent().
 
-    nsCompositionEvent start(true, NS_COMPOSITION_START, this);
+    WidgetCompositionEvent start(true, NS_COMPOSITION_START, this);
     DispatchEvent(&start);
 
     nsAutoString compositionStr(event->commitString().utf16());
 
     if (!compositionStr.IsEmpty()) {
-      nsCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
+      WidgetCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
       update.data = compositionStr;
       DispatchEvent(&update);
     }
 
     WidgetTextEvent text(true, NS_TEXT_TEXT, this);
     text.theText = compositionStr;
     DispatchEvent(&text);
 
-    nsCompositionEvent end(true, NS_COMPOSITION_END, this);
+    WidgetCompositionEvent end(true, NS_COMPOSITION_END, this);
     end.data = compositionStr;
     DispatchEvent(&end);
 
     return nsEventStatus_eIgnore;
 }
 
 nsIWidget *
 nsWindow::GetParent(void)
--- a/widget/windows/nsIMM32Handler.cpp
+++ b/widget/windows/nsIMM32Handler.cpp
@@ -929,17 +929,17 @@ nsIMM32Handler::HandleStartComposition(n
     PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
       ("IMM32: HandleStartComposition, FAILED (NS_QUERY_SELECTED_TEXT)\n"));
     return;
   }
 
   mCompositionStart = selection.mReply.mOffset;
   mLastDispatchedCompositionString.Truncate();
 
-  nsCompositionEvent event(true, NS_COMPOSITION_START, aWindow);
+  WidgetCompositionEvent event(true, NS_COMPOSITION_START, aWindow);
   aWindow->InitEvent(event, &point);
   aWindow->DispatchWindowEvent(&event);
 
   SetIMERelatedWindowsPos(aWindow, aIMEContext);
 
   mIsComposing = true;
   mComposingWindow = aWindow;
 
@@ -1190,17 +1190,17 @@ nsIMM32Handler::HandleEndComposition(nsW
   NS_PRECONDITION(mIsComposing,
     "HandleEndComposition is called but mIsComposing is FALSE");
   NS_PRECONDITION(!aWindow->PluginHasFocus(),
     "HandleComposition should not be called when a plug-in has focus");
 
   PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
     ("IMM32: HandleEndComposition\n"));
 
-  nsCompositionEvent event(true, NS_COMPOSITION_END, aWindow);
+  WidgetCompositionEvent event(true, NS_COMPOSITION_END, aWindow);
   nsIntPoint point(0, 0);
 
   if (mNativeCaretIsCreated) {
     ::DestroyCaret();
     mNativeCaretIsCreated = false;
   }
 
   aWindow->InitEvent(event, &point);
@@ -1564,18 +1564,18 @@ nsIMM32Handler::DispatchTextEvent(nsWind
     return;
   }
 
   nsRefPtr<nsWindow> kungFuDeathGrip(aWindow);
 
   nsIntPoint point(0, 0);
 
   if (mCompositionString != mLastDispatchedCompositionString) {
-    nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
-                                         aWindow);
+    WidgetCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
+                                             aWindow);
     aWindow->InitEvent(compositionUpdate, &point);
     compositionUpdate.data = mCompositionString;
     mLastDispatchedCompositionString = mCompositionString;
 
     aWindow->DispatchWindowEvent(&compositionUpdate);
 
     if (!mIsComposing || aWindow->Destroyed()) {
       return;
--- a/widget/windows/nsTextStore.cpp
+++ b/widget/windows/nsTextStore.cpp
@@ -861,18 +861,18 @@ nsTextStore::FlushPendingActions()
           PR_LOG(sTextStoreLog, PR_LOG_ERROR,
                  ("TSF: 0x%p   nsTextStore::FlushPendingActions() "
                   "FAILED due to NS_SELECTION_SET failure", this));
           break;
         }
         PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
                ("TSF: 0x%p   nsTextStore::FlushPendingActions() "
                 "dispatching compositionstart event...", this));
-        nsCompositionEvent compositionStart(true, NS_COMPOSITION_START,
-                                            mWidget);
+        WidgetCompositionEvent compositionStart(true, NS_COMPOSITION_START,
+                                                mWidget);
         mWidget->InitEvent(compositionStart);
         mWidget->DispatchWindowEvent(&compositionStart);
         if (!mWidget || mWidget->Destroyed()) {
           break;
         }
         mComposition.StartLayoutChangeTimer(this);
         break;
       }
@@ -920,18 +920,18 @@ nsTextStore::FlushPendingActions()
 
         action.mData.ReplaceSubstring(NS_LITERAL_STRING("\r\n"),
                                       NS_LITERAL_STRING("\n"));
 
         if (action.mData != mComposition.mLastData) {
           PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
                  ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
                   "dispatching compositionupdate event...", this));
-          nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
-                                               mWidget);
+          WidgetCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
+                                                   mWidget);
           mWidget->InitEvent(compositionUpdate);
           compositionUpdate.data = action.mData;
           mComposition.mLastData = compositionUpdate.data;
           mWidget->DispatchWindowEvent(&compositionUpdate);
           if (!mWidget || mWidget->Destroyed()) {
             break;
           }
         }
@@ -966,18 +966,18 @@ nsTextStore::FlushPendingActions()
         mComposition.EnsureLayoutChangeTimerStopped();
 
         action.mData.ReplaceSubstring(NS_LITERAL_STRING("\r\n"),
                                       NS_LITERAL_STRING("\n"));
         if (action.mData != mComposition.mLastData) {
           PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
                  ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
                   "dispatching compositionupdate event...", this));
-          nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
-                                               mWidget);
+          WidgetCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
+                                                   mWidget);
           mWidget->InitEvent(compositionUpdate);
           compositionUpdate.data = action.mData;
           mComposition.mLastData = compositionUpdate.data;
           mWidget->DispatchWindowEvent(&compositionUpdate);
           if (!mWidget || mWidget->Destroyed()) {
             break;
           }
         }
@@ -993,17 +993,18 @@ nsTextStore::FlushPendingActions()
         mWidget->DispatchWindowEvent(&textEvent);
         if (!mWidget || mWidget->Destroyed()) {
           break;
         }
 
         PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
                ("TSF: 0x%p   nsTextStore::FlushPendingActions(), "
                 "dispatching compositionend event...", this));
-        nsCompositionEvent compositionEnd(true, NS_COMPOSITION_END, mWidget);
+        WidgetCompositionEvent compositionEnd(true, NS_COMPOSITION_END,
+                                              mWidget);
         compositionEnd.data = mComposition.mLastData;
         mWidget->InitEvent(compositionEnd);
         mWidget->DispatchWindowEvent(&compositionEnd);
         if (!mWidget || mWidget->Destroyed()) {
           break;
         }
         mComposition.mLastData.Truncate();
         break;
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -270,17 +270,17 @@ PuppetWidget::DispatchEvent(nsGUIEvent* 
 
   aStatus = nsEventStatus_eIgnore;
 
   if (event->message == NS_COMPOSITION_START) {
     mIMEComposing = true;
   }
   switch (event->eventStructType) {
   case NS_COMPOSITION_EVENT:
-    mIMELastReceivedSeqno = static_cast<nsCompositionEvent*>(event)->seqno;
+    mIMELastReceivedSeqno = static_cast<WidgetCompositionEvent*>(event)->seqno;
     if (mIMELastReceivedSeqno < mIMELastBlurSeqno)
       return NS_OK;
     break;
   case NS_TEXT_EVENT:
     mIMELastReceivedSeqno = static_cast<WidgetTextEvent*>(event)->seqno;
     if (mIMELastReceivedSeqno < mIMELastBlurSeqno)
       return NS_OK;
     break;
@@ -357,17 +357,17 @@ PuppetWidget::IMEEndComposition(bool aCa
     return NS_ERROR_FAILURE;
   }
 
   if (!mIMEComposing)
     return NS_OK;
 
   DispatchEvent(&textEvent, status);
 
-  nsCompositionEvent compEvent(true, NS_COMPOSITION_END, this);
+  WidgetCompositionEvent compEvent(true, NS_COMPOSITION_END, this);
   InitEvent(compEvent, nullptr);
   compEvent.seqno = mIMELastReceivedSeqno;
   DispatchEvent(&compEvent, status);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 PuppetWidget::NotifyIME(NotificationToIME aNotification)