diff --git a/components/style/gecko/media_queries.rs b/components/style/gecko/media_queries.rs index 52983c76287..7ff3b816cff 100644 --- a/components/style/gecko/media_queries.rs +++ b/components/style/gecko/media_queries.rs @@ -706,6 +706,7 @@ impl Expression { // TODO: pass the correct value here. quirks_mode: quirks_mode, for_smil_animation: false, + for_non_inherited_property: None, rule_cache_conditions: RefCell::new(&mut conditions), }; diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index 2b6218ee4fe..51e4228fe8a 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -314,6 +314,13 @@ _ => panic!("entered the wrong cascade_property() implementation"), }; + context.for_non_inherited_property = + % if property.style_struct.inherited: + None; + % else: + Some(LonghandId::${property.camel_case}); + % endif + % if not property.derived_from: match value { DeclaredValue::Value(specified_value) => { diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index abe972ef4b2..b106c6af830 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -3199,6 +3199,7 @@ where cached_system_font: None, in_media_query: false, for_smil_animation: false, + for_non_inherited_property: None, font_metrics_provider, quirks_mode, rule_cache_conditions: RefCell::new(rule_cache_conditions), diff --git a/components/style/servo/media_queries.rs b/components/style/servo/media_queries.rs index fcd0c04c863..244a67871fa 100644 --- a/components/style/servo/media_queries.rs +++ b/components/style/servo/media_queries.rs @@ -260,6 +260,7 @@ impl Range { cached_system_font: None, quirks_mode: quirks_mode, for_smil_animation: false, + for_non_inherited_property: None, rule_cache_conditions: RefCell::new(&mut conditions), }; diff --git a/components/style/stylesheets/viewport_rule.rs b/components/style/stylesheets/viewport_rule.rs index 89952d46a66..bfa41138dc9 100644 --- a/components/style/stylesheets/viewport_rule.rs +++ b/components/style/stylesheets/viewport_rule.rs @@ -718,6 +718,7 @@ impl MaybeNew for ViewportConstraints { in_media_query: false, quirks_mode: quirks_mode, for_smil_animation: false, + for_non_inherited_property: None, rule_cache_conditions: RefCell::new(&mut conditions), }; diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index 14a5eab86d3..605adace17b 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -11,7 +11,7 @@ use font_metrics::FontMetricsProvider; use media_queries::Device; #[cfg(feature = "gecko")] use properties; -use properties::{ComputedValues, StyleBuilder}; +use properties::{ComputedValues, LonghandId, StyleBuilder}; use rule_cache::RuleCacheConditions; #[cfg(feature = "servo")] use servo_url::ServoUrl; @@ -119,6 +119,12 @@ pub struct Context<'a> { /// values, which SMIL allows. pub for_smil_animation: bool, + /// The property we are computing a value for, if it is a non-inherited + /// property. None if we are computed a value for an inherited property + /// or not computing for a property at all (e.g. in a media query + /// evaluation). + pub for_non_inherited_property: Option, + /// The conditions to cache a rule node on the rule cache. /// /// FIXME(emilio): Drop the refcell. diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 3c8b4d37ab9..2a0095d3d6e 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -3203,6 +3203,7 @@ fn create_context<'a>( in_media_query: false, quirks_mode: per_doc_data.stylist.quirks_mode(), for_smil_animation, + for_non_inherited_property: None, rule_cache_conditions: RefCell::new(rule_cache_conditions), } }