Bug 975688 part.10 Rename nsDOMFocusEvent to mozilla::dom::FocusEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 27 Feb 2014 19:51:13 +0900
changeset 171272 25906d620c44a8795d8c5ccc6e759be39a54207a
parent 171271 fd1c82a9839a0b3663b8a1860813a7d80094d4ae
child 171273 449bb2ddc4f1be5a37ed49f133f366a9a60e4a6a
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewerssmaug
bugs975688
milestone30.0a1
Bug 975688 part.10 Rename nsDOMFocusEvent to mozilla::dom::FocusEvent r=smaug
dom/bindings/Bindings.conf
dom/events/FocusEvent.cpp
dom/events/FocusEvent.h
dom/events/moz.build
dom/events/nsDOMFocusEvent.cpp
dom/events/nsDOMFocusEvent.h
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -439,20 +439,16 @@ DOMInterfaces = {
     'nativeType': 'nsFormData'
 },
 {
     'workers': True,
     'skipGen': True,
     'nativeType': 'JSObject'
 }],
 
-'FocusEvent': {
-    'nativeType': 'nsDOMFocusEvent',
-},
-
 'GainNode': {
     'resultNotAddRefed': [ 'gain' ],
 },
 
 'Geolocation': {
     'headerFile': 'nsGeolocation.h'
 },
 
rename from dom/events/nsDOMFocusEvent.cpp
rename to dom/events/FocusEvent.cpp
--- a/dom/events/nsDOMFocusEvent.cpp
+++ b/dom/events/FocusEvent.cpp
@@ -1,81 +1,88 @@
 /* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
 /* 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 "nsDOMFocusEvent.h"
+#include "mozilla/dom/FocusEvent.h"
+#include "mozilla/ContentEvents.h"
 #include "prtime.h"
-#include "mozilla/ContentEvents.h"
 
-using namespace mozilla;
-using namespace mozilla::dom;
+namespace mozilla {
+namespace dom {
 
-NS_IMPL_ISUPPORTS_INHERITED1(nsDOMFocusEvent, nsDOMUIEvent, nsIDOMFocusEvent)
+NS_IMPL_ISUPPORTS_INHERITED1(FocusEvent, nsDOMUIEvent, nsIDOMFocusEvent)
 
-nsDOMFocusEvent::nsDOMFocusEvent(mozilla::dom::EventTarget* aOwner,
-                                 nsPresContext* aPresContext,
-                                 InternalFocusEvent* aEvent)
+FocusEvent::FocusEvent(EventTarget* aOwner,
+                       nsPresContext* aPresContext,
+                       InternalFocusEvent* aEvent)
   : nsDOMUIEvent(aOwner, aPresContext,
                  aEvent ? aEvent :
                           new InternalFocusEvent(false, NS_FOCUS_CONTENT))
 {
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
 }
 
 /* readonly attribute nsIDOMEventTarget relatedTarget; */
 NS_IMETHODIMP
-nsDOMFocusEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
+FocusEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
 {
   NS_ENSURE_ARG_POINTER(aRelatedTarget);
   NS_IF_ADDREF(*aRelatedTarget = GetRelatedTarget());
   return NS_OK;
 }
 
-mozilla::dom::EventTarget*
-nsDOMFocusEvent::GetRelatedTarget()
+EventTarget*
+FocusEvent::GetRelatedTarget()
 {
   return mEvent->AsFocusEvent()->relatedTarget;
 }
 
 nsresult
-nsDOMFocusEvent::InitFocusEvent(const nsAString& aType,
-                                bool aCanBubble,
-                                bool aCancelable,
-                                nsIDOMWindow* aView,
-                                int32_t aDetail,
-                                mozilla::dom::EventTarget* aRelatedTarget)
+FocusEvent::InitFocusEvent(const nsAString& aType,
+                           bool aCanBubble,
+                           bool aCancelable,
+                           nsIDOMWindow* aView,
+                           int32_t aDetail,
+                           EventTarget* aRelatedTarget)
 {
   nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
   NS_ENSURE_SUCCESS(rv, rv);
   mEvent->AsFocusEvent()->relatedTarget = aRelatedTarget;
   return NS_OK;
 }
 
-already_AddRefed<nsDOMFocusEvent>
-nsDOMFocusEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
-                             const nsAString& aType,
-                             const mozilla::dom::FocusEventInit& aParam,
-                             mozilla::ErrorResult& aRv)
+already_AddRefed<FocusEvent>
+FocusEvent::Constructor(const GlobalObject& aGlobal,
+                        const nsAString& aType,
+                        const FocusEventInit& aParam,
+                        ErrorResult& aRv)
 {
-  nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
-  nsRefPtr<nsDOMFocusEvent> e = new nsDOMFocusEvent(t, nullptr, nullptr);
+  nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
+  nsRefPtr<FocusEvent> e = new FocusEvent(t, nullptr, nullptr);
   bool trusted = e->Init(t);
   aRv = e->InitFocusEvent(aType, aParam.mBubbles, aParam.mCancelable, aParam.mView,
                           aParam.mDetail, aParam.mRelatedTarget);
   e->SetTrusted(trusted);
   return e.forget();
 }
 
