From 35bf5f0b093b76cd03449a68fe7b89e3262b79b8 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Sat, 27 May 2023 07:17:13 +0200 Subject: [PATCH] Further changes required by Servo --- components/style/values/specified/calc.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/style/values/specified/calc.rs b/components/style/values/specified/calc.rs index 39167a13647..a043e4ea96e 100644 --- a/components/style/values/specified/calc.rs +++ b/components/style/values/specified/calc.rs @@ -243,6 +243,13 @@ impl generic::CalcNodeLeaf for Leaf { } } +fn trig_enabled() -> bool { + #[cfg(feature = "gecko")] + return static_prefs::pref!("layout.css.trig.enabled"); + #[cfg(feature = "servo")] + return false; +} + /// A calc node representation for specified values. pub type CalcNode = generic::GenericCalcNode; @@ -314,7 +321,7 @@ impl CalcNode { CalcNode::parse(context, input, function, expected_unit) }, (&Token::Ident(ref ident), _) => { - if !static_prefs::pref!("layout.css.trig.enabled") { + if !trig_enabled() { return Err(location.new_unexpected_token_error(Token::Ident(ident.clone()))); } let number = match_ignore_ascii_case! { &**ident, @@ -593,7 +600,7 @@ impl CalcNode { Err(()) => return Err(location.new_unexpected_token_error(Token::Function(name.clone()))), }; - if matches!(function, Sin | Cos | Tan | Asin | Acos | Atan) && !static_prefs::pref!("layout.css.trig.enabled") { + if matches!(function, Sin | Cos | Tan | Asin | Acos | Atan) && !trig_enabled() { return Err(location.new_unexpected_token_error(Token::Function(name.clone()))); }