diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 0953eef05bf1..fc704fa30c93 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -1231,10 +1231,6 @@ DOMInterfaces = { 'headerFile': 'mozilla/dom/TouchEvent.h', }, -'TransitionEvent': { - 'nativeType': 'nsDOMTransitionEvent', -}, - 'TreeColumns': { 'nativeType': 'nsTreeColumns', }, diff --git a/dom/events/nsDOMTransitionEvent.cpp b/dom/events/TransitionEvent.cpp similarity index 52% rename from dom/events/nsDOMTransitionEvent.cpp rename to dom/events/TransitionEvent.cpp index b2722d38e5aa..dc016d633faf 100644 --- a/dom/events/nsDOMTransitionEvent.cpp +++ b/dom/events/TransitionEvent.cpp @@ -3,15 +3,16 @@ * 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 "nsDOMTransitionEvent.h" -#include "prtime.h" +#include "mozilla/dom/TransitionEvent.h" #include "mozilla/ContentEvents.h" +#include "prtime.h" -using namespace mozilla; +namespace mozilla { +namespace dom { -nsDOMTransitionEvent::nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner, - nsPresContext *aPresContext, - InternalTransitionEvent* aEvent) +TransitionEvent::TransitionEvent(EventTarget* aOwner, + nsPresContext* aPresContext, + InternalTransitionEvent* aEvent) : nsDOMEvent(aOwner, aPresContext, aEvent ? aEvent : new InternalTransitionEvent(false, 0)) { @@ -24,22 +25,22 @@ nsDOMTransitionEvent::nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner, } } -NS_INTERFACE_MAP_BEGIN(nsDOMTransitionEvent) +NS_INTERFACE_MAP_BEGIN(TransitionEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMTransitionEvent) NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent) -NS_IMPL_ADDREF_INHERITED(nsDOMTransitionEvent, nsDOMEvent) -NS_IMPL_RELEASE_INHERITED(nsDOMTransitionEvent, nsDOMEvent) +NS_IMPL_ADDREF_INHERITED(TransitionEvent, nsDOMEvent) +NS_IMPL_RELEASE_INHERITED(TransitionEvent, nsDOMEvent) -//static -already_AddRefed -nsDOMTransitionEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal, - const nsAString& aType, - const mozilla::dom::TransitionEventInit& aParam, - mozilla::ErrorResult& aRv) +// static +already_AddRefed +TransitionEvent::Constructor(const GlobalObject& aGlobal, + const nsAString& aType, + const TransitionEventInit& aParam, + ErrorResult& aRv) { - nsCOMPtr t = do_QueryInterface(aGlobal.GetAsSupports()); - nsRefPtr e = new nsDOMTransitionEvent(t, nullptr, nullptr); + nsCOMPtr t = do_QueryInterface(aGlobal.GetAsSupports()); + nsRefPtr e = new TransitionEvent(t, nullptr, nullptr); bool trusted = e->Init(t); aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable); @@ -54,39 +55,44 @@ nsDOMTransitionEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal, } NS_IMETHODIMP -nsDOMTransitionEvent::GetPropertyName(nsAString & aPropertyName) +TransitionEvent::GetPropertyName(nsAString& aPropertyName) { aPropertyName = mEvent->AsTransitionEvent()->propertyName; return NS_OK; } NS_IMETHODIMP -nsDOMTransitionEvent::GetElapsedTime(float *aElapsedTime) +TransitionEvent::GetElapsedTime(float* aElapsedTime) { *aElapsedTime = ElapsedTime(); return NS_OK; } float -nsDOMTransitionEvent::ElapsedTime() +TransitionEvent::ElapsedTime() { return mEvent->AsTransitionEvent()->elapsedTime; } NS_IMETHODIMP -nsDOMTransitionEvent::GetPseudoElement(nsAString& aPseudoElement) +TransitionEvent::GetPseudoElement(nsAString& aPseudoElement) { aPseudoElement = mEvent->AsTransitionEvent()->pseudoElement; return NS_OK; } +} // namespace dom +} // namespace mozilla + +using namespace mozilla; +using namespace mozilla::dom; + nsresult -NS_NewDOMTransitionEvent(nsIDOMEvent **aInstancePtrResult, - mozilla::dom::EventTarget* aOwner, - nsPresContext *aPresContext, +NS_NewDOMTransitionEvent(nsIDOMEvent** aInstancePtrResult, + EventTarget* aOwner, + nsPresContext* aPresContext, InternalTransitionEvent* aEvent) { - nsDOMTransitionEvent *it = - new nsDOMTransitionEvent(aOwner, aPresContext, aEvent); + TransitionEvent *it = new TransitionEvent(aOwner, aPresContext, aEvent); return CallQueryInterface(it, aInstancePtrResult); } diff --git a/dom/events/nsDOMTransitionEvent.h b/dom/events/TransitionEvent.h similarity index 51% rename from dom/events/nsDOMTransitionEvent.h rename to dom/events/TransitionEvent.h index ee243c12a3d9..5bab83b8e05d 100644 --- a/dom/events/nsDOMTransitionEvent.h +++ b/dom/events/TransitionEvent.h @@ -2,8 +2,8 @@ /* 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 nsDOMTransitionEvent_h_ -#define nsDOMTransitionEvent_h_ +#ifndef mozilla_dom_TransitionEvent_h_ +#define mozilla_dom_TransitionEvent_h_ #include "nsDOMEvent.h" #include "nsIDOMTransitionEvent.h" @@ -12,28 +12,31 @@ class nsAString; -class nsDOMTransitionEvent : public nsDOMEvent, - public nsIDOMTransitionEvent +namespace mozilla { +namespace dom { + +class TransitionEvent : public nsDOMEvent, + public nsIDOMTransitionEvent { public: - nsDOMTransitionEvent(mozilla::dom::EventTarget* aOwner, - nsPresContext *aPresContext, - mozilla::InternalTransitionEvent* aEvent); + TransitionEvent(EventTarget* aOwner, + nsPresContext* aPresContext, + InternalTransitionEvent* aEvent); NS_DECL_ISUPPORTS_INHERITED NS_FORWARD_TO_NSDOMEVENT NS_DECL_NSIDOMTRANSITIONEVENT - static already_AddRefed - Constructor(const mozilla::dom::GlobalObject& aGlobal, + static already_AddRefed + Constructor(const GlobalObject& aGlobal, const nsAString& aType, - const mozilla::dom::TransitionEventInit& aParam, - mozilla::ErrorResult& aRv); + const TransitionEventInit& aParam, + ErrorResult& aRv); virtual JSObject* WrapObject(JSContext* aCx, - JS::Handle aScope) MOZ_OVERRIDE + JS::Handle aScope) MOZ_OVERRIDE { - return mozilla::dom::TransitionEventBinding::Wrap(aCx, aScope, this); + return TransitionEventBinding::Wrap(aCx, aScope, this); } // xpidl implementation @@ -43,4 +46,7 @@ public: float ElapsedTime(); }; -#endif /* !defined(nsDOMTransitionEvent_h_) */ +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_TransitionEvent_h_ diff --git a/dom/events/moz.build b/dom/events/moz.build index 5c0852fff715..11b9cc577314 100644 --- a/dom/events/moz.build +++ b/dom/events/moz.build @@ -56,6 +56,7 @@ EXPORTS.mozilla.dom += [ 'SimpleGestureEvent.h', 'Touch.h', 'TouchEvent.h', + 'TransitionEvent.h', 'WheelEvent.h', ] @@ -84,7 +85,6 @@ UNIFIED_SOURCES += [ 'nsContentEventHandler.cpp', 'nsDOMEventTargetHelper.cpp', 'nsDOMTextEvent.cpp', - 'nsDOMTransitionEvent.cpp', 'nsDOMXULCommandEvent.cpp', 'nsEventDispatcher.cpp', 'nsEventListenerService.cpp', @@ -97,6 +97,7 @@ UNIFIED_SOURCES += [ 'TextComposition.cpp', 'Touch.cpp', 'TouchEvent.cpp', + 'TransitionEvent.cpp', 'WheelEvent.cpp', ]