-nsresult NS_NewDOMFocusEvent(nsIDOMEvent** aInstancePtrResult,
-                             mozilla::dom::EventTarget* aOwner,
-                             nsPresContext* aPresContext,
-                             InternalFocusEvent* aEvent)
+} // namespace dom
+} // namespace mozilla
+
+using namespace mozilla;
+using namespace mozilla::dom;
+
+nsresult
+NS_NewDOMFocusEvent(nsIDOMEvent** aInstancePtrResult,
+                    EventTarget* aOwner,
+                    nsPresContext* aPresContext,
+                    InternalFocusEvent* aEvent)
 {
-  nsDOMFocusEvent* it = new nsDOMFocusEvent(aOwner, aPresContext, aEvent);
+  FocusEvent* it = new FocusEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(it, aInstancePtrResult);
 }
rename from dom/events/nsDOMFocusEvent.h
rename to dom/events/FocusEvent.h
--- a/dom/events/nsDOMFocusEvent.h
+++ b/dom/events/FocusEvent.h
@@ -1,48 +1,54 @@
 /* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
 /* 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 nsDOMFocusEvent_h_
-#define nsDOMFocusEvent_h_
+#ifndef mozilla_dom_FocusEvent_h_
+#define mozilla_dom_FocusEvent_h_
 
 #include "nsDOMUIEvent.h"
 #include "nsIDOMFocusEvent.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/dom/FocusEventBinding.h"
 
-class nsDOMFocusEvent : public nsDOMUIEvent,
-                        public nsIDOMFocusEvent
+namespace mozilla {
+namespace dom {
+
+class FocusEvent : public nsDOMUIEvent,
+                   public nsIDOMFocusEvent
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMFOCUSEVENT
 
   // Forward to base class
   NS_FORWARD_TO_NSDOMUIEVENT
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
-    return mozilla::dom::FocusEventBinding::Wrap(aCx, aScope, this);
+    return FocusEventBinding::Wrap(aCx, aScope, this);
   }
 
-  nsDOMFocusEvent(mozilla::dom::EventTarget* aOwner,
-                  nsPresContext* aPresContext,
-                  mozilla::InternalFocusEvent* aEvent);
+  FocusEvent(EventTarget* aOwner,
+             nsPresContext* aPresContext,
+             InternalFocusEvent* aEvent);
 
-  mozilla::dom::EventTarget* GetRelatedTarget();
+  EventTarget* GetRelatedTarget();
 
-  static already_AddRefed<nsDOMFocusEvent> Constructor(const mozilla::dom::GlobalObject& aGlobal,
-                                                       const nsAString& aType,
-                                                       const mozilla::dom::FocusEventInit& aParam,
-                                                       mozilla::ErrorResult& aRv);
+  static already_AddRefed<FocusEvent> Constructor(const GlobalObject& aGlobal,
+                                                  const nsAString& aType,
+                                                  const FocusEventInit& aParam,
+                                                  ErrorResult& aRv);
 protected:
   nsresult InitFocusEvent(const nsAString& aType,
                           bool aCanBubble,
                           bool aCancelable,
                           nsIDOMWindow* aView,
                           int32_t aDetail,
-                          mozilla::dom::EventTarget* aRelatedTarget);
+                          EventTarget* aRelatedTarget);
 };
 
-#endif /* !defined(nsDOMFocusEvent_h_) */
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_FocusEvent_h_
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -41,16 +41,17 @@ EXPORTS.mozilla.dom += [
     'ClipboardEvent.h',
     'CommandEvent.h',
     'CompositionEvent.h',
     'DataContainerEvent.h',
     'DataTransfer.h',
     'DeviceMotionEvent.h',
     'DragEvent.h',
     'EventTarget.h',
+    'FocusEvent.h',
     'PointerEvent.h',
     'Touch.h',
     'WheelEvent.h',
 ]
 
 if CONFIG['MOZ_WEBSPEECH']:
     EXPORTS.mozilla.dom += ['SpeechRecognitionError.h']
 
@@ -60,20 +61,20 @@ UNIFIED_SOURCES += [
     'ClipboardEvent.cpp',
     'CommandEvent.cpp',
     'CompositionEvent.cpp',
     'DataContainerEvent.cpp',
     'DataTransfer.cpp',
     'DeviceMotionEvent.cpp',
     'DragEvent.cpp',
     'EventTarget.cpp',
+    'FocusEvent.cpp',
     'nsAsyncDOMEvent.cpp',
     'nsContentEventHandler.cpp',
     'nsDOMEventTargetHelper.cpp',
-    'nsDOMFocusEvent.cpp',
     'nsDOMKeyboardEvent.cpp',
     'nsDOMMessageEvent.cpp',
     'nsDOMMouseEvent.cpp',
     'nsDOMMouseScrollEvent.cpp',
     'nsDOMMutationEvent.cpp',
     'nsDOMNotifyAudioAvailableEvent.cpp',
     'nsDOMSimpleGestureEvent.cpp',
     'nsDOMTextEvent.cpp',