diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index bd02f6b1963..5d65ffd151f 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -1211,10 +1211,6 @@ DOMInterfaces = { 'nativeOwnership': 'owned', }, -'TimeEvent': { - 'nativeType': 'nsDOMTimeEvent', -}, - 'TimeRanges': { 'wrapperCache': False }, diff --git a/dom/smil/nsDOMTimeEvent.cpp b/dom/smil/TimeEvent.cpp similarity index 63% rename from dom/smil/nsDOMTimeEvent.cpp rename to dom/smil/TimeEvent.cpp index c78b0e9446d..65c0d37765c 100644 --- a/dom/smil/nsDOMTimeEvent.cpp +++ b/dom/smil/TimeEvent.cpp @@ -3,16 +3,17 @@ * 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 "nsDOMTimeEvent.h" -#include "nsPresContext.h" -#include "nsIInterfaceRequestorUtils.h" +#include "mozilla/dom/TimeEvent.h" #include "mozilla/BasicEvents.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsPresContext.h" -using namespace mozilla; +namespace mozilla { +namespace dom { -nsDOMTimeEvent::nsDOMTimeEvent(mozilla::dom::EventTarget* aOwner, - nsPresContext* aPresContext, - WidgetEvent* aEvent) +TimeEvent::TimeEvent(EventTarget* aOwner, + nsPresContext* aPresContext, + WidgetEvent* aEvent) : nsDOMEvent(aOwner, aPresContext, aEvent ? aEvent : new InternalUIEvent(false, 0)), mDetail(0) @@ -43,18 +44,18 @@ nsDOMTimeEvent::nsDOMTimeEvent(mozilla::dom::EventTarget* aOwner, } } -NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsDOMTimeEvent, nsDOMEvent, +NS_IMPL_CYCLE_COLLECTION_INHERITED_1(TimeEvent, nsDOMEvent, mView) -NS_IMPL_ADDREF_INHERITED(nsDOMTimeEvent, nsDOMEvent) -NS_IMPL_RELEASE_INHERITED(nsDOMTimeEvent, nsDOMEvent) +NS_IMPL_ADDREF_INHERITED(TimeEvent, nsDOMEvent) +NS_IMPL_RELEASE_INHERITED(TimeEvent, nsDOMEvent) -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMTimeEvent) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TimeEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMTimeEvent) NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent) NS_IMETHODIMP -nsDOMTimeEvent::GetView(nsIDOMWindow** aView) +TimeEvent::GetView(nsIDOMWindow** aView) { *aView = mView; NS_IF_ADDREF(*aView); @@ -62,16 +63,16 @@ nsDOMTimeEvent::GetView(nsIDOMWindow** aView) } NS_IMETHODIMP -nsDOMTimeEvent::GetDetail(int32_t* aDetail) +TimeEvent::GetDetail(int32_t* aDetail) { *aDetail = mDetail; return NS_OK; } NS_IMETHODIMP -nsDOMTimeEvent::InitTimeEvent(const nsAString& aTypeArg, - nsIDOMWindow* aViewArg, - int32_t aDetailArg) +TimeEvent::InitTimeEvent(const nsAString& aTypeArg, + nsIDOMWindow* aViewArg, + int32_t aDetailArg) { nsresult rv = nsDOMEvent::InitEvent(aTypeArg, false /*doesn't bubble*/, false /*can't cancel*/); @@ -83,11 +84,18 @@ nsDOMTimeEvent::InitTimeEvent(const nsAString& aTypeArg, return NS_OK; } -nsresult NS_NewDOMTimeEvent(nsIDOMEvent** aInstancePtrResult, - mozilla::dom::EventTarget* aOwner, - nsPresContext* aPresContext, - WidgetEvent* aEvent) +} // namespace dom +} // namespace mozilla + +using namespace mozilla; +using namespace mozilla::dom; + +nsresult +NS_NewDOMTimeEvent(nsIDOMEvent** aInstancePtrResult, + EventTarget* aOwner, + nsPresContext* aPresContext, + WidgetEvent* aEvent) { - nsDOMTimeEvent* it = new nsDOMTimeEvent(aOwner, aPresContext, aEvent); + TimeEvent* it = new TimeEvent(aOwner, aPresContext, aEvent); return CallQueryInterface(it, aInstancePtrResult); } diff --git a/dom/smil/nsDOMTimeEvent.h b/dom/smil/TimeEvent.h similarity index 63% rename from dom/smil/nsDOMTimeEvent.h rename to dom/smil/TimeEvent.h index a93ba0292ce..a3cd91ca98f 100644 --- a/dom/smil/nsDOMTimeEvent.h +++ b/dom/smil/TimeEvent.h @@ -3,24 +3,27 @@ * 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 NS_DOMTIMEEVENT_H_ -#define NS_DOMTIMEEVENT_H_ +#ifndef mozilla_dom_TimeEvent_h_ +#define mozilla_dom_TimeEvent_h_ #include "nsIDOMTimeEvent.h" #include "nsDOMEvent.h" #include "mozilla/dom/TimeEventBinding.h" -class nsDOMTimeEvent MOZ_FINAL : public nsDOMEvent, - public nsIDOMTimeEvent +namespace mozilla { +namespace dom { + +class TimeEvent MOZ_FINAL : public nsDOMEvent, + public nsIDOMTimeEvent { public: - nsDOMTimeEvent(mozilla::dom::EventTarget* aOwner, - nsPresContext* aPresContext, - mozilla::WidgetEvent* aEvent); + TimeEvent(EventTarget* aOwner, + nsPresContext* aPresContext, + WidgetEvent* aEvent); // nsISupports interface: NS_DECL_ISUPPORTS_INHERITED - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMTimeEvent, nsDOMEvent) + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TimeEvent, nsDOMEvent) // nsIDOMTimeEvent interface: NS_DECL_NSIDOMTIMEEVENT @@ -31,7 +34,7 @@ public: virtual JSObject* WrapObject(JSContext* aCx, JS::Handle aScope) MOZ_OVERRIDE { - return mozilla::dom::TimeEventBinding::Wrap(aCx, aScope, this); + return TimeEventBinding::Wrap(aCx, aScope, this); } int32_t Detail() const @@ -45,7 +48,7 @@ public: } void InitTimeEvent(const nsAString& aType, nsIDOMWindow* aView, - int32_t aDetail, mozilla::ErrorResult& aRv) + int32_t aDetail, ErrorResult& aRv) { aRv = InitTimeEvent(aType, aView, aDetail); } @@ -55,4 +58,7 @@ private: int32_t mDetail; }; -#endif // NS_DOMTIMEEVENT_H_ +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_TimeEvent_h_ diff --git a/dom/smil/moz.build b/dom/smil/moz.build index 166cdc3a49e..f80c40c0bc8 100644 --- a/dom/smil/moz.build +++ b/dom/smil/moz.build @@ -7,7 +7,6 @@ TEST_TOOL_DIRS += ['test'] EXPORTS += [ - 'nsDOMTimeEvent.h', 'nsISMILAttr.h', 'nsISMILType.h', 'nsSMILAnimationController.h', @@ -32,8 +31,11 @@ EXPORTS += [ 'nsSMILValue.h', ] +EXPORTS.mozilla.dom += [ + 'TimeEvent.h', +] + UNIFIED_SOURCES += [ - 'nsDOMTimeEvent.cpp', 'nsSMILAnimationController.cpp', 'nsSMILAnimationFunction.cpp', 'nsSMILCompositor.cpp', @@ -57,6 +59,7 @@ UNIFIED_SOURCES += [ 'SMILEnumType.cpp', 'SMILIntegerType.cpp', 'SMILStringType.cpp', + 'TimeEvent.cpp', ] FAIL_ON_WARNINGS = True