mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Hook up linear easing calculation for servo and expose it to C++
Differential Revision: https://phabricator.services.mozilla.com/D146838
This commit is contained in:
parent
6326a384a8
commit
b31be826c4
3 changed files with 64 additions and 11 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
//! Computed types for CSS Easing functions.
|
||||
|
||||
use crate::piecewise_linear::PiecewiseLinearFunctionBuildParameters;
|
||||
use crate::values::computed::{Integer, Number, Percentage};
|
||||
use crate::values::generics::easing;
|
||||
|
||||
|
@ -15,3 +16,16 @@ pub type TimingFunction = ComputedTimingFunction;
|
|||
|
||||
/// A computed linear easing entry.
|
||||
pub type ComputedLinearStop = easing::LinearStop<Number, Percentage>;
|
||||
|
||||
impl ComputedLinearStop {
|
||||
/// Convert this type to entries that can be used to build PiecewiseLinearFunction.
|
||||
pub fn to_piecewise_linear_build_parameters(
|
||||
x: &ComputedLinearStop,
|
||||
) -> PiecewiseLinearFunctionBuildParameters {
|
||||
(
|
||||
x.output,
|
||||
x.input_start.into_rust().map(|x| x.0),
|
||||
x.input_end.into_rust().map(|x| x.0),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue