Bug 1354501 - Change event target variable type to EventTarget and rename it to mTarget. r?birtles
That's because the target for web animation events (i.e. finish and cancel)
is an Animation instance.
MozReview-Commit-ID: 5xR325FXUo
--- a/dom/animation/AnimationEventDispatcher.cpp
+++ b/dom/animation/AnimationEventDispatcher.cpp
@@ -12,18 +12,18 @@
namespace mozilla {
NS_IMPL_CYCLE_COLLECTION_CLASS(AnimationEventDispatcher)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AnimationEventDispatcher)
tmp->ClearEventQueue();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(AnimationEventDispatcher)
for (auto& info : tmp->mPendingEvents) {
- ImplCycleCollectionTraverse(cb, info.mElement,
- "mozilla::AnimationEventDispatcher.mPendingEvents.mElement");
+ ImplCycleCollectionTraverse(cb, info.mTarget,
+ "mozilla::AnimationEventDispatcher.mPendingEvents.mTarget");
ImplCycleCollectionTraverse(cb, info.mAnimation,
"mozilla::AnimationEventDispatcher.mPendingEvents.mAnimation");
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AnimationEventDispatcher, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AnimationEventDispatcher, Release)
--- a/dom/animation/AnimationEventDispatcher.h
+++ b/dom/animation/AnimationEventDispatcher.h
@@ -18,31 +18,31 @@
class nsPresContext;
class nsRefreshDriver;
namespace mozilla {
struct AnimationEventInfo
{
- RefPtr<dom::Element> mElement;
+ RefPtr<dom::EventTarget> mTarget;
RefPtr<dom::Animation> mAnimation;
TimeStamp mTimeStamp;
typedef Variant<InternalTransitionEvent, InternalAnimationEvent> EventVariant;
EventVariant mEvent;
// For CSS animation events
AnimationEventInfo(nsAtom* aAnimationName,
const NonOwningAnimationTarget& aTarget,
EventMessage aMessage,
double aElapsedTime,
const TimeStamp& aTimeStamp,
dom::Animation* aAnimation)
- : mElement(aTarget.mElement)
+ : mTarget(aTarget.mElement)
, mAnimation(aAnimation)
, mTimeStamp(aTimeStamp)
, mEvent(EventVariant(InternalAnimationEvent(true, aMessage)))
{
InternalAnimationEvent& event = mEvent.as<InternalAnimationEvent>();
aAnimationName->ToString(event.mAnimationName);
// XXX Looks like nobody initialize WidgetEvent::time
@@ -53,17 +53,17 @@ struct AnimationEventInfo
// For CSS transition events
AnimationEventInfo(nsCSSPropertyID aProperty,
const NonOwningAnimationTarget& aTarget,
EventMessage aMessage,
double aElapsedTime,
const TimeStamp& aTimeStamp,
dom::Animation* aAnimation)
- : mElement(aTarget.mElement)
+ : mTarget(aTarget.mElement)
, mAnimation(aAnimation)
, mTimeStamp(aTimeStamp)
, mEvent(EventVariant(InternalTransitionEvent(true, aMessage)))
{
InternalTransitionEvent& event = mEvent.as<InternalTransitionEvent>();
event.mPropertyName =
NS_ConvertUTF8toUTF16(nsCSSProps::GetStringValue(aProperty));
@@ -123,17 +123,17 @@ public:
EventArray events;
mPendingEvents.SwapElements(events);
// mIsSorted will be set to true by SortEvents above, and we leave it
// that way since mPendingEvents is now empty
for (AnimationEventInfo& info : events) {
MOZ_ASSERT(!info.AsWidgetEvent()->mFlags.mIsBeingDispatched &&
!info.AsWidgetEvent()->mFlags.mDispatchedAtLeastOnce,
"The WidgetEvent should be fresh");
- EventDispatcher::Dispatch(info.mElement,
+ EventDispatcher::Dispatch(info.mTarget,
mPresContext,
info.AsWidgetEvent());
// Bail out if our mPresContext was nullified due to destroying the pres
// context.
if (!mPresContext) {
break;
}