mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Make PropertyFiledBit usable for TransitionProperty.
This commit is contained in:
parent
03893e25cc
commit
279a50fb74
1 changed files with 30 additions and 2 deletions
|
@ -181,8 +181,10 @@ pub mod animated_properties {
|
||||||
|
|
||||||
// TODO(SimonSapin): Convert this to a syntax extension rather than a Mako template.
|
// TODO(SimonSapin): Convert this to a syntax extension rather than a Mako template.
|
||||||
// Maybe submit for inclusion in libstd?
|
// Maybe submit for inclusion in libstd?
|
||||||
mod property_bit_field {
|
#[allow(missing_docs)]
|
||||||
|
pub mod property_bit_field {
|
||||||
use logical_geometry::WritingMode;
|
use logical_geometry::WritingMode;
|
||||||
|
use properties::animated_properties::TransitionProperty;
|
||||||
|
|
||||||
/// A bitfield for all longhand properties, in order to quickly test whether
|
/// A bitfield for all longhand properties, in order to quickly test whether
|
||||||
/// we've seen one of them.
|
/// we've seen one of them.
|
||||||
|
@ -213,7 +215,7 @@ mod property_bit_field {
|
||||||
pub fn get_${property.ident}(&self) -> bool {
|
pub fn get_${property.ident}(&self) -> bool {
|
||||||
self.get(${i})
|
self.get(${i})
|
||||||
}
|
}
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case, missing_docs)]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn set_${property.ident}(&mut self) {
|
pub fn set_${property.ident}(&mut self) {
|
||||||
self.set(${i})
|
self.set(${i})
|
||||||
|
@ -238,6 +240,32 @@ mod property_bit_field {
|
||||||
}
|
}
|
||||||
% endif
|
% endif
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
|
/// Set the corresponding bit of TransitionProperty.
|
||||||
|
/// This function will panic if TransitionProperty::All is given.
|
||||||
|
pub fn set_transition_property_bit(&mut self, property: &TransitionProperty) {
|
||||||
|
match *property {
|
||||||
|
% for i, prop in enumerate(data.longhands):
|
||||||
|
% if prop.animatable:
|
||||||
|
TransitionProperty::${prop.camel_case} => self.set(${i}),
|
||||||
|
% endif
|
||||||
|
% endfor
|
||||||
|
TransitionProperty::All => unreachable!("Tried to set TransitionProperty::All in a PropertyBitfield"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return true if the corresponding bit of TransitionProperty is set.
|
||||||
|
/// This function will panic if TransitionProperty::All is given.
|
||||||
|
pub fn has_transition_property_bit(&self, property: &TransitionProperty) -> bool {
|
||||||
|
match *property {
|
||||||
|
% for i, prop in enumerate(data.longhands):
|
||||||
|
% if prop.animatable:
|
||||||
|
TransitionProperty::${prop.camel_case} => self.get(${i}),
|
||||||
|
% endif
|
||||||
|
% endfor
|
||||||
|
TransitionProperty::All => unreachable!("Tried to get TransitionProperty::All in a PropertyBitfield"),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue