Further changes required by Servo

This commit is contained in:
Oriol Brufau 2023-05-27 07:17:13 +02:00
parent 4522e7f94a
commit 35bf5f0b09

View file

@ -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. /// A calc node representation for specified values.
pub type CalcNode = generic::GenericCalcNode<Leaf>; pub type CalcNode = generic::GenericCalcNode<Leaf>;
@ -314,7 +321,7 @@ impl CalcNode {
CalcNode::parse(context, input, function, expected_unit) CalcNode::parse(context, input, function, expected_unit)
}, },
(&Token::Ident(ref ident), _) => { (&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()))); return Err(location.new_unexpected_token_error(Token::Ident(ident.clone())));
} }
let number = match_ignore_ascii_case! { &**ident, 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()))), 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()))); return Err(location.new_unexpected_token_error(Token::Function(name.clone())));
} }