aboutsummaryrefslogtreecommitdiffstats
path: root/components/style
diff options
context:
space:
mode:
authorHiroyuki Ikezoe <hikezoe@mozilla.com>2017-02-22 18:48:46 +0900
committerHiroyuki Ikezoe <hikezoe@mozilla.com>2017-02-22 19:04:43 +0900
commit279a50fb748da051a3c16950787ac63b36a2089c (patch)
treeda4a1cc6ff770ddd2ca25c1c9fa8fb1a01b5500a /components/style
parent03893e25cc00488dea540ce53865f7f696f8f262 (diff)
downloadservo-279a50fb748da051a3c16950787ac63b36a2089c.tar.gz
servo-279a50fb748da051a3c16950787ac63b36a2089c.zip
Make PropertyFiledBit usable for TransitionProperty.
Diffstat (limited to 'components/style')
-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"),
+ }
+ }
}
}