From f1642eb7a691ea2c09e7d988555f56a6f494815b Mon Sep 17 00:00:00 2001 From: Hiroyuki Ikezoe Date: Fri, 7 Apr 2017 10:59:42 +0900 Subject: [PATCH] Make word-spacing animatable. --- components/style/properties/gecko.mako.rs | 13 +++++++++++++ .../properties/longhand/inherited_text.mako.rs | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 6941dbbb152..096d0611c3c 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -2902,6 +2902,19 @@ fn static_assert() { } } + pub fn clone_word_spacing(&self) -> longhands::word_spacing::computed_value::T { + use properties::longhands::word_spacing::computed_value::T; + use values::computed::LengthOrPercentage; + debug_assert!( + matches!(self.gecko.mWordSpacing.as_value(), + CoordDataValue::Normal | + CoordDataValue::Coord(_) | + CoordDataValue::Percent(_) | + CoordDataValue::Calc(_)), + "Unexpected computed value for word-spacing"); + T(LengthOrPercentage::from_gecko_style_coord(&self.gecko.mWordSpacing)) + } + <%call expr="impl_coord_copy('word_spacing', 'mWordSpacing')"> fn clear_text_emphasis_style_if_string(&mut self) { diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 383ea838031..07054fbbd56 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -491,7 +491,7 @@ ${helpers.single_keyword("text-align-last", } -<%helpers:longhand name="word-spacing" animation_type="none" +<%helpers:longhand name="word-spacing" animation_type="normal" spec="https://drafts.csswg.org/css-text/#propdef-word-spacing"> use std::fmt; use style_traits::ToCss; @@ -523,10 +523,13 @@ ${helpers.single_keyword("text-align-last", } pub mod computed_value { + use properties::animated_properties::Interpolate; use values::computed::LengthOrPercentage; #[derive(Debug, Clone, PartialEq)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T(pub Option); + + ${helpers.impl_interpolate_for_option_tuple('LengthOrPercentage::zero()')} } impl ToCss for computed_value::T {