summaryrefslogtreecommitdiffstats
path: root/layout/style/nsAnimationManager.h
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-04-29 18:48:43 +0200
committerGitHub <noreply@github.com>2018-04-29 18:48:43 +0200
commitb83c51a1a51f58a7a68d1a4877b0f0a8f03a939e (patch)
tree8ba5cabbaa5390ce5bffb1af3b31a4e49a8def09 /layout/style/nsAnimationManager.h
parent3fe37f6ae848f7d88e2316857a1a95d9c2abae14 (diff)
parent35c61a027dc6f4d58ca9d33e06da79adf2503ebd (diff)
downloadUXP-b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e.tar
UXP-b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e.tar.gz
UXP-b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e.tar.lz
UXP-b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e.tar.xz
UXP-b83c51a1a51f58a7a68d1a4877b0f0a8f03a939e.zip
Merge pull request #296 from janekptacijarabaci/js_dom_animationcancel_1
DOM - implement animationcancel event
Diffstat (limited to 'layout/style/nsAnimationManager.h')
-rw-r--r--layout/style/nsAnimationManager.h27
1 files changed, 16 insertions, 11 deletions
diff --git a/layout/style/nsAnimationManager.h b/layout/style/nsAnimationManager.h
index abe3aeeb8..d838d090a 100644
--- a/layout/style/nsAnimationManager.h
+++ b/layout/style/nsAnimationManager.h
@@ -76,7 +76,8 @@ public:
, mIsStylePaused(false)
, mPauseShouldStick(false)
, mNeedsNewAnimationIndexWhenRun(false)
- , mPreviousPhaseOrIteration(PREVIOUS_PHASE_BEFORE)
+ , mPreviousPhase(ComputedTiming::AnimationPhase::Idle)
+ , mPreviousIteration(0)
{
// We might need to drop this assertion once we add a script-accessible
// constructor but for animations generated from CSS markup the
@@ -109,8 +110,6 @@ public:
void PauseFromStyle();
void CancelFromStyle() override
{
- mOwningElement = OwningElementRef();
-
// 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.
@@ -125,10 +124,15 @@ public:
mNeedsNewAnimationIndexWhenRun = true;
Animation::CancelFromStyle();
+
+ // 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();
}
void Tick() override;
- void QueueEvents();
+ void QueueEvents(StickyTimeDuration aActiveTime = StickyTimeDuration());
bool IsStylePaused() const { return mIsStylePaused; }
@@ -157,6 +161,10 @@ public:
// reflect changes to that markup.
bool IsTiedToMarkup() const { return mOwningElement.IsSet(); }
+ void MaybeQueueCancelEvent(StickyTimeDuration aActiveTime) override {
+ QueueEvents(aActiveTime);
+ }
+
protected:
virtual ~CSSAnimation()
{
@@ -257,13 +265,10 @@ protected:
// its animation index should be updated.
bool mNeedsNewAnimationIndexWhenRun;
- enum {
- PREVIOUS_PHASE_BEFORE = uint64_t(-1),
- PREVIOUS_PHASE_AFTER = uint64_t(-2)
- };
- // One of the PREVIOUS_PHASE_* constants, or an integer for the iteration
- // whose start we last notified on.
- uint64_t mPreviousPhaseOrIteration;
+ // 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;
};
} /* namespace dom */