Open Bug 1293492 Opened 8 years ago Updated 2 years ago

Need a utility function to calculate accumulation for both of start and end values

Categories

(Core :: DOM: Animation, defect, P3)

defect

Tracking

()

People

(Reporter: hiro, Unassigned)

References

Details

In bug 1216843, we are going to calculate each accumulated values in KeyframeEffectReadOnly::ComposeStyle and SampleValue on the compositor like this;
                          
    StyleAnimationValue::Accumulate(aAnimation.property(),                      
                                    startValue,                                 
                                    aLastValue,                                 
                                    aCurrentIteration);                         
    StyleAnimationValue::Accumulate(aAnimation.property(),                      
                                    endValue,                                   
                                    aLastValue,                                 
                                    aCurrentIteration)

This can be re-written by a utility function like this;

  StyleAnimationValue::AccumulateStartAndEndValues(aAnimation.property(),
                                                   startValue,
                                                   endValue,
                                                   aLastValue,
                                                   aCurrentIteration);
Actually I was thinking more about covering a slightly wider scope since we have these two blocks:

KeyframeEffect.cpp:

> StyleAnimationValue fromValue = segment->mFromValue;
> StyleAnimationValue toValue = segment->mToValue;
> // Iteration composition for accumulate
> if (mEffectOptions.mIterationComposite ==
>       IterationCompositeOperation::Accumulate &&
>     computedTiming.mCurrentIteration > 0) {
>   const AnimationPropertySegment& lastSegment =
>     prop.mSegments.LastElement();
>   // FIXME: Bug 1293492: Add a utility function to calculate both of
>   // below StyleAnimationValues.
>   StyleAnimationValue::Accumulate(prop.mProperty,
>                                   fromValue,
>                                   lastSegment.mToValue,
>                                   computedTiming.mCurrentIteration);
>   StyleAnimationValue::Accumulate(prop.mProperty,
>                                   toValue,
>                                   lastSegment.mToValue,
>                                   computedTiming.mCurrentIteration);
> }

AsyncCompositionManager.cpp:

> StyleAnimationValue startValue = aStart;
> StyleAnimationValue endValue = aEnd;
> // Iteration composition for accumulate
> if (static_cast<dom::IterationCompositeOperation>
>       (aAnimation.iterationComposite()) ==
>         dom::IterationCompositeOperation::Accumulate &&
>     aCurrentIteration > 0) {
>   // FIXME: Bug 1293492: Add a utility function to calculate both of
>   // below StyleAnimationValues.
>   StyleAnimationValue::Accumulate(aAnimation.property(),
>                                   startValue,
>                                   aLastValue,
>                                   aCurrentIteration);
>   StyleAnimationValue::Accumulate(aAnimation.property(),
>                                   endValue,
>                                   aLastValue,
>                                   aCurrentIteration);
> }

Also, looking at that code, I notice that the version in KeyframeEffect.cpp also has extra functionality like handling zero-length segments that we don't seem to run on the compositor. That's possibly a bug. Perhaps we can move all that code into some utility function and make this consistent at the same time.
See Also: → 1340005
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.