style: Update rust's step function basd on C++ ComputedTimingFunction

Differential Revision: https://phabricator.services.mozilla.com/D150566
This commit is contained in:
David Shin 2022-07-09 17:33:57 +00:00 committed by Martin Robinson
parent a585d41910
commit 168c868330
3 changed files with 50 additions and 19 deletions

View file

@ -27,6 +27,7 @@ use crate::stylesheets::layer_rule::LayerOrder;
use crate::values::animated::{Animate, Procedure};
use crate::values::computed::{Time, TimingFunction};
use crate::values::generics::box_::AnimationIterationCount;
use crate::values::generics::easing::BeforeFlag;
use crate::Atom;
use fxhash::FxHashMap;
use parking_lot::RwLock;
@ -84,7 +85,12 @@ impl PropertyAnimation {
/// The output of the timing function given the progress ration of this animation.
fn timing_function_output(&self, progress: f64) -> f64 {
let epsilon = 1. / (200. * self.duration);
self.timing_function.calculate_output(progress, epsilon)
// FIXME: Need to set the before flag correctly.
// In order to get the before flag, we have to know the current animation phase
// and whether the iteration is reversed. For now, we skip this calculation
// by treating as if the flag is unset at all times.
// https://drafts.csswg.org/css-easing/#step-timing-function-algo
self.timing_function.calculate_output(progress, BeforeFlag::Unset, epsilon)
}
/// Update the given animation at a given point of progress.