Bug 975688 part.23 Rename nsDOMXULCommandEvent to mozilla::dom::XULCommandEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 28 Feb 2014 23:58:42 +0900
changeset 171521 cb9e4644b197eb538117ba52368896d4a22cb985
parent 171520 78f44c7e55f107eec6b38bcd7b6fa86a43b8a84f
child 171522 e711121154fb15f0ad3fbc579795f54ccfaaaf82
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerssmaug
bugs975688
milestone30.0a1
Bug 975688 part.23 Rename nsDOMXULCommandEvent to mozilla::dom::XULCommandEvent r=smaug
dom/bindings/Bindings.conf
dom/events/XULCommandEvent.cpp
dom/events/XULCommandEvent.h
dom/events/moz.build
dom/events/nsDOMXULCommandEvent.cpp
dom/events/nsDOMXULCommandEvent.h
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1533,20 +1533,16 @@ DOMInterfaces = {
 'XPathEvaluator': {
     'wrapperCache': False
 },
 
 'XULDocument': {
     'headerFile': 'XULDocument.h'
 },
 
-'XULCommandEvent': {
-    'nativeType': 'nsDOMXULCommandEvent',
-},
-
 'XULElement': {
     'nativeType': 'nsXULElement',
     'resultNotAddRefed': [ 'controllers', 'style' ]
 },
 
 ####################################
 # Test Interfaces of various sorts #
 ####################################
rename from dom/events/nsDOMXULCommandEvent.cpp
rename to dom/events/XULCommandEvent.cpp
--- a/dom/events/nsDOMXULCommandEvent.cpp
+++ b/dom/events/XULCommandEvent.cpp
@@ -1,130 +1,139 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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 "nsDOMXULCommandEvent.h"
+#include "mozilla/dom/XULCommandEvent.h"
 #include "prtime.h"
 
-using namespace mozilla;
+namespace mozilla {
+namespace dom {
 
-nsDOMXULCommandEvent::nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
-                                           nsPresContext* aPresContext,
-                                           WidgetInputEvent* aEvent)
+XULCommandEvent::XULCommandEvent(EventTarget* aOwner,
+                                 nsPresContext* aPresContext,
+                                 WidgetInputEvent* aEvent)
   : nsDOMUIEvent(aOwner, aPresContext,
                  aEvent ? aEvent : new WidgetInputEvent(false, 0, nullptr))
 {
   if (aEvent) {
     mEventIsInternal = false;
   }
   else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
 }
 
-NS_IMPL_ADDREF_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
+NS_IMPL_ADDREF_INHERITED(XULCommandEvent, nsDOMUIEvent)
+NS_IMPL_RELEASE_INHERITED(XULCommandEvent, nsDOMUIEvent)
 
-NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsDOMXULCommandEvent, nsDOMUIEvent,
+NS_IMPL_CYCLE_COLLECTION_INHERITED_1(XULCommandEvent, nsDOMUIEvent,
                                      mSourceEvent)
 
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMXULCommandEvent)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XULCommandEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMXULCommandEvent)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
 
 bool
-nsDOMXULCommandEvent::AltKey()
+XULCommandEvent::AltKey()
 {
   return mEvent->AsInputEvent()->IsAlt();
 }
 
 NS_IMETHODIMP
-nsDOMXULCommandEvent::GetAltKey(bool* aIsDown)
+XULCommandEvent::GetAltKey(bool* aIsDown)
 {
   NS_ENSURE_ARG_POINTER(aIsDown);
   *aIsDown = AltKey();
   return NS_OK;
 }
 
 bool
-nsDOMXULCommandEvent::CtrlKey()
+XULCommandEvent::CtrlKey()
 {
   return mEvent->AsInputEvent()->IsControl();
 }
 
 NS_IMETHODIMP
-nsDOMXULCommandEvent::GetCtrlKey(bool* aIsDown)
+XULCommandEvent::GetCtrlKey(bool* aIsDown)
 {
   NS_ENSURE_ARG_POINTER(aIsDown);
   *aIsDown = CtrlKey();
   return NS_OK;
 }
 
 bool
