2011-04-12 10:18:44 +04:00
|
|
|
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* 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/. */
|
2011-04-12 10:18:44 +04:00
|
|
|
#ifndef nsAnimationManager_h_
|
|
|
|
#define nsAnimationManager_h_
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-09-25 15:21:20 +04:00
|
|
|
#include "mozilla/ContentEvents.h"
|
2015-08-26 15:56:59 +03:00
|
|
|
#include "mozilla/EventForwards.h"
|
2011-04-12 10:18:44 +04:00
|
|
|
#include "AnimationCommon.h"
|
2015-04-21 04:22:09 +03:00
|
|
|
#include "mozilla/dom/Animation.h"
|
2013-06-23 16:03:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2011-04-12 10:18:44 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2011-04-12 10:18:44 +04:00
|
|
|
|
2015-04-28 09:48:35 +03:00
|
|
|
class nsIGlobalObject;
|
2013-09-16 05:06:52 +04:00
|
|
|
class nsStyleContext;
|
2017-03-06 03:50:09 +03:00
|
|
|
struct nsStyleDisplay;
|
2017-03-06 03:54:06 +03:00
|
|
|
struct ServoComputedValues;
|
2011-04-12 10:18:44 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
2017-03-27 13:43:09 +03:00
|
|
|
struct ServoComputedValuesWithParent;
|
2011-04-12 10:18:44 +04:00
|
|
|
namespace css {
|
|
|
|
class Declaration;
|
2014-10-20 08:55:46 +04:00
|
|
|
} /* namespace css */
|
2014-12-18 02:42:41 +03:00
|
|
|
namespace dom {
|
2015-12-20 16:17:00 +03:00
|
|
|
class KeyframeEffectReadOnly;
|
2014-12-18 02:42:41 +03:00
|
|
|
class Promise;
|
|
|
|
} /* namespace dom */
|
2011-04-12 10:18:44 +04:00
|
|
|
|
2016-02-17 23:37:00 +03:00
|
|
|
enum class CSSPseudoElementType : uint8_t;
|
2017-03-06 03:47:22 +03:00
|
|
|
struct NonOwningAnimationTarget;
|
2016-02-17 23:37:00 +03:00
|
|
|
|
2012-07-31 21:28:21 +04:00
|
|
|
struct AnimationEventInfo {
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<dom::Element> mElement;
|
|
|
|
RefPtr<dom::Animation> mAnimation;
|
2015-09-15 08:04:05 +03:00
|
|
|
InternalAnimationEvent mEvent;
|
2015-09-15 08:04:53 +03:00
|
|
|
TimeStamp mTimeStamp;
|
2012-07-31 21:28:21 +04:00
|
|
|
|
2015-09-15 08:04:05 +03:00
|
|
|
AnimationEventInfo(dom::Element* aElement,
|
2016-02-17 23:37:00 +03:00
|
|
|
CSSPseudoElementType aPseudoType,
|
2015-08-26 15:56:59 +03:00
|
|
|
EventMessage aMessage,
|
2015-09-15 08:04:05 +03:00
|
|
|
const nsSubstring& aAnimationName,
|
2015-09-15 08:04:53 +03:00
|
|
|
const StickyTimeDuration& aElapsedTime,
|
2015-09-15 08:05:44 +03:00
|
|
|
const TimeStamp& aTimeStamp,
|
|
|
|
dom::Animation* aAnimation)
|
2015-09-15 08:04:05 +03:00
|
|
|
: mElement(aElement)
|
2015-09-15 08:05:44 +03:00
|
|
|
, mAnimation(aAnimation)
|
2015-09-15 08:04:05 +03:00
|
|
|
, mEvent(true, aMessage)
|
2015-09-15 08:04:53 +03:00
|
|
|
, mTimeStamp(aTimeStamp)
|
2012-07-31 21:28:21 +04:00
|
|
|
{
|
2014-02-11 09:35:25 +04:00
|
|
|
// XXX Looks like nobody initialize WidgetEvent::time
|
2016-03-26 07:37:19 +03:00
|
|
|
mEvent.mAnimationName = aAnimationName;
|
2016-03-26 07:37:19 +03:00
|
|
|
mEvent.mElapsedTime = aElapsedTime.ToSeconds();
|
2016-03-26 07:37:20 +03:00
|
|
|
mEvent.mPseudoElement =
|
2016-03-09 06:55:39 +03:00
|
|
|
AnimationCollection<dom::CSSAnimation>::PseudoTypeAsString(aPseudoType);
|
2012-07-31 21:28:21 +04:00
|
|
|
}
|
|
|
|
|
2013-09-27 10:20:54 +04:00
|
|
|
// InternalAnimationEvent doesn't support copy-construction, so we need
|
2012-07-31 21:28:21 +04:00
|
|
|
// to ourselves in order to work with nsTArray
|
2015-09-15 08:04:05 +03:00
|
|
|
AnimationEventInfo(const AnimationEventInfo& aOther)
|
2015-08-22 04:34:51 +03:00
|
|
|
: mElement(aOther.mElement)
|
2015-09-15 08:05:44 +03:00
|
|
|
, mAnimation(aOther.mAnimation)
|
2015-08-22 04:34:51 +03:00
|
|
|
, mEvent(true, aOther.mEvent.mMessage)
|
2015-09-15 08:04:53 +03:00
|
|
|
, mTimeStamp(aOther.mTimeStamp)
|
2012-07-31 21:28:21 +04:00
|
|
|
{
|
2014-02-11 09:35:25 +04:00
|
|
|
mEvent.AssignAnimationEventData(aOther.mEvent, false);
|
2012-07-31 21:28:21 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-06-30 04:00:39 +03:00
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class CSSAnimation final : public Animation
|
2014-10-20 08:55:46 +04:00
|
|
|
{
|
|
|
|
public:
|
2015-04-28 09:48:35 +03:00
|
|
|
explicit CSSAnimation(nsIGlobalObject* aGlobal,
|
2015-07-01 09:19:04 +03:00
|
|
|
const nsSubstring& aAnimationName)
|
2015-04-28 11:21:58 +03:00
|
|
|
: dom::Animation(aGlobal)
|
2015-07-01 09:19:04 +03:00
|
|
|
, mAnimationName(aAnimationName)
|
2014-10-20 08:55:46 +04:00
|
|
|
, mIsStylePaused(false)
|
|
|
|
, mPauseShouldStick(false)
|
2015-09-15 05:20:33 +03:00
|
|
|
, mNeedsNewAnimationIndexWhenRun(false)
|
2017-01-25 09:43:57 +03:00
|
|
|
, mPreviousPhase(ComputedTiming::AnimationPhase::Idle)
|
2016-12-20 09:57:20 +03:00
|
|
|
, mPreviousIteration(0)
|
2014-10-20 08:55:46 +04:00
|
|
|
{
|
2015-07-01 09:19:04 +03:00
|
|
|
// We might need to drop this assertion once we add a script-accessible
|
|
|
|
// constructor but for animations generated from CSS markup the
|
|
|
|
// animation-name should never be empty.
|
|
|
|
MOZ_ASSERT(!mAnimationName.IsEmpty(), "animation-name should not be empty");
|
2014-10-20 08:55:46 +04:00
|
|
|
}
|
|
|
|
|
2015-06-30 04:00:39 +03:00
|
|
|
JSObject* WrapObject(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) override;
|
|
|
|
|
2015-06-09 05:13:53 +03:00
|
|
|
CSSAnimation* AsCSSAnimation() override { return this; }
|
|
|
|
const CSSAnimation* AsCSSAnimation() const override { return this; }
|
2014-10-20 08:55:46 +04:00
|
|
|
|
2015-07-01 06:15:42 +03:00
|
|
|
// CSSAnimation interface
|
2015-07-01 09:19:04 +03:00
|
|
|
void GetAnimationName(nsString& aRetVal) const { aRetVal = mAnimationName; }
|
|
|
|
|
|
|
|
// Alternative to GetAnimationName that returns a reference to the member
|
|
|
|
// for more efficient internal usage.
|
|
|
|
const nsString& AnimationName() const { return mAnimationName; }
|
2015-07-01 06:15:42 +03:00
|
|
|
|
|
|
|
// Animation interface overrides
|
2015-06-30 04:00:39 +03:00
|
|
|
virtual Promise* GetReady(ErrorResult& aRv) override;
|
2015-05-19 08:00:48 +03:00
|
|
|
virtual void Play(ErrorResult& aRv, LimitBehavior aLimitBehavior) override;
|
2015-05-19 08:55:26 +03:00
|
|
|
virtual void Pause(ErrorResult& aRv) override;
|
2014-10-20 08:55:46 +04:00
|
|
|
|
2015-06-30 04:00:39 +03:00
|
|
|
virtual AnimationPlayState PlayStateFromJS() const override;
|
2015-05-19 08:00:48 +03:00
|
|
|
virtual void PlayFromJS(ErrorResult& aRv) override;
|
2014-11-17 07:45:58 +03:00
|
|
|
|
2014-10-20 08:55:46 +04:00
|
|
|
void PlayFromStyle();
|
|
|
|
void PauseFromStyle();
|
2015-06-09 05:13:53 +03:00
|
|
|
void CancelFromStyle() override
|
|
|
|
{
|
2015-09-15 05:20:56 +03:00
|
|
|
// When an animation is disassociated with style it enters an odd state
|
|
|
|
// where its composite order is undefined until it first transitions
|
|
|
|
// out of the idle state.
|
|
|
|
//
|
|
|
|
// Even if the composite order isn't defined we don't want it to be random
|
|
|
|
// in case we need to determine the order to dispatch events associated
|
|
|
|
// with an animation in this state. To solve this we treat the animation as
|
|
|
|
// if it had been added to the end of the global animation list so that
|
|
|
|
// its sort order is defined. We'll update this index again once the
|
|
|
|
// animation leaves the idle state.
|
|
|
|
mAnimationIndex = sNextAnimationIndex++;
|
|
|
|
mNeedsNewAnimationIndexWhenRun = true;
|
|
|
|
|
2015-06-09 05:13:53 +03:00
|
|
|
Animation::CancelFromStyle();
|
2017-02-10 06:32:44 +03:00
|
|
|
|
|
|
|
// We need to do this *after* calling CancelFromStyle() since
|
|
|
|
// CancelFromStyle might synchronously trigger a cancel event for which
|
|
|
|
// we need an owning element to target the event at.
|
|
|
|
mOwningElement = OwningElementRef();
|
2015-06-09 05:13:53 +03:00
|
|
|
}
|
2014-10-20 08:55:46 +04:00
|
|
|
|
2015-07-29 04:57:39 +03:00
|
|
|
void Tick() override;
|
2017-02-10 06:32:44 +03:00
|
|
|
void QueueEvents(StickyTimeDuration aActiveTime = StickyTimeDuration());
|
2015-07-29 04:57:39 +03:00
|
|
|
|
2014-10-20 08:55:46 +04:00
|
|
|
bool IsStylePaused() const { return mIsStylePaused; }
|
|
|
|
|
2016-01-14 04:24:24 +03:00
|
|
|
bool HasLowerCompositeOrderThan(const CSSAnimation& aOther) const;
|
2015-06-09 05:13:54 +03:00
|
|
|
|
|
|
|
void SetAnimationIndex(uint64_t aIndex)
|
|
|
|
{
|
2015-09-15 07:32:12 +03:00
|
|
|
MOZ_ASSERT(IsTiedToMarkup());
|
2016-09-12 09:04:33 +03:00
|
|
|
if (IsRelevant() &&
|
|
|
|
mAnimationIndex != aIndex) {
|
|
|
|
nsNodeUtils::AnimationChanged(this);
|
2016-10-05 08:26:29 +03:00
|
|
|
PostUpdate();
|
2016-09-12 09:04:33 +03:00
|
|
|
}
|
2015-09-15 05:20:26 +03:00
|
|
|
mAnimationIndex = aIndex;
|
2015-06-09 05:13:54 +03:00
|
|
|
}
|
|
|
|
|
2015-06-09 05:13:54 +03:00
|
|
|
// Sets the owning element which is used for determining the composite
|
|
|
|
// order of CSSAnimation objects generated from CSS markup.
|
2015-06-09 05:13:53 +03:00
|
|
|
//
|
2015-09-15 05:20:33 +03:00
|
|
|
// @see mOwningElement
|
2015-06-09 05:13:54 +03:00
|
|
|
void SetOwningElement(const OwningElementRef& aElement)
|
2015-06-09 05:13:53 +03:00
|
|
|
{
|
2015-06-09 05:13:54 +03:00
|
|
|
mOwningElement = aElement;
|
2015-06-09 05:13:53 +03:00
|
|
|
}
|
2015-09-15 07:32:12 +03:00
|
|
|
// True for animations that are generated from CSS markup and continue to
|
|
|
|
// reflect changes to that markup.
|
|
|
|
bool IsTiedToMarkup() const { return mOwningElement.IsSet(); }
|
2015-06-09 05:13:53 +03:00
|
|
|
|
2017-02-10 06:32:44 +03:00
|
|
|
void MaybeQueueCancelEvent(StickyTimeDuration aActiveTime) override {
|
|
|
|
QueueEvents(aActiveTime);
|
|
|
|
}
|
|
|
|
|
2014-10-20 08:55:46 +04:00
|
|
|
protected:
|
2015-06-09 05:13:53 +03:00
|
|
|
virtual ~CSSAnimation()
|
|
|
|
{
|
2015-06-09 05:13:54 +03:00
|
|
|
MOZ_ASSERT(!mOwningElement.IsSet(), "Owning element should be cleared "
|
|
|
|
"before a CSS animation is destroyed");
|
2015-06-09 05:13:53 +03:00
|
|
|
}
|
2015-09-15 05:20:56 +03:00
|
|
|
|
|
|
|
// Animation overrides
|
|
|
|
void UpdateTiming(SeekFlag aSeekFlag,
|
|
|
|
SyncNotifyFlag aSyncNotifyFlag) override;
|
2014-10-20 08:55:46 +04:00
|
|
|
|
2015-09-15 08:03:24 +03:00
|
|
|
// Returns the duration from the start of the animation's source effect's
|
|
|
|
// active interval to the point where the animation actually begins playback.
|
|
|
|
// This is zero unless the animation's source effect has a negative delay in
|
2016-01-13 20:37:00 +03:00
|
|
|
// which case it is the absolute value of that delay.
|
2015-09-15 08:03:24 +03:00
|
|
|
// This is used for setting the elapsedTime member of CSS AnimationEvents.
|
|
|
|
TimeDuration InitialAdvance() const {
|
|
|
|
return mEffect ?
|
2016-01-13 20:41:00 +03:00
|
|
|
std::max(TimeDuration(), mEffect->SpecifiedTiming().mDelay * -1) :
|
2015-09-15 08:03:24 +03:00
|
|
|
TimeDuration();
|
|
|
|
}
|
|
|
|
|
2015-07-01 09:19:04 +03:00
|
|
|
nsString mAnimationName;
|
|
|
|
|
2015-06-09 05:13:53 +03:00
|
|
|
// The (pseudo-)element whose computed animation-name refers to this
|
|
|
|
// animation (if any).
|
2015-09-15 05:20:33 +03:00
|
|
|
//
|
|
|
|
// This is used for determining the relative composite order of animations
|
|
|
|
// generated from CSS markup.
|
|
|
|
//
|
|
|
|
// Typically this will be the same as the target element of the keyframe
|
|
|
|
// effect associated with this animation. However, it can differ in the
|
|
|
|
// following circumstances:
|
|
|
|
//
|
|
|
|
// a) If script removes or replaces the effect of this animation,
|
|
|
|
// b) If this animation is cancelled (e.g. by updating the
|
|
|
|
// animation-name property or removing the owning element from the
|
|
|
|
// document),
|
|
|
|
// c) If this object is generated from script using the CSSAnimation
|
|
|
|
// constructor.
|
|
|
|
//
|
|
|
|
// For (b) and (c) the owning element will return !IsSet().
|
2015-06-09 05:13:54 +03:00
|
|
|
OwningElementRef mOwningElement;
|
2015-06-09 05:13:53 +03:00
|
|
|
|
2014-10-20 08:55:46 +04:00
|
|
|
// When combining animation-play-state with play() / pause() the following
|
|
|
|
// behavior applies:
|
|
|
|
// 1. pause() is sticky and always overrides the underlying
|
|
|
|
// animation-play-state
|
|
|
|
// 2. If animation-play-state is 'paused', play() will temporarily override
|
|
|
|
// it until animation-play-state next becomes 'running'.
|
|
|
|
// 3. Calls to play() trigger finishing behavior but setting the
|
|
|
|
// animation-play-state to 'running' does not.
|
|
|
|
//
|
|
|
|
// This leads to five distinct states:
|
|
|
|
//
|
|
|
|
// A. Running
|
|
|
|
// B. Running and temporarily overriding animation-play-state: paused
|
|
|
|
// C. Paused and sticky overriding animation-play-state: running
|
|
|
|
// D. Paused and sticky overriding animation-play-state: paused
|
|
|
|
// E. Paused by animation-play-state
|
|
|
|
//
|
|
|
|
// C and D may seem redundant but they differ in how to respond to the
|
|
|
|
// sequence: call play(), set animation-play-state: paused.
|
|
|
|
//
|
|
|
|
// C will transition to A then E leaving the animation paused.
|
|
|
|
// D will transition to B then B leaving the animation running.
|
|
|
|
//
|
|
|
|
// A state transition chart is as follows:
|
|
|
|
//
|
|
|
|
// A | B | C | D | E
|
|
|
|
// ---------------------------
|
|
|
|
// play() A | B | A | B | B
|
|
|
|
// pause() C | D | C | D | D
|
|
|
|
// 'running' A | A | C | C | A
|
|
|
|
// 'paused' E | B | D | D | E
|
|
|
|
//
|
2015-04-21 04:22:09 +03:00
|
|
|
// The base class, Animation already provides a boolean value,
|
2014-10-20 08:55:46 +04:00
|
|
|
// mIsPaused which gives us two states. To this we add a further two booleans
|
|
|
|
// to represent the states as follows.
|
|
|
|
//
|
|
|
|
// A. Running
|
|
|
|
// (!mIsPaused; !mIsStylePaused; !mPauseShouldStick)
|
|
|
|
// B. Running and temporarily overriding animation-play-state: paused
|
|
|
|
// (!mIsPaused; mIsStylePaused; !mPauseShouldStick)
|
|
|
|
// C. Paused and sticky overriding animation-play-state: running
|
|
|
|
// (mIsPaused; !mIsStylePaused; mPauseShouldStick)
|
|
|
|
// D. Paused and sticky overriding animation-play-state: paused
|
|
|
|
// (mIsPaused; mIsStylePaused; mPauseShouldStick)
|
|
|
|
// E. Paused by animation-play-state
|
|
|
|
// (mIsPaused; mIsStylePaused; !mPauseShouldStick)
|
|
|
|
//
|
|
|
|
// (That leaves 3 combinations of the boolean values that we never set because
|
|
|
|
// they don't represent valid states.)
|
|
|
|
bool mIsStylePaused;
|
|
|
|
bool mPauseShouldStick;
|
2014-10-20 08:55:47 +04:00
|
|
|
|
2015-09-15 05:20:33 +03:00
|
|
|
// When true, indicates that when this animation next leaves the idle state,
|
|
|
|
// its animation index should be updated.
|
|
|
|
bool mNeedsNewAnimationIndexWhenRun;
|
|
|
|
|
2016-12-20 09:57:20 +03:00
|
|
|
// Phase and current iteration from the previous time we queued events.
|
|
|
|
// This is used to determine what new events to dispatch.
|
|
|
|
ComputedTiming::AnimationPhase mPreviousPhase;
|
|
|
|
uint64_t mPreviousIteration;
|
2014-10-20 08:55:46 +04:00
|
|
|
};
|
|
|
|
|
2015-06-30 04:00:39 +03:00
|
|
|
} /* namespace dom */
|
2016-03-09 06:55:39 +03:00
|
|
|
|
|
|
|
template <>
|
|
|
|
struct AnimationTypeTraits<dom::CSSAnimation>
|
|
|
|
{
|
|
|
|
static nsIAtom* ElementPropertyAtom()
|
|
|
|
{
|
|
|
|
return nsGkAtoms::animationsProperty;
|
|
|
|
}
|
|
|
|
static nsIAtom* BeforePropertyAtom()
|
|
|
|
{
|
|
|
|
return nsGkAtoms::animationsOfBeforeProperty;
|
|
|
|
}
|
|
|
|
static nsIAtom* AfterPropertyAtom()
|
|
|
|
{
|
|
|
|
return nsGkAtoms::animationsOfAfterProperty;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-10-20 08:55:46 +04:00
|
|
|
} /* namespace mozilla */
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsAnimationManager final
|
2016-03-09 06:55:39 +03:00
|
|
|
: public mozilla::CommonAnimationManager<mozilla::dom::CSSAnimation>
|
2011-04-12 10:18:44 +04:00
|
|
|
{
|
|
|
|
public:
|
2014-08-20 08:58:22 +04:00
|
|
|
explicit nsAnimationManager(nsPresContext *aPresContext)
|
2016-03-09 06:55:39 +03:00
|
|
|
: mozilla::CommonAnimationManager<mozilla::dom::CSSAnimation>(aPresContext)
|
2011-04-12 10:18:44 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-01-15 09:15:47 +03:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsAnimationManager)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsAnimationManager)
|
2011-04-12 10:18:44 +04:00
|
|
|
|
2016-03-09 06:55:39 +03:00
|
|
|
typedef mozilla::AnimationCollection<mozilla::dom::CSSAnimation>
|
|
|
|
CSSAnimationCollection;
|
|
|
|
typedef nsTArray<RefPtr<mozilla::dom::CSSAnimation>>
|
|
|
|
OwningCSSAnimationPtrArray;
|
|
|
|
|
2011-04-12 10:18:44 +04:00
|
|
|
/**
|
2016-02-15 10:08:33 +03:00
|
|
|
* Update the set of animations on |aElement| based on |aStyleContext|.
|
|
|
|
* If necessary, this will notify the corresponding EffectCompositor so
|
|
|
|
* that it can update its animation rule.
|
2011-04-12 10:18:44 +04:00
|
|
|
*
|
|
|
|
* aStyleContext may be a style context for aElement or for its
|
|
|
|
* :before or :after pseudo-element.
|
|
|
|
*/
|
2016-02-15 10:08:33 +03:00
|
|
|
void UpdateAnimations(nsStyleContext* aStyleContext,
|
|
|
|
mozilla::dom::Element* aElement);
|
2011-04-12 10:18:44 +04:00
|
|
|
|
2017-03-06 03:54:06 +03:00
|
|
|
/**
|
|
|
|
* This function does the same thing as the above UpdateAnimations()
|
|
|
|
* but with servo's computed values.
|
|
|
|
*/
|
|
|
|
void UpdateAnimations(
|
|
|
|
mozilla::dom::Element* aElement,
|
2017-03-27 13:43:13 +03:00
|
|
|
mozilla::CSSPseudoElementType aPseudoType,
|
2017-03-27 13:43:09 +03:00
|
|
|
const mozilla::ServoComputedValuesWithParent& aServoValues);
|
2017-03-06 03:54:06 +03:00
|
|
|
|
2015-07-29 04:57:39 +03:00
|
|
|
/**
|
|
|
|
* Add a pending event.
|
|
|
|
*/
|
2015-07-29 04:57:39 +03:00
|
|
|
void QueueEvent(mozilla::AnimationEventInfo&& aEventInfo)
|
|
|
|
{
|
|
|
|
mEventDispatcher.QueueEvent(
|
|
|
|
mozilla::Forward<mozilla::AnimationEventInfo>(aEventInfo));
|
|
|
|
}
|
2015-07-29 04:57:39 +03:00
|
|
|
|
2011-04-12 10:18:44 +04:00
|
|
|
/**
|
|
|
|
* Dispatch any pending events. We accumulate animationend and
|
|
|
|
* animationiteration events only during refresh driver notifications
|
|
|
|
* (and dispatch them at the end of such notifications), but we
|
|
|
|
* accumulate animationstart events at other points when style
|
|
|
|
* contexts are created.
|
|
|
|
*/
|
2016-02-10 16:17:05 +03:00
|
|
|
void DispatchEvents()
|
|
|
|
{
|
|
|
|
RefPtr<nsAnimationManager> kungFuDeathGrip(this);
|
|
|
|
mEventDispatcher.DispatchEvents(mPresContext);
|
|
|
|
}
|
2015-09-15 08:05:49 +03:00
|
|
|
void SortEvents() { mEventDispatcher.SortEvents(); }
|
2015-07-29 04:57:39 +03:00
|
|
|
void ClearEventQueue() { mEventDispatcher.ClearEventQueue(); }
|
2015-07-29 04:57:39 +03:00
|
|
|
|
2014-11-20 05:48:41 +03:00
|
|
|
protected:
|
2016-03-09 06:55:39 +03:00
|
|
|
~nsAnimationManager() override = default;
|
2015-07-29 04:57:39 +03:00
|
|
|
|
2012-12-12 01:12:43 +04:00
|
|
|
private:
|
2017-03-06 03:51:16 +03:00
|
|
|
template<class BuilderType>
|
2017-03-06 03:50:09 +03:00
|
|
|
void DoUpdateAnimations(
|
|
|
|
const mozilla::NonOwningAnimationTarget& aTarget,
|
|
|
|
const nsStyleDisplay& aStyleDisplay,
|
2017-03-06 03:51:16 +03:00
|
|
|
BuilderType& aBuilder);
|
2017-03-06 03:50:09 +03:00
|
|
|
|
2016-03-09 06:55:39 +03:00
|
|
|
mozilla::DelayedEventDispatcher<mozilla::AnimationEventInfo> mEventDispatcher;
|
2011-04-12 10:18:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* !defined(nsAnimationManager_h_) */
|