diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index bc6d5471b0d..2d55fd3c475 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -2882,6 +2882,15 @@ fn static_assert() { } } + pub fn clone_letter_spacing(&self) -> longhands::letter_spacing::computed_value::T { + use properties::longhands::letter_spacing::computed_value::T; + match self.gecko.mLetterSpacing.as_value() { + CoordDataValue::Normal => T(None), + CoordDataValue::Coord(coord) => T(Some(Au(coord))), + _ => unreachable!("Unexpected computed value for letter-spacing"), + } + } + <%call expr="impl_coord_copy('letter_spacing', 'mLetterSpacing')"> pub fn set_word_spacing(&mut self, v: longhands::word_spacing::computed_value::T) { diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 37d58b07386..baf8e0ecb8d 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -404,8 +404,7 @@ ${helpers.single_keyword("text-align-last", % endif -// FIXME: This prop should be animatable. -<%helpers:longhand name="letter-spacing" boxed="True" animatable="False" +<%helpers:longhand name="letter-spacing" boxed="True" animatable="True" spec="https://drafts.csswg.org/css-text/#propdef-letter-spacing"> use std::fmt; use style_traits::ToCss; @@ -438,9 +437,32 @@ ${helpers.single_keyword("text-align-last", pub mod computed_value { use app_units::Au; + use properties::animated_properties::Interpolate; + #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T(pub Option); + + impl Interpolate for T { + #[inline] + fn interpolate(&self, other: &Self, progress: f64) -> Result { + match (self, other) { + (&T(Some(ref this)), &T(Some(ref other))) => { + Ok(T(this.interpolate(other, progress).ok())) + }, + (&T(Some(ref this)), &T(None)) => { + Ok(T(this.interpolate(&Au(0), progress).ok())) + }, + (&T(None), &T(Some(ref other))) => { + Ok(T(Au(0).interpolate(other, progress).ok())) + }, + (&T(None), &T(None)) => { + Ok(T(None)) + }, + } + } + } + } impl ToCss for computed_value::T {