mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Remove boilerplate code in the properties module.
This commit is contained in:
parent
4933a54803
commit
d2dab24748
1 changed files with 5 additions and 31 deletions
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue