mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Always use CssEnvironment from media query's device.
Although CssEnvironment is in Device of media query implementation, some code creates CssEnvironment instance without Device. So I would like always to use it from Device of media query. Differential Revision: https://phabricator.services.mozilla.com/D52506
This commit is contained in:
parent
88fe64d845
commit
c5bd98354d
1 changed files with 3 additions and 8 deletions
|
@ -778,6 +778,7 @@ impl PropertyDeclarationBlock {
|
|||
dest: &mut CssStringWriter,
|
||||
computed_values: Option<&ComputedValues>,
|
||||
custom_properties_block: Option<&PropertyDeclarationBlock>,
|
||||
environment: &CssEnvironment,
|
||||
) -> 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(), environment)
|
||||
} else {
|
||||
cv.custom_properties().cloned()
|
||||
}
|
||||
|
@ -825,7 +820,7 @@ impl PropertyDeclarationBlock {
|
|||
declaration.id,
|
||||
custom_properties.as_ref(),
|
||||
QuirksMode::NoQuirks,
|
||||
&env,
|
||||
environment,
|
||||
)
|
||||
.to_css(dest)
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue