aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/style/properties/properties.mako.rs32
1 files changed, 30 insertions, 2 deletions
diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs
index be76f0cf1a3..e0623fcf780 100644
--- a/components/style/properties/properties.mako.rs
+++ b/components/style/properties/properties.mako.rs
@@ -181,8 +181,10 @@ pub mod animated_properties {
// TODO(SimonSapin): Convert this to a syntax extension rather than a Mako template.
// Maybe submit for inclusion in libstd?
-mod property_bit_field {
+#[allow(missing_docs)]
+pub mod property_bit_field {
use logical_geometry::WritingMode;
+ use properties::animated_properties::TransitionProperty;
/// A bitfield for all longhand properties, in order to quickly test whether
/// we've seen one of them.
@@ -213,7 +215,7 @@ mod property_bit_field {
pub fn get_${property.ident}(&self) -> bool {
self.get(${i})
}
- #[allow(non_snake_case)]
+ #[allow(non_snake_case, missing_docs)]
#[inline]
pub fn set_${property.ident}(&mut self) {
self.set(${i})
@@ -238,6 +240,32 @@ mod property_bit_field {
}
% endif
% 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"),
+ }
+ }
}
}