Bug 1379564 - Use BaseTimeDuration::bool() to check the TimeDuration is not zero. r=birtles

In TimingParams::CalcActiveDuration(), we intentionally use IsZero() instead
of the bool() operator since the value |aDuration| is Maybe<StickyTimeDuration>
, it's easily misread as Maybe::bool().

MozReview-Commit-ID: D5Nb7cxh7wi

--HG--
extra : rebase_source : e30fe73c5b02d09ab5116bcfc6ca20a902b13b75
This commit is contained in:
Hiroyuki Ikezoe 2017-07-10 16:21:30 +09:00
Родитель 004b993f6b
Коммит ef7ed06a84
3 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -161,7 +161,7 @@ AnimationEffectReadOnly::GetComputedTimingAt(
= std::max(StickyTimeDuration(localTime - aTiming.Delay()),
zeroDuration);
} else {
MOZ_ASSERT(result.mActiveDuration != zeroDuration,
MOZ_ASSERT(result.mActiveDuration,
"How can we be in the middle of a zero-duration interval?");
result.mPhase = ComputedTiming::AnimationPhase::Active;
result.mActiveTime = localTime - aTiming.Delay();
@ -170,7 +170,7 @@ AnimationEffectReadOnly::GetComputedTimingAt(
// Convert active time to a multiple of iterations.
// https://w3c.github.io/web-animations/#overall-progress
double overallProgress;
if (result.mDuration == zeroDuration) {
if (!result.mDuration) {
overallProgress = result.mPhase == ComputedTiming::AnimationPhase::Before
? 0.0
: result.mIterations;

Просмотреть файл

@ -53,7 +53,7 @@ public:
bool IsInEffect() const;
bool IsActiveDurationZero() const
{
return SpecifiedTiming().ActiveDuration() == StickyTimeDuration();
return !SpecifiedTiming().ActiveDuration();
}
already_AddRefed<AnimationEffectTimingReadOnly> Timing();

Просмотреть файл

@ -133,7 +133,7 @@ struct TimingParams
// Web Animations says that the active duration is zero. This is to
// ensure that the result is defined when the other argument is Infinity.
static const StickyTimeDuration zeroDuration;
if (!aDuration || *aDuration == zeroDuration || aIterations == 0.0) {
if (!aDuration || aDuration->IsZero() || aIterations == 0.0) {
return zeroDuration;
}