style: Fix Servo build.

This commit is contained in:
Emilio Cobos Álvarez 2020-02-10 16:09:18 +01:00
parent cccac2cedd
commit 8c6fe09dce
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
5 changed files with 55 additions and 6 deletions

View file

@ -73,6 +73,10 @@ pub struct CalcVariant {
ptr: *mut CalcLengthPercentage,
}
// `CalcLengthPercentage` is `Send + Sync` as asserted below.
unsafe impl Send for CalcVariant {}
unsafe impl Sync for CalcVariant {}
#[doc(hidden)]
#[derive(Copy, Clone)]
#[repr(C)]
@ -130,10 +134,14 @@ enum Tag {
// All the members should be 64 bits, even in 32-bit builds.
#[allow(unused)]
unsafe fn static_assert() {
fn assert_send_and_sync<T: Send + Sync>() {}
std::mem::transmute::<u64, LengthVariant>(0u64);
std::mem::transmute::<u64, PercentageVariant>(0u64);
std::mem::transmute::<u64, CalcVariant>(0u64);
std::mem::transmute::<u64, LengthPercentage>(0u64);
assert_send_and_sync::<LengthVariant>();
assert_send_and_sync::<PercentageVariant>();
assert_send_and_sync::<CalcLengthPercentage>();
}
impl Drop for LengthPercentage {

View file

@ -881,7 +881,17 @@ impl CalcNode {
return Ok(MathFunction::Calc);
}
if !static_prefs::pref!("layout.css.comparison-functions.enabled") {
#[cfg(feature = "gecko")]
fn comparison_functions_enabled() -> bool {
static_prefs::pref!("layout.css.comparison-functions.enabled")
}
#[cfg(feature = "servo")]
fn comparison_functions_enabled() -> bool {
false
}
if !comparison_functions_enabled() {
return Err(location.new_unexpected_token_error(Token::Function(name.clone())));
}