From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- servo/components/style/values/animated/font.rs | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 servo/components/style/values/animated/font.rs (limited to 'servo/components/style/values/animated/font.rs') diff --git a/servo/components/style/values/animated/font.rs b/servo/components/style/values/animated/font.rs new file mode 100644 index 0000000000..63d4a14b2f --- /dev/null +++ b/servo/components/style/values/animated/font.rs @@ -0,0 +1,37 @@ +/* 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/. */ + +//! Animation implementation for various font-related types. + +use super::{Animate, Procedure, ToAnimatedZero}; +use crate::values::computed::font::FontVariationSettings; +use crate::values::distance::{ComputeSquaredDistance, SquaredDistance}; + +/// +/// +/// Note that the ComputedValue implementation will already have sorted and de-dup'd +/// the lists of settings, so we can just iterate over the two lists together and +/// animate their individual values. +impl Animate for FontVariationSettings { + #[inline] + fn animate(&self, other: &Self, procedure: Procedure) -> Result { + let result: Vec<_> = + super::lists::by_computed_value::animate(&self.0, &other.0, procedure)?; + Ok(Self(result.into_boxed_slice())) + } +} + +impl ComputeSquaredDistance for FontVariationSettings { + #[inline] + fn compute_squared_distance(&self, other: &Self) -> Result { + super::lists::by_computed_value::squared_distance(&self.0, &other.0) + } +} + +impl ToAnimatedZero for FontVariationSettings { + #[inline] + fn to_animated_zero(&self) -> Result { + Err(()) + } +} -- cgit v1.2.3