mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #17774 - servo:derive-all-the-things, r=emilio
Prepare some code for future derivation 🌊 <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17774) <!-- Reviewable:end -->
This commit is contained in:
commit
d76d097891
18 changed files with 402 additions and 251 deletions
|
@ -9,7 +9,6 @@ use Atom;
|
|||
use bezier::Bezier;
|
||||
use context::SharedStyleContext;
|
||||
use dom::OpaqueNode;
|
||||
use euclid::Point2D;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use properties::{self, CascadeFlags, ComputedValues, Importance};
|
||||
use properties::animated_properties::{AnimatableLonghand, AnimatedProperty, TransitionProperty};
|
||||
|
@ -369,18 +368,10 @@ impl PropertyAnimation {
|
|||
|
||||
/// Update the given animation at a given point of progress.
|
||||
pub fn update(&self, style: &mut ComputedValues, time: f64) {
|
||||
let solve_bezier = |(p1, p2): (Point2D<_>, Point2D<_>)| {
|
||||
let epsilon = 1. / (200. * (self.duration.seconds() as f64));
|
||||
let bezier = Bezier::new(
|
||||
Point2D::new(p1.x as f64, p1.y as f64),
|
||||
Point2D::new(p2.x as f64, p2.y as f64),
|
||||
);
|
||||
bezier.solve(time, epsilon)
|
||||
};
|
||||
|
||||
let epsilon = 1. / (200. * (self.duration.seconds() as f64));
|
||||
let progress = match self.timing_function {
|
||||
GenericTimingFunction::CubicBezier(p1, p2) => {
|
||||
solve_bezier((p1, p2))
|
||||
GenericTimingFunction::CubicBezier { x1, y1, x2, y2 } => {
|
||||
Bezier::new(x1, y1, x2, y2).solve(time, epsilon)
|
||||
},
|
||||
GenericTimingFunction::Steps(steps, StepPosition::Start) => {
|
||||
(time * (steps as f64)).ceil() / (steps as f64)
|
||||
|
@ -405,7 +396,8 @@ impl PropertyAnimation {
|
|||
out
|
||||
},
|
||||
GenericTimingFunction::Keyword(keyword) => {
|
||||
solve_bezier(keyword.to_bezier_points())
|
||||
let (x1, x2, y1, y2) = keyword.to_bezier();
|
||||
Bezier::new(x1, x2, y1, y2).solve(time, epsilon)
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue