mirror of
https://github.com/servo/servo.git
synced 2025-10-03 18:19:14 +01:00
This brings the behaviour inline with `linear-gradient(...)` Differential Revision: https://phabricator.services.mozilla.com/D149926
31 lines
1.1 KiB
Rust
31 lines
1.1 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
|
|
//! Computed types for CSS Easing functions.
|
|
|
|
use crate::piecewise_linear::PiecewiseLinearFunctionBuildParameters;
|
|
use crate::values::computed::{Integer, Number, Percentage};
|
|
use crate::values::generics::easing;
|
|
|
|
/// A computed timing function.
|
|
pub type ComputedTimingFunction = easing::TimingFunction<Integer, Number, Percentage>;
|
|
|
|
/// An alias of the computed timing function.
|
|
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.into_rust().map(|x| x.0),
|
|
None,
|
|
)
|
|
}
|
|
}
|