mirror of
https://github.com/servo/servo.git
synced 2025-08-27 08:08:19 +01:00
Allow vector properties to be set by iterator
This commit is contained in:
parent
dd3159f2f5
commit
33fb27c765
4 changed files with 174 additions and 78 deletions
|
@ -1509,12 +1509,26 @@ pub mod style_structs {
|
|||
% if longhand.logical:
|
||||
${helpers.logical_setter(name=longhand.name)}
|
||||
% else:
|
||||
/// Set ${longhand.name}.
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn set_${longhand.ident}(&mut self, v: longhands::${longhand.ident}::computed_value::T) {
|
||||
self.${longhand.ident} = v;
|
||||
}
|
||||
% if longhand.is_vector:
|
||||
/// Set ${longhand.name}.
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn set_${longhand.ident}<I>(&mut self, v: I)
|
||||
where I: IntoIterator<Item = longhands::${longhand.ident}
|
||||
::computed_value::single_value::T>,
|
||||
I::IntoIter: ExactSizeIterator
|
||||
{
|
||||
self.${longhand.ident} = longhands::${longhand.ident}::computed_value
|
||||
::T(v.into_iter().collect());
|
||||
}
|
||||
% else:
|
||||
/// Set ${longhand.name}.
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn set_${longhand.ident}(&mut self, v: longhands::${longhand.ident}::computed_value::T) {
|
||||
self.${longhand.ident} = v;
|
||||
}
|
||||
% endif
|
||||
/// Set ${longhand.name} from other struct.
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue