mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Reduce duplication in generated ServoComputedData::to_declaration_block.
This commit is contained in:
parent
00867711b3
commit
ca9b231173
1 changed files with 12 additions and 14 deletions
|
@ -342,29 +342,27 @@ impl ComputedValuesInner {
|
|||
pub fn is_multicol(&self) -> bool { false }
|
||||
|
||||
pub fn to_declaration_block(&self, property: PropertyDeclarationId) -> PropertyDeclarationBlock {
|
||||
match property {
|
||||
let value = match property {
|
||||
% for prop in data.longhands:
|
||||
% if prop.animatable:
|
||||
PropertyDeclarationId::Longhand(LonghandId::${prop.camel_case}) => {
|
||||
PropertyDeclarationBlock::with_one(
|
||||
PropertyDeclaration::${prop.camel_case}(
|
||||
% if prop.boxed:
|
||||
Box::new(
|
||||
% endif
|
||||
longhands::${prop.ident}::SpecifiedValue::from_computed_value(
|
||||
&self.get_${prop.style_struct.ident.strip("_")}().clone_${prop.ident}())
|
||||
% if prop.boxed:
|
||||
)
|
||||
% endif
|
||||
),
|
||||
Importance::Normal
|
||||
PropertyDeclaration::${prop.camel_case}(
|
||||
% if prop.boxed:
|
||||
Box::new(
|
||||
% endif
|
||||
longhands::${prop.ident}::SpecifiedValue::from_computed_value(
|
||||
&self.get_${prop.style_struct.ident.strip("_")}().clone_${prop.ident}())
|
||||
% if prop.boxed:
|
||||
)
|
||||
% endif
|
||||
)
|
||||
},
|
||||
% endif
|
||||
% endfor
|
||||
PropertyDeclarationId::Custom(_name) => unimplemented!(),
|
||||
_ => unimplemented!()
|
||||
}
|
||||
};
|
||||
PropertyDeclarationBlock::with_one(value, Importance::Normal)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue