Bug 920425 part.14 Use mozilla::WidgetEvent::AsCommandEvent() r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 18 Oct 2013 15:10:23 +0900
changeset 151198 233e5e2db7c7d825a439a91e48b5392225dae07b
parent 151197 30cfb3f452b5ae2f72a655ed27aff62082a9db06
child 151199 3b3805db4d2c207f2f8019a6ac90afa9b1368f84
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.14 Use mozilla::WidgetEvent::AsCommandEvent() r=smaug
content/events/src/nsDOMCommandEvent.cpp
content/events/src/nsDOMEvent.cpp
content/events/src/nsEventDispatcher.cpp
--- a/content/events/src/nsDOMCommandEvent.cpp
+++ b/content/events/src/nsDOMCommandEvent.cpp
@@ -28,17 +28,17 @@ NS_INTERFACE_MAP_BEGIN(nsDOMCommandEvent
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
 
 NS_IMPL_ADDREF_INHERITED(nsDOMCommandEvent, nsDOMEvent)
 NS_IMPL_RELEASE_INHERITED(nsDOMCommandEvent, nsDOMEvent)
 
 NS_IMETHODIMP
 nsDOMCommandEvent::GetCommand(nsAString& aCommand)
 {
-  nsIAtom* command = static_cast<WidgetCommandEvent*>(mEvent)->command;
+  nsIAtom* command = mEvent->AsCommandEvent()->command;
   if (command) {
     command->ToString(aCommand);
   } else {
     aCommand.Truncate();
   }
   return NS_OK;
 }
 
@@ -46,17 +46,17 @@ NS_IMETHODIMP
 nsDOMCommandEvent::InitCommandEvent(const nsAString& aTypeArg,
                                     bool aCanBubbleArg,
                                     bool aCancelableArg,
                                     const nsAString& aCommand)
 {
   nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  static_cast<WidgetCommandEvent*>(mEvent)->command = do_GetAtom(aCommand);
+  mEvent->AsCommandEvent()->command = do_GetAtom(aCommand);
   return NS_OK;
 }
 
 nsresult NS_NewDOMCommandEvent(nsIDOMEvent** aInstancePtrResult,
                                mozilla::dom::EventTarget* aOwner,
                                nsPresContext* aPresContext,
                                WidgetCommandEvent* aEvent)
 {
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -655,18 +655,17 @@ nsDOMEvent::DuplicatePrivateData()
       InternalFocusEvent* newFocusEvent = new InternalFocusEvent(false, msg);
       InternalFocusEvent* oldFocusEvent = mEvent->AsFocusEvent();
       newFocusEvent->AssignFocusEventData(*oldFocusEvent, true);
       newEvent = newFocusEvent;
       break;
     }
     case NS_COMMAND_EVENT:
     {
-      WidgetCommandEvent* oldCommandEvent =
-        static_cast<WidgetCommandEvent*>(mEvent);
+      WidgetCommandEvent* oldCommandEvent = mEvent->AsCommandEvent();
       WidgetCommandEvent* commandEvent =
         new WidgetCommandEvent(false, mEvent->userType,
                                oldCommandEvent->command, nullptr);
       commandEvent->AssignCommandEventData(*oldCommandEvent, true);
       newEvent = commandEvent;
       break;
     }
     case NS_UI_EVENT:
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -732,17 +732,17 @@ nsEventDispatcher::CreateEvent(mozilla::
     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);
 
     case NS_COMMAND_EVENT:
       return NS_NewDOMCommandEvent(aDOMEvent, aOwner, aPresContext,
-                                   static_cast<WidgetCommandEvent*>(aEvent));
+                                   aEvent->AsCommandEvent());
     case NS_SIMPLE_GESTURE_EVENT:
       return NS_NewDOMSimpleGestureEvent(aDOMEvent, aOwner, aPresContext,
                static_cast<WidgetSimpleGestureEvent*>(aEvent));
     case NS_TOUCH_EVENT:
       return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext,
                                  static_cast<WidgetTouchEvent*>(aEvent));
     case NS_TRANSITION_EVENT:
       return NS_NewDOMTransitionEvent(aDOMEvent, aOwner, aPresContext,