-nsDOMXULCommandEvent::ShiftKey()
+XULCommandEvent::ShiftKey()
 {
   return mEvent->AsInputEvent()->IsShift();
 }
 
 NS_IMETHODIMP
-nsDOMXULCommandEvent::GetShiftKey(bool* aIsDown)
+XULCommandEvent::GetShiftKey(bool* aIsDown)
 {
   NS_ENSURE_ARG_POINTER(aIsDown);
   *aIsDown = ShiftKey();
   return NS_OK;
 }
 
 bool
-nsDOMXULCommandEvent::MetaKey()
+XULCommandEvent::MetaKey()
 {
   return mEvent->AsInputEvent()->IsMeta();
 }
 
 NS_IMETHODIMP
-nsDOMXULCommandEvent::GetMetaKey(bool* aIsDown)
+XULCommandEvent::GetMetaKey(bool* aIsDown)
 {
   NS_ENSURE_ARG_POINTER(aIsDown);
   *aIsDown = MetaKey();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMXULCommandEvent::GetSourceEvent(nsIDOMEvent** aSourceEvent)
+XULCommandEvent::GetSourceEvent(nsIDOMEvent** aSourceEvent)
 {
   NS_ENSURE_ARG_POINTER(aSourceEvent);
   *aSourceEvent = GetSourceEvent().get();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMXULCommandEvent::InitCommandEvent(const nsAString& aType,
-                                       bool aCanBubble, bool aCancelable,
-                                       nsIDOMWindow* aView,
-                                       int32_t aDetail,
-                                       bool aCtrlKey, bool aAltKey,
-                                       bool aShiftKey, bool aMetaKey,
-                                       nsIDOMEvent* aSourceEvent)
+XULCommandEvent::InitCommandEvent(const nsAString& aType,
+                                  bool aCanBubble,
+                                  bool aCancelable,
+                                  nsIDOMWindow* aView,
+                                  int32_t aDetail,
+                                  bool aCtrlKey,
+                                  bool aAltKey,
+                                  bool aShiftKey,
+                                  bool aMetaKey,
+                                  nsIDOMEvent* aSourceEvent)
 {
   nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable,
                                           aView, aDetail);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mEvent->AsInputEvent()->InitBasicModifiers(aCtrlKey, aAltKey,
                                              aShiftKey, aMetaKey);
   mSourceEvent = aSourceEvent;
 
   return NS_OK;
 }
 
+} // namespace dom
+} // namespace mozilla
 
-nsresult NS_NewDOMXULCommandEvent(nsIDOMEvent** aInstancePtrResult,
-                                  mozilla::dom::EventTarget* aOwner,
-                                  nsPresContext* aPresContext,
-                                  WidgetInputEvent* aEvent) 
+using namespace mozilla;
+using namespace mozilla::dom;
+
+nsresult
+NS_NewDOMXULCommandEvent(nsIDOMEvent** aInstancePtrResult,
+                         EventTarget* aOwner,
+                         nsPresContext* aPresContext,
+                         WidgetInputEvent* aEvent) 
 {
-  nsDOMXULCommandEvent* it =
-    new nsDOMXULCommandEvent(aOwner, aPresContext, aEvent);
+  XULCommandEvent* it = new XULCommandEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(it, aInstancePtrResult);
 }
rename from dom/events/nsDOMXULCommandEvent.h
rename to dom/events/XULCommandEvent.h
--- a/dom/events/nsDOMXULCommandEvent.h
+++ b/dom/events/XULCommandEvent.h
@@ -1,42 +1,45 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* 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/. */
 
 // This class implements a XUL "command" event.  See nsIDOMXULCommandEvent.idl
 
-#ifndef nsDOMXULCommandEvent_h_
-#define nsDOMXULCommandEvent_h_
+#ifndef mozilla_dom_XULCommandEvent_h_
+#define mozilla_dom_XULCommandEvent_h_
 
 #include "nsDOMUIEvent.h"
 #include "nsIDOMXULCommandEvent.h"
 #include "mozilla/dom/XULCommandEventBinding.h"
 
