Bug 975688 part.2 Rename nsDOMAnimationEvent to mozilla::dom::AnimationEvent r=smaug

--HG--
rename : dom/events/nsDOMAnimationEvent.cpp => dom/events/AnimationEvent.cpp
rename : dom/events/nsDOMAnimationEvent.h => dom/events/AnimationEvent.h
This commit is contained in:
Masayuki Nakano 2014-02-26 14:23:56 +09:00
parent a4dd828377
commit 64ccb1e296
4 changed files with 54 additions and 41 deletions

View File

@ -98,7 +98,7 @@ DOMInterfaces = {
}, },
'AnimationEvent': { 'AnimationEvent': {
'nativeType': 'nsDOMAnimationEvent', 'nativeType': 'mozilla::dom::AnimationEvent',
}, },
'ArchiveReader': { 'ArchiveReader': {

View File

@ -3,15 +3,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDOMAnimationEvent.h" #include "mozilla/dom/AnimationEvent.h"
#include "prtime.h"
#include "mozilla/ContentEvents.h" #include "mozilla/ContentEvents.h"
#include "prtime.h"
using namespace mozilla; namespace mozilla {
namespace dom {
nsDOMAnimationEvent::nsDOMAnimationEvent(mozilla::dom::EventTarget* aOwner, AnimationEvent::AnimationEvent(EventTarget* aOwner,
nsPresContext *aPresContext, nsPresContext* aPresContext,
InternalAnimationEvent* aEvent) InternalAnimationEvent* aEvent)
: nsDOMEvent(aOwner, aPresContext, : nsDOMEvent(aOwner, aPresContext,
aEvent ? aEvent : new InternalAnimationEvent(false, 0)) aEvent ? aEvent : new InternalAnimationEvent(false, 0))
{ {
@ -24,22 +25,22 @@ nsDOMAnimationEvent::nsDOMAnimationEvent(mozilla::dom::EventTarget* aOwner,
} }
} }
NS_INTERFACE_MAP_BEGIN(nsDOMAnimationEvent) NS_INTERFACE_MAP_BEGIN(AnimationEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMAnimationEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMAnimationEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent) NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMAnimationEvent, nsDOMEvent) NS_IMPL_ADDREF_INHERITED(AnimationEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMAnimationEvent, nsDOMEvent) NS_IMPL_RELEASE_INHERITED(AnimationEvent, nsDOMEvent)
//static //static
already_AddRefed<nsDOMAnimationEvent> already_AddRefed<AnimationEvent>
nsDOMAnimationEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal, AnimationEvent::Constructor(const GlobalObject& aGlobal,
const nsAString& aType, const nsAString& aType,
const mozilla::dom::AnimationEventInit& aParam, const AnimationEventInit& aParam,
mozilla::ErrorResult& aRv) ErrorResult& aRv)
{ {
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports()); nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
nsRefPtr<nsDOMAnimationEvent> e = new nsDOMAnimationEvent(t, nullptr, nullptr); nsRefPtr<AnimationEvent> e = new AnimationEvent(t, nullptr, nullptr);
bool trusted = e->Init(t); bool trusted = e->Init(t);
aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable); aRv = e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
@ -54,39 +55,44 @@ nsDOMAnimationEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMAnimationEvent::GetAnimationName(nsAString & aAnimationName) AnimationEvent::GetAnimationName(nsAString& aAnimationName)
{ {
aAnimationName = mEvent->AsAnimationEvent()->animationName; aAnimationName = mEvent->AsAnimationEvent()->animationName;
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMAnimationEvent::GetElapsedTime(float *aElapsedTime) AnimationEvent::GetElapsedTime(float* aElapsedTime)
{ {
*aElapsedTime = ElapsedTime(); *aElapsedTime = ElapsedTime();
return NS_OK; return NS_OK;
} }
float float
nsDOMAnimationEvent::ElapsedTime() AnimationEvent::ElapsedTime()
{ {
return mEvent->AsAnimationEvent()->elapsedTime; return mEvent->AsAnimationEvent()->elapsedTime;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDOMAnimationEvent::GetPseudoElement(nsAString& aPseudoElement) AnimationEvent::GetPseudoElement(nsAString& aPseudoElement)
{ {
aPseudoElement = mEvent->AsAnimationEvent()->pseudoElement; aPseudoElement = mEvent->AsAnimationEvent()->pseudoElement;
return NS_OK; return NS_OK;
} }
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult nsresult
NS_NewDOMAnimationEvent(nsIDOMEvent **aInstancePtrResult, NS_NewDOMAnimationEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner, EventTarget* aOwner,
nsPresContext *aPresContext, nsPresContext* aPresContext,
InternalAnimationEvent *aEvent) InternalAnimationEvent* aEvent)
{ {
nsDOMAnimationEvent* it = AnimationEvent* it = new AnimationEvent(aOwner, aPresContext, aEvent);
new nsDOMAnimationEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult); return CallQueryInterface(it, aInstancePtrResult);
} }

View File

@ -2,8 +2,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMAnimationEvent_h_ #ifndef mozilla_dom_AnimationEvent_h_
#define nsDOMAnimationEvent_h_ #define mozilla_dom_AnimationEvent_h_
#include "nsDOMEvent.h" #include "nsDOMEvent.h"
#include "nsIDOMAnimationEvent.h" #include "nsIDOMAnimationEvent.h"
@ -12,28 +12,31 @@
class nsAString; class nsAString;
class nsDOMAnimationEvent : public nsDOMEvent, namespace mozilla {
public nsIDOMAnimationEvent namespace dom {
class AnimationEvent : public nsDOMEvent,
public nsIDOMAnimationEvent
{ {
public: public:
nsDOMAnimationEvent(mozilla::dom::EventTarget* aOwner, AnimationEvent(EventTarget* aOwner,
nsPresContext *aPresContext, nsPresContext* aPresContext,
mozilla::InternalAnimationEvent* aEvent); InternalAnimationEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_TO_NSDOMEVENT NS_FORWARD_TO_NSDOMEVENT
NS_DECL_NSIDOMANIMATIONEVENT NS_DECL_NSIDOMANIMATIONEVENT
static already_AddRefed<nsDOMAnimationEvent> static already_AddRefed<AnimationEvent>
Constructor(const mozilla::dom::GlobalObject& aGlobal, Constructor(const GlobalObject& aGlobal,
const nsAString& aType, const nsAString& aType,
const mozilla::dom::AnimationEventInit& aParam, const AnimationEventInit& aParam,
mozilla::ErrorResult& aRv); ErrorResult& aRv);
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{ {
return mozilla::dom::AnimationEventBinding::Wrap(aCx, aScope, this); return AnimationEventBinding::Wrap(aCx, aScope, this);
} }
// xpidl implementation // xpidl implementation
@ -43,4 +46,7 @@ public:
float ElapsedTime(); float ElapsedTime();
}; };
#endif /* !defined(nsDOMAnimationEvent_h_) */ } // namespace dom
} // namespace mozilla
#endif // mozilla_dom_AnimationEvent_h_

View File

@ -36,6 +36,7 @@ EXPORTS.mozilla += [
] ]
EXPORTS.mozilla.dom += [ EXPORTS.mozilla.dom += [
'AnimationEvent.h',
'EventTarget.h', 'EventTarget.h',
'PointerEvent.h', 'PointerEvent.h',
'Touch.h', 'Touch.h',
@ -46,10 +47,10 @@ if CONFIG['MOZ_WEBSPEECH']:
EXPORTS.mozilla.dom += ['SpeechRecognitionError.h'] EXPORTS.mozilla.dom += ['SpeechRecognitionError.h']
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'AnimationEvent.cpp',
'EventTarget.cpp', 'EventTarget.cpp',
'nsAsyncDOMEvent.cpp', 'nsAsyncDOMEvent.cpp',
'nsContentEventHandler.cpp', 'nsContentEventHandler.cpp',
'nsDOMAnimationEvent.cpp',
'nsDOMBeforeUnloadEvent.cpp', 'nsDOMBeforeUnloadEvent.cpp',
'nsDOMClipboardEvent.cpp', 'nsDOMClipboardEvent.cpp',
'nsDOMCommandEvent.cpp', 'nsDOMCommandEvent.cpp',