Bug 920377 part.3 Get rid of nsCommandEvent r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 27 Sep 2013 15:20:54 +0900
changeset 148947 1ba8d22427b0241ac424f24ed983f5b803cad7c2
parent 148946 f9a539f98ccc3febfc4bdec145affabad34934b2
child 148948 5c6b7f254a3b33949cafd0d1e2de63ab1ebb2a44
push id25366
push userkwierso@gmail.com
push dateSat, 28 Sep 2013 02:13:38 +0000
treeherdermozilla-central@e1914e294152 [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.3 Get rid of nsCommandEvent r=roc
content/events/src/nsDOMCommandEvent.cpp
content/events/src/nsDOMCommandEvent.h
content/events/src/nsDOMEvent.cpp
content/events/src/nsEventDispatcher.cpp
dom/interfaces/events/nsIDOMEvent.idl
widget/EventForwards.h
widget/MiscEvents.h
widget/android/nsWindow.cpp
widget/gtk/nsWindow.cpp
widget/os2/nsWindow.cpp
widget/qt/nsWindow.cpp
widget/windows/WinMouseScrollHandler.cpp
widget/windows/nsWindow.cpp
--- a/content/events/src/nsDOMCommandEvent.cpp
+++ b/content/events/src/nsDOMCommandEvent.cpp
@@ -2,49 +2,51 @@
 /* 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 "nsDOMCommandEvent.h"
 #include "prtime.h"
 #include "mozilla/MiscEvents.h"
 
+using namespace mozilla;
+
 nsDOMCommandEvent::nsDOMCommandEvent(mozilla::dom::EventTarget* aOwner,
                                      nsPresContext* aPresContext,
-                                     nsCommandEvent* aEvent)
+                                     WidgetCommandEvent* aEvent)
   : nsDOMEvent(aOwner, aPresContext, aEvent ? aEvent :
-               new nsCommandEvent(false, nullptr, nullptr, nullptr))
+               new WidgetCommandEvent(false, nullptr, nullptr, nullptr))
 {
   mEvent->time = PR_Now();
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
   }
 }
 
 nsDOMCommandEvent::~nsDOMCommandEvent()
 {
   if (mEventIsInternal && mEvent->eventStructType == NS_COMMAND_EVENT) {
-    delete static_cast<nsCommandEvent*>(mEvent);
+    delete static_cast<WidgetCommandEvent*>(mEvent);
     mEvent = nullptr;
   }
 }
 
 NS_INTERFACE_MAP_BEGIN(nsDOMCommandEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMCommandEvent)
 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<nsCommandEvent*>(mEvent)->command;
+  nsIAtom* command = static_cast<WidgetCommandEvent*>(mEvent)->command;
   if (command) {
     command->ToString(aCommand);
   } else {
     aCommand.Truncate();
   }
   return NS_OK;
 }
 
@@ -52,21 +54,21 @@ 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<nsCommandEvent*>(mEvent)->command = do_GetAtom(aCommand);
+  static_cast<WidgetCommandEvent*>(mEvent)->command = do_GetAtom(aCommand);
   return NS_OK;
 }
 
 nsresult NS_NewDOMCommandEvent(nsIDOMEvent** aInstancePtrResult,
                                mozilla::dom::EventTarget* aOwner,
                                nsPresContext* aPresContext,
-                               nsCommandEvent* aEvent)
+                               WidgetCommandEvent* aEvent)
 {
   nsDOMCommandEvent* it = new nsDOMCommandEvent(aOwner, aPresContext, aEvent);
 
   return CallQueryInterface(it, aInstancePtrResult);
 }
--- a/content/events/src/nsDOMCommandEvent.h
+++ b/content/events/src/nsDOMCommandEvent.h
@@ -12,17 +12,17 @@
 #include "mozilla/EventForwards.h"
 
 class nsDOMCommandEvent : public nsDOMEvent,
                           public nsIDOMCommandEvent
 {
 public:
   nsDOMCommandEvent(mozilla::dom::EventTarget* aOwner,
                     nsPresContext* aPresContext,
-                    nsCommandEvent* aEvent);
+                    mozilla::WidgetCommandEvent* aEvent);
   virtual ~nsDOMCommandEvent();
 
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_NSIDOMCOMMANDEVENT
 
   // Forward to base class
   NS_FORWARD_TO_NSDOMEVENT
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -657,20 +657,21 @@ nsDOMEvent::DuplicatePrivateData()
       nsFocusEvent* newFocusEvent = new nsFocusEvent(false, msg);
       nsFocusEvent* oldFocusEvent = static_cast<nsFocusEvent*>(mEvent);
       newFocusEvent->AssignFocusEventData(*oldFocusEvent, true);
       newEvent = newFocusEvent;
       break;
     }
     case NS_COMMAND_EVENT:
     {
-      nsCommandEvent* oldCommandEvent = static_cast<nsCommandEvent*>(mEvent);
-      nsCommandEvent* commandEvent =
-        new nsCommandEvent(false, mEvent->userType,
-                           oldCommandEvent->command, nullptr);
+      WidgetCommandEvent* oldCommandEvent =
+        static_cast<WidgetCommandEvent*>(mEvent);
+      WidgetCommandEvent* commandEvent =
+        new WidgetCommandEvent(false, mEvent->userType,
+                               oldCommandEvent->command, nullptr);
       commandEvent->AssignCommandEventData(*oldCommandEvent, true);
       newEvent = commandEvent;
       break;
     }
     case NS_UI_EVENT:
     {
       nsUIEvent* oldUIEvent = static_cast<nsUIEvent*>(mEvent);
       nsUIEvent* uiEvent = new nsUIEvent(false, msg, oldUIEvent->detail);
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -730,17 +730,17 @@ nsEventDispatcher::CreateEvent(mozilla::
     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);
 
     case NS_COMMAND_EVENT:
       return NS_NewDOMCommandEvent(aDOMEvent, aOwner, aPresContext,
-                                   static_cast<nsCommandEvent*>(aEvent));
+                                   static_cast<WidgetCommandEvent*>(aEvent));
     case NS_SIMPLE_GESTURE_EVENT:
       return NS_NewDOMSimpleGestureEvent(aDOMEvent, aOwner, aPresContext,
                                          static_cast<nsSimpleGestureEvent*>(aEvent));
     case NS_TOUCH_EVENT:
       return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext,
                                  static_cast<nsTouchEvent*>(aEvent));
     case NS_TRANSITION_EVENT:
       return NS_NewDOMTransitionEvent(aDOMEvent, aOwner, aPresContext,
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -318,17 +318,17 @@ nsresult
 NS_NewDOMXULCommandEvent(nsIDOMEvent** aResult,
                          mozilla::dom::EventTarget* aOwner,
                          nsPresContext* aPresContext,
                          nsInputEvent* aEvent);
 nsresult
 NS_NewDOMCommandEvent(nsIDOMEvent** aInstancePtrResult,
                       mozilla::dom::EventTarget* aOwner,
                       nsPresContext* aPresContext,
-                      nsCommandEvent* aEvent);
+                      mozilla::WidgetCommandEvent* aEvent);
 nsresult
 NS_NewDOMMessageEvent(nsIDOMEvent** aInstancePtrResult,
                       mozilla::dom::EventTarget* aOwner,
                       nsPresContext* aPresContext,
                       nsEvent* aEvent);
 nsresult
 NS_NewDOMProgressEvent(nsIDOMEvent** aInstancePtrResult,
                        mozilla::dom::EventTarget* aOwner,
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -132,11 +132,10 @@ typedef mozilla::InternalScriptErrorEven
 typedef mozilla::InternalScrollPortEvent   nsScrollPortEvent;
 typedef mozilla::InternalScrollAreaEvent   nsScrollAreaEvent;
 typedef mozilla::InternalFormEvent         nsFormEvent;
 typedef mozilla::InternalClipboardEvent    nsClipboardEvent;
 typedef mozilla::InternalFocusEvent        nsFocusEvent;
 typedef mozilla::InternalTransitionEvent   nsTransitionEvent;
 typedef mozilla::InternalAnimationEvent    nsAnimationEvent;
 typedef mozilla::WidgetContentCommandEvent nsContentCommandEvent;
-typedef mozilla::WidgetCommandEvent        nsCommandEvent;
 
 #endif // mozilla_EventForwards_h__
--- a/widget/MiscEvents.h
+++ b/widget/MiscEvents.h
@@ -112,11 +112,10 @@ public:
   // Otherwise, never retargeted. Defaults to false.
   bool retargetToFocusedDocument;
 };
 
 } // namespace mozilla
 
 // TODO: Remove following typedefs
 typedef mozilla::WidgetContentCommandEvent nsContentCommandEvent;
-typedef mozilla::WidgetCommandEvent        nsCommandEvent;
 
 #endif // mozilla_MiscEvents_h__
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -1703,17 +1703,17 @@ nsWindow::HandleSpecialKey(AndroidGeckoE
                 doCommand = true;
                 break;
             default:
                 ALOG("Unknown special key code!");
                 return;
         }
     }
     if (doCommand) {
-        nsCommandEvent event(true, nsGkAtoms::onAppCommand, command, this);
+        WidgetCommandEvent event(true, nsGkAtoms::onAppCommand, command, this);
         InitEvent(event);
         DispatchEvent(&event);
     }
 }
 
 void
 nsWindow::OnKeyEvent(AndroidGeckoEvent *ae)
 {
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2878,17 +2878,17 @@ nsWindow::OnContainerFocusOutEvent(GdkEv
 
     LOGFOCUS(("Done with container focus out [%p]\n", (void *)this));
 }
 
 bool
 nsWindow::DispatchCommandEvent(nsIAtom* aCommand)
 {
     nsEventStatus status;
-    nsCommandEvent event(true, nsGkAtoms::onAppCommand, aCommand, this);
+    WidgetCommandEvent event(true, nsGkAtoms::onAppCommand, aCommand, this);
     DispatchEvent(&event, status);
     return TRUE;
 }
 
 bool
 nsWindow::DispatchContentCommandEvent(int32_t aMsg)
 {
   nsEventStatus status;
--- a/widget/os2/nsWindow.cpp
+++ b/widget/os2/nsWindow.cpp
@@ -3082,17 +3082,17 @@ bool nsWindow::DispatchCommandEvent(uint
       break;
     case APPCOMMAND_BROWSER_STOP:
       command = nsGkAtoms::Stop;
       break;
     default:
       return false;
   }
 
-  nsCommandEvent event(true, nsGkAtoms::onAppCommand, command, this);
+  WidgetCommandEvent event(true, nsGkAtoms::onAppCommand, command, this);
   InitEvent(event);
   return DispatchWindowEvent(&event);
 }
 
 //-----------------------------------------------------------------------------
 
 bool nsWindow::DispatchDragDropEvent(uint32_t aMsg)
 {
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -1454,17 +1454,17 @@ is_latin_shortcut_key(quint32 aKeyval)
 {
     return ((Qt::Key_0 <= aKeyval && aKeyval <= Qt::Key_9) ||
             (Qt::Key_A <= aKeyval && aKeyval <= Qt::Key_Z));
 }
 
 nsEventStatus
 nsWindow::DispatchCommandEvent(nsIAtom* aCommand)
 {
-    nsCommandEvent event(true, nsGkAtoms::onAppCommand, aCommand, this);
+    WidgetCommandEvent event(true, nsGkAtoms::onAppCommand, aCommand, this);
 
     nsEventStatus status;
     DispatchEvent(&event, status);
 
     return status;
 }
 
 nsEventStatus
--- a/widget/windows/WinMouseScrollHandler.cpp
+++ b/widget/windows/WinMouseScrollHandler.cpp
@@ -1226,17 +1226,17 @@ MouseScrollHandler::Device::Elantech::Ha
       (aWParam == VK_NEXT || aWParam == VK_PRIOR) &&
       (IS_VK_DOWN(0xFF) || IS_VK_DOWN(0xCC))) {
     if (aMsg == WM_KEYDOWN) {
       PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS,
         ("MouseScroll::Device::Elantech::HandleKeyMessage(): Dispatching "
          "%s command event",
          aWParam == VK_NEXT ? "Forward" : "Back"));
 
-      nsCommandEvent commandEvent(true, nsGkAtoms::onAppCommand,
+      WidgetCommandEvent commandEvent(true, nsGkAtoms::onAppCommand,
         (aWParam == VK_NEXT) ? nsGkAtoms::Forward : nsGkAtoms::Back, aWidget);
       InitEvent(aWidget, commandEvent);
       MouseScrollHandler::DispatchEvent(aWidget, commandEvent);
     }
 #ifdef PR_LOGGING
     else {
       PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS,
         ("MouseScroll::Device::Elantech::HandleKeyMessage(): Consumed"));
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -3739,17 +3739,17 @@ bool nsWindow::DispatchCommandEvent(uint
       command = nsGkAtoms::ReplyToMail;
       break;
     case APPCOMMAND_SEND_MAIL:
       command = nsGkAtoms::SendMail;
       break;
     default:
       return false;
   }
-  nsCommandEvent event(true, nsGkAtoms::onAppCommand, command, this);
+  WidgetCommandEvent event(true, nsGkAtoms::onAppCommand, command, this);
 
   InitEvent(event);
   return DispatchWindowEvent(&event);
 }
 
 // Recursively dispatch synchronous paints for nsIWidget
 // descendants with invalidated rectangles.
 BOOL CALLBACK nsWindow::DispatchStarvedPaints(HWND aWnd, LPARAM aMsg)