Bug 975688 part.4 Rename nsDOMClipboardEvent to mozilla::dom::ClipboardEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Wed, 26 Feb 2014 14:23:56 +0900
changeset 170978 6abc19b10e911c976bb3006b890a0e14d7802d0c
parent 170977 4966af832a78b267f87ce876df3d28e5934242f9
child 170979 7af67d41d918b36ba01d50925cb1ba1ffbf40e40
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerssmaug
bugs975688
milestone30.0a1
Bug 975688 part.4 Rename nsDOMClipboardEvent to mozilla::dom::ClipboardEvent r=smaug
dom/bindings/Bindings.conf
dom/events/ClipboardEvent.cpp
dom/events/ClipboardEvent.h
dom/events/moz.build
dom/events/nsDOMClipboardEvent.cpp
dom/events/nsDOMClipboardEvent.h
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -229,17 +229,17 @@ DOMInterfaces = {
 },
 
 'DOMRectList': {
     'headerFile': 'mozilla/dom/DOMRect.h',
     'resultNotAddRefed': [ 'item' ]
 },
 
 'ClipboardEvent': {
-    'nativeType': 'nsDOMClipboardEvent',
+    'nativeType': 'mozilla::dom::ClipboardEvent',
 },
 
 'CommandEvent': {
     'nativeType': 'nsDOMCommandEvent',
 },
 
 'CompositionEvent': {
     'nativeType': 'nsDOMCompositionEvent',
rename from dom/events/nsDOMClipboardEvent.cpp
rename to dom/events/ClipboardEvent.cpp
--- a/dom/events/nsDOMClipboardEvent.cpp
+++ b/dom/events/ClipboardEvent.cpp
@@ -1,64 +1,64 @@
 /* -*- 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 "nsDOMClipboardEvent.h"
+#include "mozilla/dom/ClipboardEvent.h"
+#include "mozilla/ContentEvents.h"
 #include "nsDOMDataTransfer.h"
 #include "nsIClipboard.h"
-#include "mozilla/ContentEvents.h"
 
-using namespace mozilla;
+namespace mozilla {
+namespace dom {
 
-nsDOMClipboardEvent::nsDOMClipboardEvent(mozilla::dom::EventTarget* aOwner,
-                                         nsPresContext* aPresContext,
-                                         InternalClipboardEvent* aEvent)
+ClipboardEvent::ClipboardEvent(EventTarget* aOwner,
+                               nsPresContext* aPresContext,
+                               InternalClipboardEvent* aEvent)
   : nsDOMEvent(aOwner, aPresContext, aEvent ? aEvent :
                new InternalClipboardEvent(false, 0))
 {
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
 }
 
-NS_INTERFACE_MAP_BEGIN(nsDOMClipboardEvent)
+NS_INTERFACE_MAP_BEGIN(ClipboardEvent)
   NS_INTERFACE_MAP_ENTRY(nsIDOMClipboardEvent)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
 
-NS_IMPL_ADDREF_INHERITED(nsDOMClipboardEvent, nsDOMEvent)
-NS_IMPL_RELEASE_INHERITED(nsDOMClipboardEvent, nsDOMEvent)
+NS_IMPL_ADDREF_INHERITED(ClipboardEvent, nsDOMEvent)
+NS_IMPL_RELEASE_INHERITED(ClipboardEvent, nsDOMEvent)
 
 nsresult
-nsDOMClipboardEvent::InitClipboardEvent(const nsAString& aType,
-                                        bool aCanBubble,
-                                        bool aCancelable,
-                                        nsIDOMDataTransfer* aClipboardData)
+ClipboardEvent::InitClipboardEvent(const nsAString& aType,
+                                   bool aCanBubble,
+                                   bool aCancelable,
+                                   nsIDOMDataTransfer* aClipboardData)
 {
   nsresult rv = nsDOMEvent::InitEvent(aType, aCanBubble, aCancelable);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mEvent->AsClipboardEvent()->clipboardData = aClipboardData;
 
   return NS_OK;
 }
 
-already_AddRefed<nsDOMClipboardEvent>
-nsDOMClipboardEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
-                                 const nsAString& aType,
-                                 const mozilla::dom::ClipboardEventInit& aParam,
-                                 mozilla::ErrorResult& aRv)
+already_AddRefed<ClipboardEvent>
+ClipboardEvent::Constructor(const GlobalObject& aGlobal,
+                            const nsAString& aType,
+                            const ClipboardEventInit& aParam,
+                            ErrorResult& aRv)
 {
-  nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
-  nsRefPtr<nsDOMClipboardEvent> e =
-    new nsDOMClipboardEvent(t, nullptr, nullptr);
+  nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
+  nsRefPtr<ClipboardEvent> e = new ClipboardEvent(t, nullptr, nullptr);
   bool trusted = e->Init(t);
 
   nsRefPtr<nsDOMDataTransfer> clipboardData;
   if (e->mEventIsInternal) {
     InternalClipboardEvent* event = e->mEvent->AsClipboardEvent();
     if (event) {
       // Always create a clipboardData for the copy event. If this is changed to
       // support other types of events, make sure that read/write privileges are
@@ -70,40 +70,46 @@ nsDOMClipboardEvent::Constructor(const m
 
   aRv = e->InitClipboardEvent(aType, aParam.mBubbles, aParam.mCancelable,
                               clipboardData);
   e->SetTrusted(trusted);
   return e.forget();
 }
 
 NS_IMETHODIMP
-nsDOMClipboardEvent::GetClipboardData(nsIDOMDataTransfer** aClipboardData)
+ClipboardEvent::GetClipboardData(nsIDOMDataTransfer** aClipboardData)
 {
   NS_IF_ADDREF(*aClipboardData = GetClipboardData());
   return NS_OK;
 }
 
 nsIDOMDataTransfer*
-nsDOMClipboardEvent::GetClipboardData()
+ClipboardEvent::GetClipboardData()
 {
   InternalClipboardEvent* event = mEvent->AsClipboardEvent();
 
   if (!event->clipboardData) {
     if (mEventIsInternal) {
       event->clipboardData = new nsDOMDataTransfer(NS_COPY, false, -1);
     } else {
       event->clipboardData =
         new nsDOMDataTransfer(event->message, event->message == NS_PASTE, nsIClipboard::kGlobalClipboard);
     }
   }
 
   return event->clipboardData;
 }
 
-nsresult NS_NewDOMClipboardEvent(nsIDOMEvent** aInstancePtrResult,
-                                 mozilla::dom::EventTarget* aOwner,
-                                 nsPresContext* aPresContext,
-                                 InternalClipboardEvent* aEvent)
+} // namespace dom
+} // namespace mozilla
+
+using namespace mozilla;
+using namespace mozilla::dom;
+
+nsresult
+NS_NewDOMClipboardEvent(nsIDOMEvent** aInstancePtrResult,
+                        EventTarget* aOwner,
+                        nsPresContext* aPresContext,
+                        InternalClipboardEvent* aEvent)
 {
-  nsDOMClipboardEvent* it =
-    new nsDOMClipboardEvent(aOwner, aPresContext, aEvent);
+  ClipboardEvent* it = new ClipboardEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(it, aInstancePtrResult);
 }
rename from dom/events/nsDOMClipboardEvent.h
rename to dom/events/ClipboardEvent.h
--- a/dom/events/nsDOMClipboardEvent.h
+++ b/dom/events/ClipboardEvent.h
@@ -1,44 +1,50 @@
 /* -*- 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 nsDOMClipboardEvent_h_
-#define nsDOMClipboardEvent_h_
+#ifndef mozilla_dom_ClipboardEvent_h_
+#define mozilla_dom_ClipboardEvent_h_
 
 #include "nsIDOMClipboardEvent.h"
 #include "nsDOMEvent.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/dom/ClipboardEventBinding.h"
 
-class nsDOMClipboardEvent : public nsDOMEvent,
-                            public nsIDOMClipboardEvent
+namespace mozilla {
+namespace dom {
+
+class ClipboardEvent : public nsDOMEvent,
+                       public nsIDOMClipboardEvent
 {
 public:
-  nsDOMClipboardEvent(mozilla::dom::EventTarget* aOwner,
-                      nsPresContext* aPresContext,
-                      mozilla::InternalClipboardEvent* aEvent);
+  ClipboardEvent(EventTarget* aOwner,
+                 nsPresContext* aPresContext,
+                 InternalClipboardEvent* aEvent);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_NSIDOMCLIPBOARDEVENT
 
   // Forward to base class
   NS_FORWARD_TO_NSDOMEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
-    return mozilla::dom::ClipboardEventBinding::Wrap(aCx, aScope, this);
+    return ClipboardEventBinding::Wrap(aCx, aScope, this);
   }
 
-  static already_AddRefed<nsDOMClipboardEvent>
-  Constructor(const mozilla::dom::GlobalObject& aGlobal,
+  static already_AddRefed<ClipboardEvent>
+  Constructor(const GlobalObject& aGlobal,
               const nsAString& aType,
-              const mozilla::dom::ClipboardEventInit& aParam,
-              mozilla::ErrorResult& aRv);
+              const ClipboardEventInit& aParam,
+              ErrorResult& aRv);
 
   nsIDOMDataTransfer* GetClipboardData();
 };
 
-#endif // nsDOMClipboardEvent_h_
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_ClipboardEvent_h_
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -33,32 +33,33 @@ EXPORTS += [
 
 EXPORTS.mozilla += [
     'MutationEvent.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'AnimationEvent.h',
     'BeforeUnloadEvent.h',
+    'ClipboardEvent.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',
     'EventTarget.cpp',
     'nsAsyncDOMEvent.cpp',
     'nsContentEventHandler.cpp',
-    'nsDOMClipboardEvent.cpp',
     'nsDOMCommandEvent.cpp',
     'nsDOMCompositionEvent.cpp',
     'nsDOMDataContainerEvent.cpp',
     'nsDOMDataTransfer.cpp',
     'nsDOMDeviceMotionEvent.cpp',
     'nsDOMDragEvent.cpp',
     'nsDOMEventTargetHelper.cpp',
     'nsDOMFocusEvent.cpp',