Bug 1418806 - Introduce a constant variable to represents the number of all animatable longhands. r?xidorn
We will use this number to cap the pre-allocation AnimationValueMap in the next
patch.
MozReview-Commit-ID: Iqq9plbD8Vl
--- a/servo/components/style/properties/properties.mako.rs
+++ b/servo/components/style/properties/properties.mako.rs
@@ -95,16 +95,17 @@ macro_rules! expanded {
}
/// A module with all the code for longhand properties.
#[allow(missing_docs)]
pub mod longhands {
% for style_struct in data.style_structs:
include!("${repr(os.path.join(OUT_DIR, 'longhands/{}.rs'.format(style_struct.name_lower)))[1:-1]}");
% endfor
+ pub const ANIMATABLE_PROPERTY_COUNT: usize = ${sum(1 for prop in data.longhands if prop.animatable)};
}
macro_rules! unwrap_or_initial {
($prop: ident) => (unwrap_or_initial!($prop, $prop));
($prop: ident, $expr: expr) =>
($expr.unwrap_or_else(|| $prop::get_initial_specified_value()));
}