Bug 975688 part.6 Rename nsDOMCompositionEvent to mozilla::dom::CompositionEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 26 Feb 2014 14:23:57 +0900
changeset 170980 15320fc9ba1c8cb982ebc87661a3814ec9ab8cf3
parent 170979 7af67d41d918b36ba01d50925cb1ba1ffbf40e40
child 170981 e41a9f01d2176cd55af4762c546d521d3ea3b6ee
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerssmaug
bugs975688
milestone30.0a1
Bug 975688 part.6 Rename nsDOMCompositionEvent to mozilla::dom::CompositionEvent r=smaug
dom/bindings/Bindings.conf
dom/events/CompositionEvent.cpp
dom/events/CompositionEvent.h
dom/events/moz.build
dom/events/nsDOMCompositionEvent.cpp
dom/events/nsDOMCompositionEvent.h
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -237,17 +237,17 @@ DOMInterfaces = {
     'nativeType': 'mozilla::dom::ClipboardEvent',
 },
 
 'CommandEvent': {
     'nativeType': 'mozilla::dom::CommandEvent',
 },
 
 'CompositionEvent': {
-    'nativeType': 'nsDOMCompositionEvent',
+    'nativeType': 'mozilla::dom::CompositionEvent',
 },
 
 'ConvolverNode': {
     'implicitJSContext': [ 'buffer' ],
     'resultNotAddRefed': [ 'buffer' ],
 },
 
 'Coordinates': {
rename from dom/events/nsDOMCompositionEvent.cpp
rename to dom/events/CompositionEvent.cpp
--- a/dom/events/nsDOMCompositionEvent.cpp
+++ b/dom/events/CompositionEvent.cpp
@@ -1,23 +1,24 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* 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 "nsDOMCompositionEvent.h"
+#include "mozilla/dom/CompositionEvent.h"
+#include "mozilla/TextEvents.h"
 #include "prtime.h"
-#include "mozilla/TextEvents.h"
 
-using namespace mozilla;
+namespace mozilla {
+namespace dom {
 
-nsDOMCompositionEvent::nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
-                                             nsPresContext* aPresContext,
-                                             WidgetCompositionEvent* aEvent)
+CompositionEvent::CompositionEvent(EventTarget* aOwner,
+                                   nsPresContext* aPresContext,
+                                   WidgetCompositionEvent* aEvent)
   : nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
                  new WidgetCompositionEvent(false, 0, nullptr))
 {
   NS_ASSERTION(mEvent->eventStructType == NS_COMPOSITION_EVENT,
                "event type mismatch");
 
   if (aEvent) {
     mEventIsInternal = false;
@@ -30,56 +31,61 @@ nsDOMCompositionEvent::nsDOMCompositionE
     //     when we sends compositionstart event.
     mEvent->mFlags.mCancelable = false;
   }
 
   mData = mEvent->AsCompositionEvent()->data;
   // TODO: Native event should have locale information.
 }
 
-NS_IMPL_ADDREF_INHERITED(nsDOMCompositionEvent, nsDOMUIEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMCompositionEvent, nsDOMUIEvent)
+NS_IMPL_ADDREF_INHERITED(CompositionEvent, nsDOMUIEvent)
+NS_IMPL_RELEASE_INHERITED(CompositionEvent, nsDOMUIEvent)
 
-NS_INTERFACE_MAP_BEGIN(nsDOMCompositionEvent)
+NS_INTERFACE_MAP_BEGIN(CompositionEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMCompositionEvent)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
 
 NS_IMETHODIMP
-nsDOMCompositionEvent::GetData(nsAString& aData)
+CompositionEvent::GetData(nsAString& aData)
 {
   aData = mData;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMCompositionEvent::GetLocale(nsAString& aLocale)
+CompositionEvent::GetLocale(nsAString& aLocale)
 {
   aLocale = mLocale;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMCompositionEvent::InitCompositionEvent(const nsAString& aType,
-                                            bool aCanBubble,
-                                            bool aCancelable,
-                                            nsIDOMWindow* aView,
-                                            const nsAString& aData,
-                                            const nsAString& aLocale)
+CompositionEvent::InitCompositionEvent(const nsAString& aType,
+                                       bool aCanBubble,
+                                       bool aCancelable,
+                                       nsIDOMWindow* aView,
+                                       const nsAString& aData,
+                                       const nsAString& aLocale)
 {
   nsresult rv =
     nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mData = aData;
   mLocale = aLocale;
   return NS_OK;
 }
 
+} // namespace dom
+} // namespace mozilla
+
+using namespace mozilla;
+using namespace mozilla::dom;
+
 nsresult
 NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult,
-                          mozilla::dom::EventTarget* aOwner,
+                          EventTarget* aOwner,
                           nsPresContext* aPresContext,
                           WidgetCompositionEvent* aEvent)
 {
-  nsDOMCompositionEvent* event =
-    new nsDOMCompositionEvent(aOwner, aPresContext, aEvent);
+  CompositionEvent* event = new CompositionEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(event, aInstancePtrResult);
 }
