Bug 1538796 - Part 3 - convert IPDL OptionalOpacity union to use native Maybe syntax; r=kats

Depends on D24748

Differential Revision: https://phabricator.services.mozilla.com/D24749

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alex Gaynor 2019-03-25 19:29:46 +00:00
Родитель 91eb929e7b
Коммит 46926da383
5 изменённых файлов: 15 добавлений и 25 удалений

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

@ -166,8 +166,7 @@ static AnimationHelper::SampleResult SampleAnimationForProperty(
// Process in order, since later animations override earlier ones.
for (PropertyAnimation& animation : aPropertyAnimations) {
MOZ_ASSERT(
(!animation.mOriginTime.IsNull() &&
animation.mStartTime.type() == MaybeTimeDuration::TTimeDuration) ||
(!animation.mOriginTime.IsNull() && animation.mStartTime.isSome()) ||
animation.mIsNotPlaying,
"If we are playing, we should have an origin time and a start time");
@ -192,7 +191,7 @@ static AnimationHelper::SampleResult SampleAnimationForProperty(
// underflow in the middle of the calulation.
const TimeStamp readyTime =
animation.mOriginTime +
(animation.mStartTime.get_TimeDuration() +
(animation.mStartTime.ref() +
animation.mHoldTime.MultDouble(1.0 / animation.mPlaybackRate));
hasFutureReadyTime =
!readyTime.IsNull() && readyTime > aPreviousFrameTime;
@ -216,11 +215,9 @@ static AnimationHelper::SampleResult SampleAnimationForProperty(
// If the animation is not currently playing, e.g. paused or
// finished, then use the hold time to stay at the same position.
TimeDuration elapsedDuration =
animation.mIsNotPlaying ||
animation.mStartTime.type() != MaybeTimeDuration::TTimeDuration
animation.mIsNotPlaying || animation.mStartTime.isNothing()
? animation.mHoldTime
: (timeStamp - animation.mOriginTime -
animation.mStartTime.get_TimeDuration())
: (timeStamp - animation.mOriginTime - animation.mStartTime.ref())
.MultDouble(animation.mPlaybackRate);
ComputedTiming computedTiming = dom::AnimationEffect::GetComputedTimingAt(

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

@ -52,7 +52,7 @@ struct PropertyAnimation {
dom::Nullable<double> mPortionInSegmentOnLastCompose;
TimeStamp mOriginTime;
MaybeTimeDuration mStartTime;
Maybe<TimeDuration> mStartTime;
TimeDuration mHoldTime;
float mPlaybackRate;
dom::IterationCompositeOperation mIterationComposite;

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

@ -88,23 +88,21 @@ bool AnimationInfo::StartPendingAnimations(const TimeStamp& aReadyTime) {
// If the animation is doing an async update of its playback rate, then we
// want to match whatever its current time would be at *aReadyTime*.
if (!std::isnan(anim.previousPlaybackRate()) &&
anim.startTime().type() == MaybeTimeDuration::TTimeDuration &&
if (!std::isnan(anim.previousPlaybackRate()) && anim.startTime().isSome() &&
!anim.originTime().IsNull() && !anim.isNotPlaying()) {
TimeDuration readyTime = aReadyTime - anim.originTime();
anim.holdTime() = dom::Animation::CurrentTimeFromTimelineTime(
readyTime, anim.startTime().get_TimeDuration(),
anim.previousPlaybackRate());
readyTime, anim.startTime().ref(), anim.previousPlaybackRate());
// Make start time null so that we know to update it below.
anim.startTime() = null_t();
anim.startTime() = Nothing();
}
// If the animation is play-pending, resolve the start time.
if (anim.startTime().type() == MaybeTimeDuration::Tnull_t &&
!anim.originTime().IsNull() && !anim.isNotPlaying()) {
if (anim.startTime().isNothing() && !anim.originTime().IsNull() &&
!anim.isNotPlaying()) {
TimeDuration readyTime = aReadyTime - anim.originTime();
anim.startTime() = dom::Animation::StartTimeFromTimelineTime(
readyTime, anim.holdTime(), anim.playbackRate());
anim.startTime() = Some(dom::Animation::StartTimeFromTimelineTime(
readyTime, anim.holdTime(), anim.playbackRate()));
updated = true;
}
}

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

@ -162,11 +162,6 @@ union TransformFunction {
TransformMatrix;
};
union MaybeTimeDuration {
null_t;
TimeDuration;
};
union Animatable {
null_t;
float;
@ -214,7 +209,7 @@ struct Animation {
TimeStamp originTime;
// The start time is relative to the originTime. This allows us to represent
// start times in the distant past that cannot be expressed using a TimeStamp.
MaybeTimeDuration startTime;
TimeDuration? startTime;
TimeDuration delay;
TimeDuration endDelay;
// The value of the animation's current time at the moment it was sent to the

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

@ -570,9 +570,9 @@ static void AddAnimationForProperty(nsIFrame* aFrame,
Nullable<TimeDuration> startTime = aAnimation->GetCurrentOrPendingStartTime();
if (startTime.IsNull()) {
animation->startTime() = null_t();
animation->startTime() = Nothing();
} else {
animation->startTime() = startTime.Value();
animation->startTime() = Some(startTime.Value());
}
animation->holdTime() = aAnimation->GetCurrentTimeAsDuration().Value();