2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2015-04-15 02:48:21 +03: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/. */
|
|
|
|
|
2018-05-07 05:15:16 +03:00
|
|
|
#include "mozilla/dom/AnimationEffect.h"
|
|
|
|
#include "mozilla/dom/AnimationEffectBinding.h"
|
2017-10-12 15:50:23 +03:00
|
|
|
|
|
|
|
#include "mozilla/dom/Animation.h"
|
2018-05-07 05:07:06 +03:00
|
|
|
#include "mozilla/dom/KeyframeEffect.h"
|
2016-07-25 13:27:33 +03:00
|
|
|
#include "mozilla/AnimationUtils.h"
|
|
|
|
#include "mozilla/FloatingPoint.h"
|
2015-04-15 02:48:21 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2018-05-07 05:15:16 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(AnimationEffect)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(AnimationEffect)
|
2018-05-07 06:58:37 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocument, mAnimation)
|
2016-07-25 13:27:33 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
2018-05-07 05:15:16 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(AnimationEffect)
|
2018-05-07 06:58:37 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocument, mAnimation)
|
2016-07-25 13:27:33 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
2018-05-07 05:15:16 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(AnimationEffect)
|
2015-04-15 02:48:21 +03:00
|
|
|
|
2018-05-07 05:15:16 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(AnimationEffect)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(AnimationEffect)
|
2015-04-15 02:48:21 +03:00
|
|
|
|
2018-05-07 05:15:16 +03:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AnimationEffect)
|
2015-04-15 02:48:21 +03:00
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
2019-01-02 16:05:23 +03:00
|
|
|
AnimationEffect::AnimationEffect(Document* aDocument, TimingParams&& aTiming)
|
2018-10-16 00:38:00 +03:00
|
|
|
: mDocument(aDocument), mTiming(std::move(aTiming)) {}
|
2018-06-15 06:00:20 +03:00
|
|
|
|
|
|
|
AnimationEffect::~AnimationEffect() = default;
|
|
|
|
|
2017-12-15 23:55:08 +03:00
|
|
|
// https://drafts.csswg.org/web-animations/#current
|
2018-05-07 05:15:16 +03:00
|
|
|
bool AnimationEffect::IsCurrent() const {
|
2016-07-25 13:27:33 +03:00
|
|
|
if (!mAnimation || mAnimation->PlayState() == AnimationPlayState::Finished) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ComputedTiming computedTiming = GetComputedTiming();
|
2019-01-10 03:31:54 +03:00
|
|
|
if (computedTiming.mPhase == ComputedTiming::AnimationPhase::Active) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-01-10 04:03:24 +03:00
|
|
|
return (mAnimation->PlaybackRate() > 0 &&
|
|
|
|
computedTiming.mPhase == ComputedTiming::AnimationPhase::Before) ||
|
|
|
|
(mAnimation->PlaybackRate() < 0 &&
|
|
|
|
computedTiming.mPhase == ComputedTiming::AnimationPhase::After);
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
|
|
|
|
2017-12-15 23:55:08 +03:00
|
|
|
// https://drafts.csswg.org/web-animations/#in-effect
|
2018-05-07 05:15:16 +03:00
|
|
|
bool AnimationEffect::IsInEffect() const {
|
2016-07-25 13:27:33 +03:00
|
|
|
ComputedTiming computedTiming = GetComputedTiming();
|
|
|
|
return !computedTiming.mProgress.IsNull();
|
|
|
|
}
|
|
|
|
|
2018-10-12 11:28:00 +03:00
|
|
|
void AnimationEffect::SetSpecifiedTiming(TimingParams&& aTiming) {
|
2018-05-07 06:58:37 +03:00
|
|
|
if (mTiming == aTiming) {
|
2016-07-25 13:27:33 +03:00
|
|
|
return;
|
|
|
|
}
|
2018-05-07 06:58:37 +03:00
|
|
|
|
|
|
|
mTiming = aTiming;
|
|
|
|
|
2016-07-25 13:27:33 +03:00
|
|
|
if (mAnimation) {
|
2018-05-07 06:37:11 +03:00
|
|
|
Maybe<nsAutoAnimationMutationBatch> mb;
|
|
|
|
if (AsKeyframeEffect() && AsKeyframeEffect()->GetTarget()) {
|
|
|
|
mb.emplace(AsKeyframeEffect()->GetTarget()->mElement->OwnerDoc());
|
|
|
|
}
|
|
|
|
|
2016-07-25 13:27:33 +03:00
|
|
|
mAnimation->NotifyEffectTimingUpdated();
|
2018-05-07 06:37:11 +03:00
|
|
|
|
|
|
|
if (mAnimation->IsRelevant()) {
|
2019-11-05 23:39:22 +03:00
|
|
|
MutationObservers::NotifyAnimationChanged(mAnimation);
|
2018-05-07 06:37:11 +03:00
|
|
|
}
|
|
|
|
|
2017-08-03 00:34:38 +03:00
|
|
|
if (AsKeyframeEffect()) {
|
|
|
|
AsKeyframeEffect()->RequestRestyle(EffectCompositor::RestyleType::Layer);
|
|
|
|
}
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
2016-07-13 13:44:19 +03:00
|
|
|
// For keyframe effects, NotifyEffectTimingUpdated above will eventually cause
|
2018-05-07 05:08:59 +03:00
|
|
|
// KeyframeEffect::NotifyAnimationTimingUpdated to be called so it can
|
2016-07-13 13:44:19 +03:00
|
|
|
// update its registration with the target element as necessary.
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
|
|
|
|
2018-05-07 05:15:16 +03:00
|
|
|
ComputedTiming AnimationEffect::GetComputedTimingAt(
|
2016-07-25 13:27:33 +03:00
|
|
|
const Nullable<TimeDuration>& aLocalTime, const TimingParams& aTiming,
|
|
|
|
double aPlaybackRate) {
|
2017-07-10 10:36:28 +03:00
|
|
|
static const StickyTimeDuration zeroDuration;
|
2016-07-25 13:27:33 +03:00
|
|
|
|
|
|
|
// Always return the same object to benefit from return-value optimization.
|
|
|
|
ComputedTiming result;
|
|
|
|
|
2017-06-22 06:12:43 +03:00
|
|
|
if (aTiming.Duration()) {
|
|
|
|
MOZ_ASSERT(aTiming.Duration().ref() >= zeroDuration,
|
2016-07-25 13:27:33 +03:00
|
|
|
"Iteration duration should be positive");
|
2017-06-22 06:12:43 +03:00
|
|
|
result.mDuration = aTiming.Duration().ref();
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
|
|
|
|
2017-06-22 06:12:43 +03:00
|
|
|
MOZ_ASSERT(aTiming.Iterations() >= 0.0 && !IsNaN(aTiming.Iterations()),
|
2016-07-25 13:27:33 +03:00
|
|
|
"mIterations should be nonnegative & finite, as ensured by "
|
|
|
|
"ValidateIterations or CSSParser");
|
2017-06-22 06:12:43 +03:00
|
|
|
result.mIterations = aTiming.Iterations();
|
2016-07-25 13:27:33 +03:00
|
|
|
|
2017-06-22 06:12:43 +03:00
|
|
|
MOZ_ASSERT(aTiming.IterationStart() >= 0.0,
|
2016-07-25 13:27:33 +03:00
|
|
|
"mIterationStart should be nonnegative, as ensured by "
|
|
|
|
"ValidateIterationStart");
|
2017-06-22 06:12:43 +03:00
|
|
|
result.mIterationStart = aTiming.IterationStart();
|
2016-07-25 13:27:33 +03:00
|
|
|
|
|
|
|
result.mActiveDuration = aTiming.ActiveDuration();
|
|
|
|
result.mEndTime = aTiming.EndTime();
|
2017-06-22 06:12:43 +03:00
|
|
|
result.mFill = aTiming.Fill() == dom::FillMode::Auto ? dom::FillMode::None
|
|
|
|
: aTiming.Fill();
|
2016-07-25 13:27:33 +03:00
|
|
|
|
|
|
|
// The default constructor for ComputedTiming sets all other members to
|
|
|
|
// values consistent with an animation that has not been sampled.
|
|
|
|
if (aLocalTime.IsNull()) {
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
const TimeDuration& localTime = aLocalTime.Value();
|
|
|
|
|
|
|
|
StickyTimeDuration beforeActiveBoundary =
|
2017-06-22 06:12:43 +03:00
|
|
|
std::max(std::min(StickyTimeDuration(aTiming.Delay()), result.mEndTime),
|
2016-09-01 04:57:55 +03:00
|
|
|
zeroDuration);
|
|
|
|
|
2016-07-25 13:27:33 +03:00
|
|
|
StickyTimeDuration activeAfterBoundary = std::max(
|
2017-06-22 06:12:43 +03:00
|
|
|
std::min(StickyTimeDuration(aTiming.Delay() + result.mActiveDuration),
|
2016-09-01 04:57:55 +03:00
|
|
|
result.mEndTime),
|
|
|
|
zeroDuration);
|
2016-07-25 13:27:33 +03:00
|
|
|
|
|
|
|
if (localTime > activeAfterBoundary ||
|
|
|
|
(aPlaybackRate >= 0 && localTime == activeAfterBoundary)) {
|
|
|
|
result.mPhase = ComputedTiming::AnimationPhase::After;
|
|
|
|
if (!result.FillsForwards()) {
|
|
|
|
// The animation isn't active or filling at this time.
|
|
|
|
return result;
|
|
|
|
}
|
2016-12-20 10:03:29 +03:00
|
|
|
result.mActiveTime =
|
2017-06-22 06:12:43 +03:00
|
|
|
std::max(std::min(StickyTimeDuration(localTime - aTiming.Delay()),
|
2016-09-01 04:57:55 +03:00
|
|
|
result.mActiveDuration),
|
|
|
|
zeroDuration);
|
2016-07-25 13:27:33 +03:00
|
|
|
} else if (localTime < beforeActiveBoundary ||
|
|
|
|
(aPlaybackRate < 0 && localTime == beforeActiveBoundary)) {
|
|
|
|
result.mPhase = ComputedTiming::AnimationPhase::Before;
|
|
|
|
if (!result.FillsBackwards()) {
|
|
|
|
// The animation isn't active or filling at this time.
|
|
|
|
return result;
|
|
|
|
}
|
2016-12-20 10:03:29 +03:00
|
|
|
result.mActiveTime =
|
2017-06-22 06:12:43 +03:00
|
|
|
std::max(StickyTimeDuration(localTime - aTiming.Delay()), zeroDuration);
|
2016-07-25 13:27:33 +03:00
|
|
|
} else {
|
2017-07-10 10:21:30 +03:00
|
|
|
MOZ_ASSERT(result.mActiveDuration,
|
2016-07-25 13:27:33 +03:00
|
|
|
"How can we be in the middle of a zero-duration interval?");
|
|
|
|
result.mPhase = ComputedTiming::AnimationPhase::Active;
|
2017-06-22 06:12:43 +03:00
|
|
|
result.mActiveTime = localTime - aTiming.Delay();
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Convert active time to a multiple of iterations.
|
2017-12-15 23:55:08 +03:00
|
|
|
// https://drafts.csswg.org/web-animations/#overall-progress
|
2016-07-25 13:27:33 +03:00
|
|
|
double overallProgress;
|
2017-07-10 10:21:30 +03:00
|
|
|
if (!result.mDuration) {
|
2016-07-25 13:27:33 +03:00
|
|
|
overallProgress = result.mPhase == ComputedTiming::AnimationPhase::Before
|
|
|
|
? 0.0
|
|
|
|
: result.mIterations;
|
|
|
|
} else {
|
2016-12-20 10:03:29 +03:00
|
|
|
overallProgress = result.mActiveTime / result.mDuration;
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Factor in iteration start offset.
|
|
|
|
if (IsFinite(overallProgress)) {
|
|
|
|
overallProgress += result.mIterationStart;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Determine the 0-based index of the current iteration.
|
2017-12-15 23:55:08 +03:00
|
|
|
// https://drafts.csswg.org/web-animations/#current-iteration
|
2016-07-25 13:27:33 +03:00
|
|
|
result.mCurrentIteration =
|
2019-08-29 00:31:46 +03:00
|
|
|
(result.mIterations >= double(UINT64_MAX) &&
|
2017-09-12 02:42:54 +03:00
|
|
|
result.mPhase == ComputedTiming::AnimationPhase::After) ||
|
2019-08-29 00:31:46 +03:00
|
|
|
overallProgress >= double(UINT64_MAX)
|
2016-07-25 13:27:33 +03:00
|
|
|
? UINT64_MAX // In GetComputedTimingDictionary(),
|
|
|
|
// we will convert this into Infinity
|
|
|
|
: static_cast<uint64_t>(overallProgress);
|
|
|
|
|
|
|
|
// Convert the overall progress to a fraction of a single iteration--the
|
|
|
|
// simply iteration progress.
|
2017-12-15 23:55:08 +03:00
|
|
|
// https://drafts.csswg.org/web-animations/#simple-iteration-progress
|
2016-07-25 13:27:33 +03:00
|
|
|
double progress = IsFinite(overallProgress)
|
|
|
|
? fmod(overallProgress, 1.0)
|
|
|
|
: fmod(result.mIterationStart, 1.0);
|
|
|
|
|
2017-10-13 06:31:21 +03:00
|
|
|
// When we are at the end of the active interval and the end of an iteration
|
|
|
|
// we need to report the end of the final iteration and not the start of the
|
|
|
|
// next iteration. We *don't* want to do this, however, when we have
|
|
|
|
// a zero-iteration animation.
|
|
|
|
if (progress == 0.0 &&
|
|
|
|
(result.mPhase == ComputedTiming::AnimationPhase::After ||
|
|
|
|
result.mPhase == ComputedTiming::AnimationPhase::Active) &&
|
|
|
|
result.mActiveTime == result.mActiveDuration &&
|
|
|
|
result.mIterations != 0.0) {
|
|
|
|
// The only way we can reach the end of the active interval and have
|
|
|
|
// a progress of zero and a current iteration of zero, is if we have a zero
|
|
|
|
// iteration count -- something we should have detected above.
|
2016-07-25 13:27:33 +03:00
|
|
|
MOZ_ASSERT(result.mCurrentIteration != 0,
|
|
|
|
"Should not have zero current iteration");
|
|
|
|
progress = 1.0;
|
|
|
|
if (result.mCurrentIteration != UINT64_MAX) {
|
|
|
|
result.mCurrentIteration--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Factor in the direction.
|
|
|
|
bool thisIterationReverse = false;
|
2017-06-22 06:12:43 +03:00
|
|
|
switch (aTiming.Direction()) {
|
2016-07-25 13:27:33 +03:00
|
|
|
case PlaybackDirection::Normal:
|
|
|
|
thisIterationReverse = false;
|
|
|
|
break;
|
|
|
|
case PlaybackDirection::Reverse:
|
|
|
|
thisIterationReverse = true;
|
|
|
|
break;
|
|
|
|
case PlaybackDirection::Alternate:
|
|
|
|
thisIterationReverse = (result.mCurrentIteration & 1) == 1;
|
|
|
|
break;
|
|
|
|
case PlaybackDirection::Alternate_reverse:
|
|
|
|
thisIterationReverse = (result.mCurrentIteration & 1) == 0;
|
|
|
|
break;
|
|
|
|
default:
|
2017-02-27 20:38:52 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("Unknown PlaybackDirection type");
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
|
|
|
if (thisIterationReverse) {
|
|
|
|
progress = 1.0 - progress;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Calculate the 'before flag' which we use when applying step timing
|
|
|
|
// functions.
|
|
|
|
if ((result.mPhase == ComputedTiming::AnimationPhase::After &&
|
|
|
|
thisIterationReverse) ||
|
|
|
|
(result.mPhase == ComputedTiming::AnimationPhase::Before &&
|
|
|
|
!thisIterationReverse)) {
|
|
|
|
result.mBeforeFlag = ComputedTimingFunction::BeforeFlag::Set;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Apply the easing.
|
2017-06-22 06:12:43 +03:00
|
|
|
if (aTiming.TimingFunction()) {
|
|
|
|
progress = aTiming.TimingFunction()->GetValue(progress, result.mBeforeFlag);
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
MOZ_ASSERT(IsFinite(progress), "Progress value should be finite");
|
|
|
|
result.mProgress.SetValue(progress);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2018-05-07 05:15:16 +03:00
|
|
|
ComputedTiming AnimationEffect::GetComputedTiming(
|
|
|
|
const TimingParams* aTiming) const {
|
2016-07-25 13:27:33 +03:00
|
|
|
double playbackRate = mAnimation ? mAnimation->PlaybackRate() : 1;
|
|
|
|
return GetComputedTimingAt(
|
|
|
|
GetLocalTime(), aTiming ? *aTiming : SpecifiedTiming(), playbackRate);
|
|
|
|
}
|
|
|
|
|
2018-05-07 06:32:38 +03:00
|
|
|
// Helper function for generating an (Computed)EffectTiming dictionary
|
|
|
|
static void GetEffectTimingDictionary(const TimingParams& aTiming,
|
|
|
|
EffectTiming& aRetVal) {
|
2017-06-22 06:12:43 +03:00
|
|
|
aRetVal.mDelay = aTiming.Delay().ToMilliseconds();
|
|
|
|
aRetVal.mEndDelay = aTiming.EndDelay().ToMilliseconds();
|
2018-05-07 06:32:38 +03:00
|
|
|
aRetVal.mFill = aTiming.Fill();
|
|
|
|
aRetVal.mIterationStart = aTiming.IterationStart();
|
|
|
|
aRetVal.mIterations = aTiming.Iterations();
|
|
|
|
if (aTiming.Duration()) {
|
|
|
|
aRetVal.mDuration.SetAsUnrestrictedDouble() =
|
|
|
|
aTiming.Duration()->ToMilliseconds();
|
|
|
|
}
|
2017-06-22 06:12:43 +03:00
|
|
|
aRetVal.mDirection = aTiming.Direction();
|
2018-04-25 06:25:26 +03:00
|
|
|
if (aTiming.TimingFunction()) {
|
|
|
|
aRetVal.mEasing.Truncate();
|
|
|
|
aTiming.TimingFunction()->AppendToString(aRetVal.mEasing);
|
|
|
|
}
|
2018-05-07 06:32:38 +03:00
|
|
|
}
|
2016-07-25 13:27:33 +03:00
|
|
|
|
2018-05-07 06:32:38 +03:00
|
|
|
void AnimationEffect::GetTiming(EffectTiming& aRetVal) const {
|
|
|
|
GetEffectTimingDictionary(SpecifiedTiming(), aRetVal);
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
|
|
|
|
2018-05-07 06:09:54 +03:00
|
|
|
void AnimationEffect::GetComputedTimingAsDict(
|
|
|
|
ComputedEffectTiming& aRetVal) const {
|
2018-05-07 06:32:38 +03:00
|
|
|
// Specified timing
|
|
|
|
GetEffectTimingDictionary(SpecifiedTiming(), aRetVal);
|
|
|
|
|
|
|
|
// Computed timing
|
2016-07-25 13:27:33 +03:00
|
|
|
double playbackRate = mAnimation ? mAnimation->PlaybackRate() : 1;
|
|
|
|
const Nullable<TimeDuration> currentTime = GetLocalTime();
|
2018-05-07 06:32:38 +03:00
|
|
|
ComputedTiming computedTiming =
|
|
|
|
GetComputedTimingAt(currentTime, SpecifiedTiming(), playbackRate);
|
|
|
|
|
|
|
|
aRetVal.mDuration.SetAsUnrestrictedDouble() =
|
|
|
|
computedTiming.mDuration.ToMilliseconds();
|
|
|
|
aRetVal.mFill = computedTiming.mFill;
|
|
|
|
aRetVal.mActiveDuration = computedTiming.mActiveDuration.ToMilliseconds();
|
|
|
|
aRetVal.mEndTime = computedTiming.mEndTime.ToMilliseconds();
|
|
|
|
aRetVal.mLocalTime = AnimationUtils::TimeDurationToDouble(currentTime);
|
|
|
|
aRetVal.mProgress = computedTiming.mProgress;
|
|
|
|
|
|
|
|
if (!aRetVal.mProgress.IsNull()) {
|
|
|
|
// Convert the returned currentIteration into Infinity if we set
|
|
|
|
// (uint64_t) computedTiming.mCurrentIteration to UINT64_MAX
|
|
|
|
double iteration =
|
|
|
|
computedTiming.mCurrentIteration == UINT64_MAX
|
|
|
|
? PositiveInfinity<double>()
|
|
|
|
: static_cast<double>(computedTiming.mCurrentIteration);
|
|
|
|
aRetVal.mCurrentIteration.SetValue(iteration);
|
|
|
|
}
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
|
|
|
|
2018-05-07 06:37:11 +03:00
|
|
|
void AnimationEffect::UpdateTiming(const OptionalEffectTiming& aTiming,
|
|
|
|
ErrorResult& aRv) {
|
2018-05-07 06:58:37 +03:00
|
|
|
TimingParams timing =
|
|
|
|
TimingParams::MergeOptionalEffectTiming(mTiming, aTiming, mDocument, aRv);
|
2018-05-07 06:37:11 +03:00
|
|
|
if (aRv.Failed()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-10-12 11:28:00 +03:00
|
|
|
SetSpecifiedTiming(std::move(timing));
|
2018-05-07 06:37:11 +03:00
|
|
|
}
|
|
|
|
|
2018-05-07 05:15:16 +03:00
|
|
|
Nullable<TimeDuration> AnimationEffect::GetLocalTime() const {
|
2016-07-25 13:27:33 +03:00
|
|
|
// Since the *animation* start time is currently always zero, the local
|
|
|
|
// time is equal to the parent time.
|
|
|
|
Nullable<TimeDuration> result;
|
|
|
|
if (mAnimation) {
|
2018-12-07 01:16:48 +03:00
|
|
|
result = mAnimation->GetCurrentTimeAsDuration();
|
2016-07-25 13:27:33 +03:00
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2015-04-15 02:48:21 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|