Bug 960871 part.7 Get rid of WidgetTextEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 07 Oct 2014 19:01:48 +0900
changeset 232357 bd15674419d1e1880670163fdd8fac6a4668408f
parent 232356 5216b7b1e4e3115a11c126d4b52ecffff710f64c
child 232358 93374aaa8f6e92919f39c6684261123adc45ce54
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs960871
milestone35.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 960871 part.7 Get rid of WidgetTextEvent r=smaug
dom/events/EventDispatcher.cpp
dom/interfaces/events/nsIDOMEvent.idl
widget/EventClassList.h
widget/TextEvents.h
widget/nsGUIEventIPC.h
widget/xpwidgets/PuppetWidget.cpp
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -697,17 +697,16 @@ EventDispatcher::CreateEvent(EventTarget
                               aEvent->AsGUIEvent());
     case eScrollAreaEventClass:
       return NS_NewDOMScrollAreaEvent(aDOMEvent, aOwner, aPresContext,
                                       aEvent->AsScrollAreaEvent());
     case eKeyboardEventClass:
       return NS_NewDOMKeyboardEvent(aDOMEvent, aOwner, aPresContext,
                                     aEvent->AsKeyboardEvent());
     case eCompositionEventClass:
-    case eTextEventClass:
       return NS_NewDOMCompositionEvent(aDOMEvent, aOwner, aPresContext,
                                        aEvent->AsCompositionEvent());
     case eMouseEventClass:
       return NS_NewDOMMouseEvent(aDOMEvent, aOwner, aPresContext,
                                  aEvent->AsMouseEvent());
     case eFocusEventClass:
       return NS_NewDOMFocusEvent(aDOMEvent, aOwner, aPresContext,
                                  aEvent->AsFocusEvent());
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -283,21 +283,16 @@ NS_NewDOMMutationEvent(nsIDOMEvent** aRe
                        nsPresContext* aPresContext,
                        mozilla::InternalMutationEvent* aEvent);
 nsresult
 NS_NewDOMDeviceMotionEvent(nsIDOMEvent** aResult,
                            mozilla::dom::EventTarget* aOwner,
                            nsPresContext* aPresContext,
                            mozilla::WidgetEvent* aEvent);
 nsresult
-NS_NewDOMTextEvent(nsIDOMEvent** aResult,
-                   mozilla::dom::EventTarget* aOwner,
-                   nsPresContext* aPresContext,
-                   mozilla::WidgetTextEvent* aEvent);
-nsresult
 NS_NewDOMBeforeUnloadEvent(nsIDOMEvent** aResult,
                            mozilla::dom::EventTarget* aOwner,
                            nsPresContext* aPresContext,
                            mozilla::WidgetEvent* aEvent);
 nsresult
 NS_NewDOMSVGEvent(nsIDOMEvent** aResult,
                   mozilla::dom::EventTarget* aOwner,
                   nsPresContext* aPresContext,
--- a/widget/EventClassList.h
+++ b/widget/EventClassList.h
@@ -17,17 +17,16 @@
 // BasicEvents.h
 NS_ROOT_EVENT_CLASS(Widget, Event)
 NS_EVENT_CLASS(Widget, GUIEvent)
 NS_EVENT_CLASS(Widget, InputEvent)
 NS_EVENT_CLASS(Internal, UIEvent)
 
 // TextEvents.h
 NS_EVENT_CLASS(Widget, KeyboardEvent)
-NS_EVENT_CLASS(Widget, TextEvent)
 NS_EVENT_CLASS(Widget, CompositionEvent)
 NS_EVENT_CLASS(Widget, QueryContentEvent)
 NS_EVENT_CLASS(Widget, SelectionEvent)
 NS_EVENT_CLASS(Internal, EditorInputEvent)
 
 // MouseEvents.h
 NS_EVENT_CLASS(Widget, MouseEventBase)
 NS_EVENT_CLASS(Widget, MouseEvent)
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -190,90 +190,16 @@ public:
     // Don't copy mNativeKeyEvent because it may be referred after its instance
     // is destroyed.
     mNativeKeyEvent = nullptr;
     mUniqueId = aEvent.mUniqueId;
   }
 };
 
 /******************************************************************************
- * mozilla::WidgetTextEvent
- *
- * XXX WidgetTextEvent is fired with compositionupdate event almost every time.
- *     This wastes performance and the cost of mantaining each platform's
- *     implementation.  Therefore, we should merge WidgetTextEvent and
- *     WidgetCompositionEvent.  Then, DOM compositionupdate should be fired
- *     from TextComposition automatically.
- ******************************************************************************/
-
-class WidgetTextEvent : public WidgetGUIEvent
-{
-private:
-  friend class dom::PBrowserParent;
-  friend class dom::PBrowserChild;
-  friend class plugins::PPluginInstanceChild;
-
-  WidgetTextEvent()
-    : mSeqno(kLatestSeqno)
-  {
-  }
-
-public:
-  uint32_t mSeqno;
-
-public:
-  virtual WidgetTextEvent* AsTextEvent() MOZ_OVERRIDE { return this; }
-
-  WidgetTextEvent(bool aIsTrusted, uint32_t aMessage, nsIWidget* aWidget)
-    : WidgetGUIEvent(aIsTrusted, aMessage, aWidget, eTextEventClass)
-    , mSeqno(kLatestSeqno)
-  {
-  }
-
-  virtual WidgetEvent* Duplicate() const MOZ_OVERRIDE
-  {
-    MOZ_ASSERT(mClass == eTextEventClass,
-               "Duplicate() must be overridden by sub class");
-    // Not copying widget, it is a weak reference.
-    WidgetTextEvent* result = new WidgetTextEvent(false, message, nullptr);
-    result->AssignTextEventData(*this, true);
-    result->mFlags = mFlags;
-    return result;
-  }
-
-  // The composition string or the commit string.
-  nsString mData;
-
-  nsRefPtr<TextRangeArray> mRanges;
-
-  void AssignTextEventData(const WidgetTextEvent& aEvent, bool aCopyTargets)
-  {
-    AssignGUIEventData(aEvent, aCopyTargets);
-
-    // Currently, we don't need to copy the other members because they are
-    // for internal use only (not available from JS).
-  }
-
-  bool IsComposing() const
-  {
-    return mRanges && mRanges->IsComposing();
-  }
-
-  uint32_t TargetClauseOffset() const
-  {
-    return mRanges ? mRanges->TargetClauseOffset() : 0;
-  }
-
-  uint32_t RangeCount() const
-  {
-    return mRanges ? mRanges->Length() : 0;
-  }
-};
-
-/******************************************************************************
  * mozilla::WidgetCompositionEvent
  ******************************************************************************/
 
 class WidgetCompositionEvent : public WidgetGUIEvent
 {
 private:
   friend class mozilla::dom::PBrowserParent;
   friend class mozilla::dom::PBrowserChild;
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -437,59 +437,16 @@ struct ParamTraits<mozilla::TextRangeArr
       }
       aResult->AppendElement(textRange);
     }
     return true;
   }
 };
 
 template<>
