From c49a49d7a5b049c002174ddb322f12eaee34b289 Mon Sep 17 00:00:00 2001 From: David Shin Date: Tue, 28 Jun 2022 11:31:34 +0000 Subject: [PATCH] style: `linear(...)` easing: Simplify piecewise linear implementation given parsing simplification Differential Revision: https://phabricator.services.mozilla.com/D150163 --- components/style/piecewise_linear.rs | 11 ++++------- components/style/values/computed/easing.rs | 1 - 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/components/style/piecewise_linear.rs b/components/style/piecewise_linear.rs index f833d6350ea..acc064fdbcc 100644 --- a/components/style/piecewise_linear.rs +++ b/components/style/piecewise_linear.rs @@ -26,7 +26,7 @@ pub struct PiecewiseLinearFunction { } /// Parameters to define one linear stop. -pub type PiecewiseLinearFunctionBuildParameters = (CSSFloat, Option, Option); +pub type PiecewiseLinearFunctionBuildParameters = (CSSFloat, Option); impl PiecewiseLinearFunction { /// Interpolate y value given x and two points. The linear function will be rooted at the asymptote. @@ -97,8 +97,8 @@ impl PiecewiseLinearFunction { Iter: Iterator + ExactSizeIterator, { let mut builder = PiecewiseLinearFunctionBuilder::with_capacity(iter.len()); - for (y, x_start, x_end) in iter { - builder = builder.push(y, x_start, x_end); + for (y, x_start) in iter { + builder = builder.push(y, x_start); } builder.build() } @@ -161,11 +161,8 @@ impl PiecewiseLinearFunctionBuilder { /// the x value is calculated later. If the end x value is specified, a flat segment /// is generated. If start x value is not specified but end x is, it is treated as /// start x. - pub fn push(mut self, y: CSSFloat, x_start: Option, x_end: Option) -> Self { + pub fn push(mut self, y: CSSFloat, x_start: Option) -> Self { self.create_entry(y, x_start); - if x_end.is_some() { - self.create_entry(y, x_end.map(|x| x)); - } self } diff --git a/components/style/values/computed/easing.rs b/components/style/values/computed/easing.rs index c75767c13e6..3a1a77a3575 100644 --- a/components/style/values/computed/easing.rs +++ b/components/style/values/computed/easing.rs @@ -25,7 +25,6 @@ impl ComputedLinearStop { ( x.output, x.input.into_rust().map(|x| x.0), - None, ) } }