aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/custom_properties.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/style/custom_properties.rs')
-rw-r--r--components/style/custom_properties.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs
index df3f9660dd4..a6908bb4cfa 100644
--- a/components/style/custom_properties.rs
+++ b/components/style/custom_properties.rs
@@ -71,10 +71,19 @@ static ENVIRONMENT_VARIABLES: [EnvironmentVariable; 4] = [
make_variable!(atom!("safe-area-inset-right"), get_safearea_inset_right),
];
+static CHROME_ENVIRONMENT_VARIABLES: [EnvironmentVariable; 0] = [
+];
+
impl CssEnvironment {
#[inline]
fn get(&self, name: &Atom, device: &Device) -> Option<VariableValue> {
- let var = ENVIRONMENT_VARIABLES.iter().find(|var| var.name == *name)?;
+ if let Some(var) = ENVIRONMENT_VARIABLES.iter().find(|var| var.name == *name) {
+ return Some((var.evaluator)(device));
+ }
+ if !device.is_chrome_document() {
+ return None;
+ }
+ let var = CHROME_ENVIRONMENT_VARIABLES.iter().find(|var| var.name == *name)?;
Some((var.evaluator)(device))
}
}