-struct ParamTraits<mozilla::WidgetTextEvent>
-{
-  typedef mozilla::WidgetTextEvent paramType;
-
-  static void Write(Message* aMsg, const paramType& aParam)
-  {
-    WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
-    WriteParam(aMsg, aParam.mSeqno);
-    WriteParam(aMsg, aParam.mData);
-    bool hasRanges = !!aParam.mRanges;
-    WriteParam(aMsg, hasRanges);
-    if (hasRanges) {
-      WriteParam(aMsg, *aParam.mRanges.get());
-    }
-  }
-
-  static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
-  {
-    bool hasRanges;
-    if (!ReadParam(aMsg, aIter,
-                   static_cast<mozilla::WidgetGUIEvent*>(aResult)) ||
-        !ReadParam(aMsg, aIter, &aResult->mSeqno) ||
-        !ReadParam(aMsg, aIter, &aResult->mData) ||
-        !ReadParam(aMsg, aIter, &hasRanges)) {
-      return false;
-    }
-
-    if (!hasRanges) {
-      aResult->mRanges = nullptr;
-    } else {
-      aResult->mRanges = new mozilla::TextRangeArray();
-      if (!aResult->mRanges) {
-        return false;
-      }
-      if (!ReadParam(aMsg, aIter, aResult->mRanges.get())) {
-        return false;
-      }
-    }
-    return true;
-  }
-};
-
-template<>
 struct ParamTraits<mozilla::WidgetCompositionEvent>
 {
   typedef mozilla::WidgetCompositionEvent paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, static_cast<mozilla::WidgetGUIEvent>(aParam));
     WriteParam(aMsg, aParam.mSeqno);
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -286,19 +286,16 @@ PuppetWidget::DispatchEvent(WidgetGUIEve
   if (event->message == NS_COMPOSITION_START) {
     mIMEComposing = true;
   }
   uint32_t seqno = kLatestSeqno;
   switch (event->mClass) {
   case eCompositionEventClass:
     seqno = event->AsCompositionEvent()->mSeqno;
     break;
-  case eTextEventClass:
-    seqno = event->AsTextEvent()->mSeqno;
-    break;
   case eSelectionEventClass:
     seqno = event->AsSelectionEvent()->mSeqno;
     break;
   default:
     break;
   }
   if (seqno != kLatestSeqno) {
     mIMELastReceivedSeqno = seqno;