diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index fa296a3046a..3e24a08103b 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -341,7 +341,11 @@ } context.builder.put_${data.current_style_struct.name_lower}(s); % else: + % if property.boxed: + let computed = (**specified_value).to_computed_value(context); + % else: let computed = specified_value.to_computed_value(context); + % endif % if property.ident == "font_size": longhands::font_size::cascade_specified_font_size( context, diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index bb0fd657b5d..278dcf2138d 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -544,7 +544,11 @@ impl AnimationValue { longhands::system_font::resolve_system_font(sf, context); } % endif + % if prop.boxed: + let computed = (**val).to_computed_value(context); + % else: let computed = val.to_computed_value(context); + % endif Some(AnimationValue::${prop.camel_case}( % if prop.is_animatable_with_computed_value: computed diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index 7df0886ccd5..a0ebfda3171 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -408,7 +408,7 @@ impl ToComputedValue for specified::LengthOrPercentage { LengthOrPercentage::Percentage(value) } specified::LengthOrPercentage::Calc(ref calc) => { - LengthOrPercentage::Calc(calc.to_computed_value(context)) + LengthOrPercentage::Calc((**calc).to_computed_value(context)) } } } @@ -502,7 +502,7 @@ impl ToComputedValue for specified::LengthOrPercentageOrAuto { LengthOrPercentageOrAuto::Auto } specified::LengthOrPercentageOrAuto::Calc(ref calc) => { - LengthOrPercentageOrAuto::Calc(calc.to_computed_value(context)) + LengthOrPercentageOrAuto::Calc((**calc).to_computed_value(context)) } } } @@ -591,7 +591,7 @@ impl ToComputedValue for specified::LengthOrPercentageOrNone { LengthOrPercentageOrNone::Percentage(value) } specified::LengthOrPercentageOrNone::Calc(ref calc) => { - LengthOrPercentageOrNone::Calc(calc.to_computed_value(context)) + LengthOrPercentageOrNone::Calc((**calc).to_computed_value(context)) } specified::LengthOrPercentageOrNone::None => { LengthOrPercentageOrNone::None diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index 94cc1706c4a..aedb8ca31f2 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -296,6 +296,22 @@ impl ToComputedValue for Vec } } +impl ToComputedValue for Box + where T: ToComputedValue +{ + type ComputedValue = Box<::ComputedValue>; + + #[inline] + fn to_computed_value(&self, context: &Context) -> Self::ComputedValue { + Box::new(T::to_computed_value(self, context)) + } + + #[inline] + fn from_computed_value(computed: &Self::ComputedValue) -> Self { + Box::new(T::from_computed_value(computed)) + } +} + impl ToComputedValue for Box<[T]> where T: ToComputedValue {