diff options
Diffstat (limited to 'components/style/properties/declaration_block.rs')
-rw-r--r-- | components/style/properties/declaration_block.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index 90dec0a47d7..53b483887ce 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -8,7 +8,7 @@ use super::*; use crate::context::QuirksMode; -use crate::custom_properties::{CssEnvironment, CustomPropertiesBuilder}; +use crate::custom_properties::CustomPropertiesBuilder; use crate::error_reporting::{ContextualParseError, ParseErrorReporter}; use crate::parser::ParserContext; use crate::properties::animated_properties::{AnimationValue, AnimationValueMap}; @@ -778,6 +778,7 @@ impl PropertyDeclarationBlock { dest: &mut CssStringWriter, computed_values: Option<&ComputedValues>, custom_properties_block: Option<&PropertyDeclarationBlock>, + device: &Device, ) -> fmt::Result { if let Ok(shorthand) = property.as_shorthand() { return self.shorthand_to_css(shorthand, dest); @@ -790,19 +791,13 @@ impl PropertyDeclarationBlock { None => return Err(fmt::Error), }; - // TODO(emilio): When we implement any environment variable without - // hard-coding the values we're going to need to get something - // meaningful out of here... All this code path is so terribly hacky - // ;_;. - let env = CssEnvironment; - let custom_properties = if let Some(cv) = computed_values { // If there are extra custom properties for this declaration block, // factor them in too. if let Some(block) = custom_properties_block { // FIXME(emilio): This is not super-efficient here, and all this // feels like a hack anyway... - block.cascade_custom_properties(cv.custom_properties(), &env) + block.cascade_custom_properties(cv.custom_properties(), device) } else { cv.custom_properties().cloned() } @@ -825,7 +820,7 @@ impl PropertyDeclarationBlock { declaration.id, custom_properties.as_ref(), QuirksMode::NoQuirks, - &env, + device, ) .to_css(dest) }, @@ -873,7 +868,7 @@ impl PropertyDeclarationBlock { ) -> Option<Arc<crate::custom_properties::CustomPropertiesMap>> { self.cascade_custom_properties( context.style().custom_properties(), - context.device().environment(), + context.device(), ) } @@ -883,9 +878,9 @@ impl PropertyDeclarationBlock { fn cascade_custom_properties( &self, inherited_custom_properties: Option<&Arc<crate::custom_properties::CustomPropertiesMap>>, - environment: &CssEnvironment, + device: &Device, ) -> Option<Arc<crate::custom_properties::CustomPropertiesMap>> { - let mut builder = CustomPropertiesBuilder::new(inherited_custom_properties, environment); + let mut builder = CustomPropertiesBuilder::new(inherited_custom_properties, device); for declaration in self.normal_declaration_iter() { if let PropertyDeclaration::Custom(ref declaration) = *declaration { |