Bug 975688 part.5 Rename nsDOMCommandEvent to mozilla::dom::CommandEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 26 Feb 2014 14:23:57 +0900
changeset 170625 7af67d41d918b36ba01d50925cb1ba1ffbf40e40
parent 170624 6abc19b10e911c976bb3006b890a0e14d7802d0c
child 170626 15320fc9ba1c8cb982ebc87661a3814ec9ab8cf3
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssmaug
bugs975688
milestone30.0a1
Bug 975688 part.5 Rename nsDOMCommandEvent to mozilla::dom::CommandEvent r=smaug
dom/bindings/Bindings.conf
dom/events/CommandEvent.cpp
dom/events/CommandEvent.h
dom/events/moz.build
dom/events/nsDOMCommandEvent.cpp
dom/events/nsDOMCommandEvent.h
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -233,17 +233,17 @@ DOMInterfaces = {
     'resultNotAddRefed': [ 'item' ]
 },
 
 'ClipboardEvent': {
     'nativeType': 'mozilla::dom::ClipboardEvent',
 },
 
 'CommandEvent': {
-    'nativeType': 'nsDOMCommandEvent',
+    'nativeType': 'mozilla::dom::CommandEvent',
 },
 
 'CompositionEvent': {
     'nativeType': 'nsDOMCompositionEvent',
 },
 
 'ConvolverNode': {
     'implicitJSContext': [ 'buffer' ],
rename from dom/events/nsDOMCommandEvent.cpp
rename to dom/events/CommandEvent.cpp
--- a/dom/events/nsDOMCommandEvent.cpp
+++ b/dom/events/CommandEvent.cpp
@@ -1,66 +1,73 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "mozilla/dom/CommandEvent.h"
+#include "mozilla/MiscEvents.h"
 #include "prtime.h"
-#include "mozilla/MiscEvents.h"
 
-using namespace mozilla;
+namespace mozilla {
+namespace dom {
 
-nsDOMCommandEvent::nsDOMCommandEvent(mozilla::dom::EventTarget* aOwner,
-                                     nsPresContext* aPresContext,
-                                     WidgetCommandEvent* aEvent)
+CommandEvent::CommandEvent(EventTarget* aOwner,
+                           nsPresContext* aPresContext,
+                           WidgetCommandEvent* aEvent)
   : nsDOMEvent(aOwner, aPresContext, aEvent ? aEvent :
                new WidgetCommandEvent(false, nullptr, nullptr, nullptr))
 {
   mEvent->time = PR_Now();
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
   }
 }
 
-NS_INTERFACE_MAP_BEGIN(nsDOMCommandEvent)
+NS_INTERFACE_MAP_BEGIN(CommandEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMCommandEvent)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
 
-NS_IMPL_ADDREF_INHERITED(nsDOMCommandEvent, nsDOMEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMCommandEvent, nsDOMEvent)
+NS_IMPL_ADDREF_INHERITED(CommandEvent, nsDOMEvent)
+NS_IMPL_RELEASE_INHERITED(CommandEvent, nsDOMEvent)
 
 NS_IMETHODIMP
-nsDOMCommandEvent::GetCommand(nsAString& aCommand)
+CommandEvent::GetCommand(nsAString& aCommand)
 {
   nsIAtom* command = mEvent->AsCommandEvent()->command;
   if (command) {
     command->ToString(aCommand);
   } else {
     aCommand.Truncate();
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMCommandEvent::InitCommandEvent(const nsAString& aTypeArg,
-                                    bool aCanBubbleArg,
-                                    bool aCancelableArg,
-                                    const nsAString& aCommand)
+CommandEvent::InitCommandEvent(const nsAString& aTypeArg,
+                               bool aCanBubbleArg,
+                               bool aCancelableArg,
+                               const nsAString& aCommand)
 {
   nsresult rv = nsDOMEvent::InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mEvent->AsCommandEvent()->command = do_GetAtom(aCommand);
   return NS_OK;
 }
 
-nsresult NS_NewDOMCommandEvent(nsIDOMEvent** aInstancePtrResult,
-                               mozilla::dom::EventTarget* aOwner,
-                               nsPresContext* aPresContext,
-                               WidgetCommandEvent* aEvent)
+} // namespace dom
+} // namespace mozilla
+
+using namespace mozilla;
+using namespace mozilla::dom;
+
+nsresult
+NS_NewDOMCommandEvent(nsIDOMEvent** aInstancePtrResult,
+                      EventTarget* aOwner,
+                      nsPresContext* aPresContext,
+                      WidgetCommandEvent* aEvent)
 {
-  nsDOMCommandEvent* it = new nsDOMCommandEvent(aOwner, aPresContext, aEvent);
-
+  CommandEvent* it = new CommandEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(it, aInstancePtrResult);
 }
rename from dom/events/nsDOMCommandEvent.h
rename to dom/events/CommandEvent.h
--- a/dom/events/nsDOMCommandEvent.h
+++ b/dom/events/CommandEvent.h
@@ -1,45 +1,51 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#ifndef nsDOMCommandEvent_h__
-#define nsDOMCommandEvent_h__
+#ifndef mozilla_dom_CommandEvent_h_
+#define mozilla_dom_CommandEvent_h_
 
 #include "nsIDOMCommandEvent.h"
 #include "nsDOMEvent.h"
 #include "mozilla/dom/CommandEventBinding.h"
 #include "mozilla/EventForwards.h"
 
-class nsDOMCommandEvent : public nsDOMEvent,
-                          public nsIDOMCommandEvent
+namespace mozilla {
+namespace dom {
+
+class CommandEvent : public nsDOMEvent,
+                     public nsIDOMCommandEvent
 {
 public:
-  nsDOMCommandEvent(mozilla::dom::EventTarget* aOwner,
-                    nsPresContext* aPresContext,
-                    mozilla::WidgetCommandEvent* aEvent);
+  CommandEvent(EventTarget* aOwner,
+               nsPresContext* aPresContext,
+               WidgetCommandEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_NSIDOMCOMMANDEVENT
 
   // Forward to base class
   NS_FORWARD_TO_NSDOMEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
-    return mozilla::dom::CommandEventBinding::Wrap(aCx, aScope, this);
+    return CommandEventBinding::Wrap(aCx, aScope, this);
   }
 
   void InitCommandEvent(const nsAString& aType,
                         bool aCanBubble,
                         bool aCancelable,
                         const nsAString& aCommand,
-                        mozilla::ErrorResult& aRv)
+                        ErrorResult& aRv)
   {
     aRv = InitCommandEvent(aType, aCanBubble, aCancelable, aCommand);
   }
 };
 
-#endif // nsDOMCommandEvent_h__
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_CommandEvent_h_
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -34,33 +34,34 @@ EXPORTS += [
 EXPORTS.mozilla += [
     'MutationEvent.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'AnimationEvent.h',
     'BeforeUnloadEvent.h',
     'ClipboardEvent.h',
+    'CommandEvent.h',
     'EventTarget.h',
     'PointerEvent.h',
     'Touch.h',
     'WheelEvent.h',
 ]
 
 if CONFIG['MOZ_WEBSPEECH']:
     EXPORTS.mozilla.dom += ['SpeechRecognitionError.h']
 
 UNIFIED_SOURCES += [
     'AnimationEvent.cpp',
     'BeforeUnloadEvent.cpp',
     'ClipboardEvent.cpp',
+    'CommandEvent.cpp',
     'EventTarget.cpp',
     'nsAsyncDOMEvent.cpp',
     'nsContentEventHandler.cpp',
-    'nsDOMCommandEvent.cpp',
     'nsDOMCompositionEvent.cpp',
     'nsDOMDataContainerEvent.cpp',
     'nsDOMDataTransfer.cpp',
     'nsDOMDeviceMotionEvent.cpp',
     'nsDOMDragEvent.cpp',
     'nsDOMEventTargetHelper.cpp',
     'nsDOMFocusEvent.cpp',
     'nsDOMKeyboardEvent.cpp',