style: Remove boilerplate code in the properties module.

This commit is contained in:
Emilio Cobos Álvarez 2017-10-01 13:17:53 +02:00
parent 4933a54803
commit d2dab24748
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -2145,16 +2145,16 @@ impl ComputedValues {
% endfor % endfor
) -> Arc<Self> { ) -> Arc<Self> {
Arc::new(Self { Arc::new(Self {
inner: ComputedValuesInner::new( inner: ComputedValuesInner {
custom_properties, custom_properties,
writing_mode, writing_mode,
flags,
rules, rules,
visited_style, visited_style,
% for style_struct in data.active_style_structs(): flags,
% for style_struct in data.active_style_structs():
${style_struct.ident}, ${style_struct.ident},
% endfor % endfor
) }
}) })
} }
@ -2162,32 +2162,6 @@ impl ComputedValues {
pub fn initial_values() -> &'static Self { &*INITIAL_SERVO_VALUES } pub fn initial_values() -> &'static Self { &*INITIAL_SERVO_VALUES }
} }
#[cfg(feature = "servo")]
impl ComputedValuesInner {
/// Construct a `ComputedValuesInner` instance.
pub fn new(
custom_properties: Option<Arc<::custom_properties::CustomPropertiesMap>>,
writing_mode: WritingMode,
flags: ComputedValueFlags,
rules: Option<StrongRuleNode>,
visited_style: Option<Arc<ComputedValues>>,
% for style_struct in data.active_style_structs():
${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
% endfor
) -> Self {
ComputedValuesInner {
custom_properties: custom_properties,
writing_mode: writing_mode,
rules: rules,
visited_style: visited_style,
flags: flags,
% for style_struct in data.active_style_structs():
${style_struct.ident}: ${style_struct.ident},
% endfor
}
}
}
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
impl ops::Deref for ComputedValues { impl ops::Deref for ComputedValues {
type Target = ComputedValuesInner; type Target = ComputedValuesInner;