rename from dom/events/nsDOMCompositionEvent.h
rename to dom/events/CompositionEvent.h
--- a/dom/events/nsDOMCompositionEvent.h
+++ b/dom/events/CompositionEvent.h
@@ -1,51 +1,56 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* 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 nsDOMCompositionEvent_h__
-#define nsDOMCompositionEvent_h__
+#ifndef mozilla_dom_CompositionEvent_h_
+#define mozilla_dom_CompositionEvent_h_
 
 #include "nsDOMUIEvent.h"
 #include "nsIDOMCompositionEvent.h"
 #include "mozilla/dom/CompositionEventBinding.h"
 #include "mozilla/EventForwards.h"
 
-class nsDOMCompositionEvent : public nsDOMUIEvent,
-                              public nsIDOMCompositionEvent
+namespace mozilla {
+namespace dom {
+
+class CompositionEvent : public nsDOMUIEvent,
+                         public nsIDOMCompositionEvent
 {
 public:
-  nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
-                        nsPresContext* aPresContext,
-                        mozilla::WidgetCompositionEvent* aEvent);
+  CompositionEvent(EventTarget* aOwner,
+                   nsPresContext* aPresContext,
+                   WidgetCompositionEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_FORWARD_TO_NSDOMUIEVENT
   NS_DECL_NSIDOMCOMPOSITIONEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
-    return mozilla::dom::CompositionEventBinding::Wrap(aCx, aScope, this);
+    return CompositionEventBinding::Wrap(aCx, aScope, this);
   }
 
-  void
-  InitCompositionEvent(const nsAString& aType,
-                       bool aCanBubble,
-                       bool aCancelable,
-                       nsIDOMWindow* aView,
-                       const nsAString& aData,
-                       const nsAString& aLocale,
-                       mozilla::ErrorResult& aRv)
+  void InitCompositionEvent(const nsAString& aType,
+                            bool aCanBubble,
+                            bool aCancelable,
+                            nsIDOMWindow* aView,
+                            const nsAString& aData,
+                            const nsAString& aLocale,
+                            ErrorResult& aRv)
   {
     aRv = InitCompositionEvent(aType, aCanBubble, aCancelable, aView,
                                aData, aLocale);
   }
 
 protected:
   nsString mData;
   nsString mLocale;
 };
 
-#endif // nsDOMCompositionEvent_h__
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_CompositionEvent_h_
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -35,34 +35,35 @@ EXPORTS.mozilla += [
     'MutationEvent.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'AnimationEvent.h',
     'BeforeUnloadEvent.h',
     'ClipboardEvent.h',
     'CommandEvent.h',
+    'CompositionEvent.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',
+    'CompositionEvent.cpp',
     'EventTarget.cpp',
     'nsAsyncDOMEvent.cpp',
     'nsContentEventHandler.cpp',
-    'nsDOMCompositionEvent.cpp',
     'nsDOMDataContainerEvent.cpp',
     'nsDOMDataTransfer.cpp',
     'nsDOMDeviceMotionEvent.cpp',
     'nsDOMDragEvent.cpp',
     'nsDOMEventTargetHelper.cpp',
     'nsDOMFocusEvent.cpp',
     'nsDOMKeyboardEvent.cpp',
     'nsDOMMessageEvent.cpp',