Bug 1399714 - Iterate animation segments for setting start/end values and timing functions just once. r=boris

MozReview-Commit-ID: 7ySuFcSi3cH

--HG--
extra : rebase_source : aef6b905fb34782700fc354905fc0a5d4c72e857
This commit is contained in:
Hiroyuki Ikezoe 2017-09-14 12:59:06 +09:00
parent 38ed548903
commit aef8a014cd

View File

@ -515,22 +515,18 @@ AnimationHelper::SetAnimations(AnimationArray& aAnimations,
AnimData* data = aAnimData.AppendElement();
InfallibleTArray<Maybe<ComputedTimingFunction>>& functions =
data->mFunctions;
const InfallibleTArray<AnimationSegment>& segments = animation.segments();
for (uint32_t j = 0; j < segments.Length(); j++) {
TimingFunction tf = segments.ElementAt(j).sampleFn();
Maybe<ComputedTimingFunction> ctf =
AnimationUtils::TimingFunctionToComputedTimingFunction(tf);
functions.AppendElement(ctf);
}
// Precompute the StyleAnimationValues that we need if this is a transform
// animation.
InfallibleTArray<StyleAnimationValue>& startValues = data->mStartValues;
InfallibleTArray<StyleAnimationValue>& endValues = data->mEndValues;
const InfallibleTArray<AnimationSegment>& segments = animation.segments();
for (const AnimationSegment& segment : segments) {
startValues.AppendElement(ToStyleAnimationValue(segment.startState()));
endValues.AppendElement(ToStyleAnimationValue(segment.endState()));
TimingFunction tf = segment.sampleFn();
Maybe<ComputedTimingFunction> ctf =
AnimationUtils::TimingFunctionToComputedTimingFunction(tf);
functions.AppendElement(ctf);
}
}
}