From 8367c96c1b1f9cbadda04d258438002e807179f7 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 4 Jan 2017 13:52:44 -0500 Subject: [PATCH] Bug 1298588 part 11. Pass through useful default styles to CascadePropertyFn. r=bholley --- components/style/properties/helpers.mako.rs | 3 ++- components/style/properties/properties.mako.rs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index 89e9d1d2b2e..f072da97c8f 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -210,6 +210,7 @@ #[allow(unused_variables)] pub fn cascade_property(declaration: &PropertyDeclaration, inherited_style: &ComputedValues, + default_style: &Arc, context: &mut computed::Context, seen: &mut PropertyBitField, cacheable: &mut bool, @@ -260,7 +261,7 @@ DeclaredValue::Initial => { // We assume that it's faster to use copy_*_from rather than // set_*(get_initial_value()); - let initial_struct = ComputedValues::initial_values() + let initial_struct = default_style .get_${data.current_style_struct.name_lower}(); context.mutate_style().mutate_${data.current_style_struct.name_lower}() .copy_${property.ident}_from(initial_struct ${maybe_wm}); diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index d5d068060bf..d3a84e857c0 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1668,6 +1668,7 @@ mod lazy_static_module { pub type CascadePropertyFn = extern "Rust" fn(declaration: &PropertyDeclaration, inherited_style: &ComputedValues, + default_style: &Arc, context: &mut computed::Context, seen: &mut PropertyBitField, cacheable: &mut bool, @@ -1875,6 +1876,7 @@ pub fn apply_declarations<'a, F, I>(viewport_size: Size2D, let discriminant = longhand_id as usize; (CASCADE_PROPERTY[discriminant])(declaration, inherited_style, + default_style, &mut context, &mut seen, &mut cacheable,