Bug 920425 part.19 Use mozilla::WidgetEvent::AsTextEvent() r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 18 Oct 2013 15:10:24 +0900
changeset 151203 c8e43d3e128d3b0bf99280cec145c7b68fbf19aa
parent 151202 1ac236b84f070245e7909dee2140c1b7499af9ae
child 151204 c311f205e80575f017d3e0b5ec200e612e540ee9
push id35111
push usermasayuki@d-toybox.com
push dateFri, 18 Oct 2013 06:10:43 +0000
treeherdermozilla-inbound@bc72b42bcf76 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs920425
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 920425 part.19 Use mozilla::WidgetEvent::AsTextEvent() r=smaug
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMTextEvent.cpp
content/events/src/nsEventDispatcher.cpp
content/events/src/nsEventStateManager.cpp
widget/android/nsWindow.cpp
widget/xpwidgets/PuppetWidget.cpp
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -575,17 +575,17 @@ nsDOMEvent::DuplicatePrivateData()
       InternalScriptErrorEvent* scriptErrorEvent =
         new InternalScriptErrorEvent(false, msg);
       scriptErrorEvent->AssignScriptErrorEventData(*oldScriptErrorEvent, true);
       newEvent = scriptErrorEvent;
       break;
     }
     case NS_TEXT_EVENT:
     {
-      WidgetTextEvent* oldTextEvent = static_cast<WidgetTextEvent*>(mEvent);
+      WidgetTextEvent* oldTextEvent = mEvent->AsTextEvent();
       WidgetTextEvent* textEvent = new WidgetTextEvent(false, msg, nullptr);
       textEvent->AssignTextEventData(*oldTextEvent, true);
       newEvent = textEvent;
       break;
     }
     case NS_COMPOSITION_EVENT:
     {
       WidgetCompositionEvent* compositionEvent =
--- a/content/events/src/nsDOMTextEvent.cpp
+++ b/content/events/src/nsDOMTextEvent.cpp
@@ -25,17 +25,17 @@ nsDOMTextEvent::nsDOMTextEvent(mozilla::
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
 
   //
   // extract the IME composition string
   //
-  WidgetTextEvent *te = static_cast<WidgetTextEvent*>(mEvent);
+  WidgetTextEvent* te = mEvent->AsTextEvent();
   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);
--- 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<WidgetWheelEvent*>(aEvent));
     case NS_DRAG_EVENT:
       return NS_NewDOMDragEvent(aDOMEvent, aOwner, aPresContext,
                                 static_cast<WidgetDragEvent*>(aEvent));
     case NS_TEXT_EVENT:
       return NS_NewDOMTextEvent(aDOMEvent, aOwner, aPresContext,
-                                static_cast<WidgetTextEvent*>(aEvent));
+                                aEvent->AsTextEvent());
     case NS_CLIPBOARD_EVENT:
       return NS_NewDOMClipboardEvent(aDOMEvent, aOwner, aPresContext,
                                      aEvent->AsClipboardEvent());
     case NS_SVGZOOM_EVENT:
       return NS_NewDOMSVGZoomEvent(aDOMEvent, aOwner, aPresContext,
                                    static_cast<WidgetGUIEvent*>(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
@@ -1298,17 +1298,17 @@ nsEventStateManager::PreHandleEvent(nsPr
     break;
   case NS_CONTENT_COMMAND_SCROLL:
     {
       DoContentCommandScrollEvent(aEvent->AsContentCommandEvent());
     }
     break;
   case NS_TEXT_TEXT:
     {
-      WidgetTextEvent *textEvent = static_cast<WidgetTextEvent*>(aEvent);
+      WidgetTextEvent *textEvent = aEvent->AsTextEvent();
       if (IsTargetCrossProcess(textEvent)) {
         // Will not be handled locally, remote the event
         if (GetCrossProcessTarget()->SendTextEvent(*textEvent)) {
           // Cancel local dispatching
           aEvent->mFlags.mPropagationStopped = true;
         }
       }
     }
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -684,17 +684,17 @@ nsWindow::DispatchEvent(WidgetGUIEvent* 
             break;
         case NS_COMPOSITION_END:
             MOZ_ASSERT(mIMEComposing);
             mIMEComposing = false;
             mIMEComposingText.Truncate();
             break;
         case NS_TEXT_TEXT:
             MOZ_ASSERT(mIMEComposing);
-            mIMEComposingText = static_cast<WidgetTextEvent*>(aEvent)->theText;
+            mIMEComposingText = aEvent->AsTextEvent()->theText;
             break;
         }
         return status;
     }
     return nsEventStatus_eIgnore;
 }
 
 NS_IMETHODIMP
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -275,17 +275,17 @@ PuppetWidget::DispatchEvent(WidgetGUIEve
   }
   switch (event->eventStructType) {
   case NS_COMPOSITION_EVENT:
     mIMELastReceivedSeqno = static_cast<WidgetCompositionEvent*>(event)->seqno;
     if (mIMELastReceivedSeqno < mIMELastBlurSeqno)
       return NS_OK;
     break;
   case NS_TEXT_EVENT:
-    mIMELastReceivedSeqno = static_cast<WidgetTextEvent*>(event)->seqno;
+    mIMELastReceivedSeqno = event->AsTextEvent()->seqno;
     if (mIMELastReceivedSeqno < mIMELastBlurSeqno)
       return NS_OK;
     break;
   case NS_SELECTION_EVENT:
     mIMELastReceivedSeqno = static_cast<WidgetSelectionEvent*>(event)->seqno;
     if (mIMELastReceivedSeqno < mIMELastBlurSeqno)
       return NS_OK;
     break;