-class nsDOMXULCommandEvent : public nsDOMUIEvent,
-                             public nsIDOMXULCommandEvent
+namespace mozilla {
+namespace dom {
+
+class XULCommandEvent : public nsDOMUIEvent,
+                        public nsIDOMXULCommandEvent
 {
 public:
-  nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
-                       nsPresContext* aPresContext,
-                       mozilla::WidgetInputEvent* aEvent);
+  XULCommandEvent(EventTarget* aOwner,
+                  nsPresContext* aPresContext,
+                  WidgetInputEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
+  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULCommandEvent, nsDOMUIEvent)
   NS_DECL_NSIDOMXULCOMMANDEVENT
 
   // Forward our inherited virtual methods to the base class
   NS_FORWARD_TO_NSDOMUIEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
-    return mozilla::dom::XULCommandEventBinding::Wrap(aCx, aScope, this);
+    return XULCommandEventBinding::Wrap(aCx, aScope, this);
   }
 
   bool AltKey();
   bool CtrlKey();
   bool ShiftKey();
   bool MetaKey();
 
   already_AddRefed<nsDOMEvent> GetSourceEvent()
@@ -48,20 +51,23 @@ public:
 
   void InitCommandEvent(const nsAString& aType,
                         bool aCanBubble, bool aCancelable,
                         nsIDOMWindow* aView,
                         int32_t aDetail,
                         bool aCtrlKey, bool aAltKey,
                         bool aShiftKey, bool aMetaKey,
                         nsDOMEvent* aSourceEvent,
-                        mozilla::ErrorResult& aRv)
+                        ErrorResult& aRv)
   {
     aRv = InitCommandEvent(aType, aCanBubble, aCancelable, aView, aDetail,
                            aCtrlKey, aAltKey, aShiftKey, aMetaKey,
                            aSourceEvent);
   }
 
 protected:
   nsCOMPtr<nsIDOMEvent> mSourceEvent;
 };
 
-#endif  // nsDOMXULCommandEvent_h_
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_XULCommandEvent_h_
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -53,16 +53,17 @@ EXPORTS.mozilla.dom += [
     'MutationEvent.h',
     'NotifyAudioAvailableEvent.h',
     'PointerEvent.h',
     'SimpleGestureEvent.h',
     'Touch.h',
     'TouchEvent.h',
     'TransitionEvent.h',
     'WheelEvent.h',
+    'XULCommandEvent.h',
 ]
 
 if CONFIG['MOZ_WEBSPEECH']:
     EXPORTS.mozilla.dom += ['SpeechRecognitionError.h']
 
 UNIFIED_SOURCES += [
     'AnimationEvent.cpp',
     'BeforeUnloadEvent.cpp',
@@ -80,30 +81,30 @@ UNIFIED_SOURCES += [
     'MouseEvent.cpp',
     'MouseScrollEvent.cpp',
     'MutationEvent.cpp',
     'NotifyAudioAvailableEvent.cpp',
     'nsAsyncDOMEvent.cpp',
     'nsContentEventHandler.cpp',
     'nsDOMEventTargetHelper.cpp',
     'nsDOMTextEvent.cpp',
-    'nsDOMXULCommandEvent.cpp',
     'nsEventDispatcher.cpp',
     'nsEventListenerService.cpp',
     'nsIMEStateManager.cpp',
     'nsJSEventListener.cpp',
     'nsPaintRequest.cpp',
     'nsPrivateTextRange.cpp',
     'PointerEvent.cpp',
     'SimpleGestureEvent.cpp',
     'TextComposition.cpp',
     'Touch.cpp',
     'TouchEvent.cpp',
     'TransitionEvent.cpp',
     'WheelEvent.cpp',
+    'XULCommandEvent.cpp',
 ]
 
 SOURCES += [
     # nsDOMEvent.cpp should be built separately because it includes
     # ipc/IPCMessageUtils.h, which on Windows includes windows.h.
     'nsDOMEvent.cpp',
     # nsDOMEvent.cpp should be built separately because it includes
     # ipc/IPCMessageUtils.h, which on Windows includes windows.h.