From 43e49705be1f762088b506e0a746393a79731b7a Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Fri, 1 Apr 2016 18:53:08 -0700 Subject: [PATCH] Implement GeckoComputedValues::do_cascade. With this patch, we finally panic on an actual style struct setter (set_text_rendering). Exciting! --- components/style/properties.mako.rs | 12 ++++++++---- ports/geckolib/properties.mako.rs | 11 +++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/components/style/properties.mako.rs b/components/style/properties.mako.rs index ce285c4d71b..0b9dcd11217 100644 --- a/components/style/properties.mako.rs +++ b/components/style/properties.mako.rs @@ -6722,10 +6722,8 @@ pub type CascadePropertyFn = cacheable: &mut bool, error_reporter: &mut Box); -// This is a thread-local rather than a lazy static to avoid atomic operations when cascading -// properties. -thread_local!(static CASCADE_PROPERTY: Vec>> = { - let mut result: Vec>> = Vec::new(); +pub fn make_cascade_vec() -> Vec>> { + let mut result: Vec>> = Vec::new(); % for style_struct in STYLE_STRUCTS: % for property in style_struct.longhands: let discriminant; @@ -6741,6 +6739,12 @@ thread_local!(static CASCADE_PROPERTY: Vec>> = { + make_cascade_vec::() }); /// Performs the CSS cascade, computing new styles for an element from its parent style and diff --git a/ports/geckolib/properties.mako.rs b/ports/geckolib/properties.mako.rs index 38e3b0ead44..94407b18c8f 100644 --- a/ports/geckolib/properties.mako.rs +++ b/ports/geckolib/properties.mako.rs @@ -19,6 +19,7 @@ use style::custom_properties::ComputedValuesMap; use style::logical_geometry::WritingMode; use style::properties::{CascadePropertyFn, ServoComputedValues, ComputedValues}; use style::properties::longhands; +use style::properties::make_cascade_vec; use style::properties::style_struct_traits::*; #[derive(Clone)] @@ -63,8 +64,8 @@ impl ComputedValues for GeckoComputedValues { fn initial_values() -> &'static Self { &*INITIAL_GECKO_VALUES } - fn do_cascade_property>>)>(_: F) { - unimplemented!() + fn do_cascade_property>>)>(f: F) { + CASCADE_PROPERTY.with(|x| f(x)); } % for style_struct in STYLE_STRUCTS: @@ -229,3 +230,9 @@ lazy_static! { root_font_size: longhands::font_size::get_initial_value(), }; } + +// This is a thread-local rather than a lazy static to avoid atomic operations when cascading +// properties. +thread_local!(static CASCADE_PROPERTY: Vec>> = { + make_cascade_vec::() +});