diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 5e1b906a4f7..746ae31f2e5 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -50,7 +50,6 @@ use gecko::values::GeckoStyleCoordConvertible; use gecko::values::round_border_to_device_pixels; use gecko::values::StyleCoordHelpers; use logical_geometry::WritingMode; -use properties::CascadePropertyFn; use properties::longhands; use std::fmt::{self, Debug}; use std::mem::{transmute, zeroed}; @@ -146,11 +145,6 @@ impl ComputedValues { set_raw_initial_values(ptr::null_mut()); } - #[inline] - pub fn do_cascade_property(f: F) { - f(&CASCADE_PROPERTY) - } - % for style_struct in data.style_structs: #[inline] pub fn clone_${style_struct.name_lower}(&self) -> Arc { @@ -2663,9 +2657,3 @@ unsafe fn raw_initial_values() -> *mut ComputedValues { unsafe fn set_raw_initial_values(v: *mut ComputedValues) { INITIAL_VALUES_STORAGE.store(v as usize, Ordering::Relaxed); } - -static CASCADE_PROPERTY: [CascadePropertyFn; ${len(data.longhands)}] = [ - % for property in data.longhands: - longhands::${property.ident}::cascade_property, - % endfor -]; diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 9d7247130f2..e27731c433a 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1691,60 +1691,58 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D, // // To improve i-cache behavior, we outline the individual functions and use // virtual dispatch instead. - ComputedValues::do_cascade_property(|cascade_property| { - % for category_to_cascade_now in ["early", "other"]: - for declaration in iter_declarations() { - let longhand_id = match declaration.id() { - PropertyDeclarationId::Longhand(id) => id, - PropertyDeclarationId::Custom(..) => continue, - }; + % for category_to_cascade_now in ["early", "other"]: + for declaration in iter_declarations() { + let longhand_id = match declaration.id() { + PropertyDeclarationId::Longhand(id) => id, + PropertyDeclarationId::Custom(..) => continue, + }; - // The computed value of some properties depends on the - // (sometimes computed) value of *other* properties. - // - // So we classify properties into "early" and "other", such that - // the only dependencies can be from "other" to "early". - // - // We iterate applicable_declarations twice, first cascading - // "early" properties then "other". - // - // Unfortunately, it’s not easy to check that this - // classification is correct. - let is_early_property = matches!(*declaration, - PropertyDeclaration::FontSize(_) | - PropertyDeclaration::FontFamily(_) | - PropertyDeclaration::Color(_) | - PropertyDeclaration::Position(_) | - PropertyDeclaration::Float(_) | - PropertyDeclaration::TextDecoration${'' if product == 'servo' else 'Line'}(_) | - PropertyDeclaration::WritingMode(_) | - PropertyDeclaration::Direction(_) | - PropertyDeclaration::TextOrientation(_) - ); - if - % if category_to_cascade_now == "early": - ! - % endif - is_early_property - { - continue - } - - let discriminant = longhand_id as usize; - (cascade_property[discriminant])(declaration, - inherited_style, - &mut context, - &mut seen, - &mut cacheable, - &mut cascade_info, - &mut error_reporter); + // The computed value of some properties depends on the + // (sometimes computed) value of *other* properties. + // + // So we classify properties into "early" and "other", such that + // the only dependencies can be from "other" to "early". + // + // We iterate applicable_declarations twice, first cascading + // "early" properties then "other". + // + // Unfortunately, it’s not easy to check that this + // classification is correct. + let is_early_property = matches!(*declaration, + PropertyDeclaration::FontSize(_) | + PropertyDeclaration::FontFamily(_) | + PropertyDeclaration::Color(_) | + PropertyDeclaration::Position(_) | + PropertyDeclaration::Float(_) | + PropertyDeclaration::TextDecoration${'' if product == 'servo' else 'Line'}(_) | + PropertyDeclaration::WritingMode(_) | + PropertyDeclaration::Direction(_) | + PropertyDeclaration::TextOrientation(_) + ); + if + % if category_to_cascade_now == "early": + ! + % endif + is_early_property + { + continue } - % if category_to_cascade_now == "early": - let mode = get_writing_mode(context.style.get_inheritedbox()); - context.style.set_writing_mode(mode); - % endif - % endfor - }); + + let discriminant = longhand_id as usize; + (CASCADE_PROPERTY[discriminant])(declaration, + inherited_style, + &mut context, + &mut seen, + &mut cacheable, + &mut cascade_info, + &mut error_reporter); + } + % if category_to_cascade_now == "early": + let mode = get_writing_mode(context.style.get_inheritedbox()); + context.style.set_writing_mode(mode); + % endif + % endfor let mut style = context.style;