mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Fix Servo build.
This commit is contained in:
parent
cccac2cedd
commit
8c6fe09dce
5 changed files with 55 additions and 6 deletions
|
@ -2895,9 +2895,17 @@ pub struct ComputedValues {
|
||||||
/// We maintain this distinction in servo to reduce the amount of special
|
/// We maintain this distinction in servo to reduce the amount of special
|
||||||
/// casing.
|
/// casing.
|
||||||
inner: ComputedValuesInner,
|
inner: ComputedValuesInner,
|
||||||
|
|
||||||
|
/// The pseudo-element that we're using.
|
||||||
|
pseudo: Option<PseudoElement>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ComputedValues {
|
impl ComputedValues {
|
||||||
|
/// Returns the pseudo-element that this style represents.
|
||||||
|
pub fn pseudo(&self) -> Option<<&PseudoElement> {
|
||||||
|
self.pseudo.as_ref()
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns whether this style's display value is equal to contents.
|
/// Returns whether this style's display value is equal to contents.
|
||||||
pub fn is_display_contents(&self) -> bool {
|
pub fn is_display_contents(&self) -> bool {
|
||||||
self.get_box().clone_display().is_contents()
|
self.get_box().clone_display().is_contents()
|
||||||
|
@ -3000,7 +3008,7 @@ impl ComputedValues {
|
||||||
impl ComputedValues {
|
impl ComputedValues {
|
||||||
/// Create a new refcounted `ComputedValues`
|
/// Create a new refcounted `ComputedValues`
|
||||||
pub fn new(
|
pub fn new(
|
||||||
_: Option<<&PseudoElement>,
|
pseudo: Option<<&PseudoElement>,
|
||||||
custom_properties: Option<Arc<crate::custom_properties::CustomPropertiesMap>>,
|
custom_properties: Option<Arc<crate::custom_properties::CustomPropertiesMap>>,
|
||||||
writing_mode: WritingMode,
|
writing_mode: WritingMode,
|
||||||
flags: ComputedValueFlags,
|
flags: ComputedValueFlags,
|
||||||
|
@ -3020,7 +3028,8 @@ impl ComputedValues {
|
||||||
% for style_struct in data.active_style_structs():
|
% for style_struct in data.active_style_structs():
|
||||||
${style_struct.ident},
|
${style_struct.ident},
|
||||||
% endfor
|
% endfor
|
||||||
}
|
},
|
||||||
|
pseudo: pseudo.cloned(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3835,7 +3844,7 @@ pub use self::lazy_static_module::INITIAL_SERVO_VALUES;
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
mod lazy_static_module {
|
mod lazy_static_module {
|
||||||
use crate::logical_geometry::WritingMode;
|
use crate::logical_geometry::WritingMode;
|
||||||
use create::computed_value_flags::ComputedValueFlags;
|
use crate::computed_value_flags::ComputedValueFlags;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use super::{ComputedValues, ComputedValuesInner, longhands, style_structs};
|
use super::{ComputedValues, ComputedValuesInner, longhands, style_structs};
|
||||||
|
|
||||||
|
@ -3867,7 +3876,8 @@ mod lazy_static_module {
|
||||||
rules: None,
|
rules: None,
|
||||||
visited_style: None,
|
visited_style: None,
|
||||||
flags: ComputedValueFlags::empty(),
|
flags: ComputedValueFlags::empty(),
|
||||||
}
|
},
|
||||||
|
pseudo: None,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,7 @@ impl StyleSource {
|
||||||
|
|
||||||
// This is totally unsafe, should be removed when we figure out the cause of
|
// This is totally unsafe, should be removed when we figure out the cause of
|
||||||
// bug 1607553.
|
// bug 1607553.
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
unsafe fn dump_unchecked<W: Write>(&self, writer: &mut W) {
|
unsafe fn dump_unchecked<W: Write>(&self, writer: &mut W) {
|
||||||
if let Some(ref rule) = self.0.as_first() {
|
if let Some(ref rule) = self.0.as_first() {
|
||||||
let rule = rule.read_unchecked();
|
let rule = rule.read_unchecked();
|
||||||
|
@ -149,6 +150,7 @@ impl StyleSource {
|
||||||
// This is totally unsafe, should be removed when we figure out the cause of
|
// This is totally unsafe, should be removed when we figure out the cause of
|
||||||
// bug 1607553.
|
// bug 1607553.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
unsafe fn read_unchecked(&self) -> &PropertyDeclarationBlock {
|
unsafe fn read_unchecked(&self) -> &PropertyDeclarationBlock {
|
||||||
let block: &Locked<PropertyDeclarationBlock> = match self.0.borrow() {
|
let block: &Locked<PropertyDeclarationBlock> = match self.0.borrow() {
|
||||||
ArcUnionBorrow::First(ref rule) => &rule.get().read_unchecked().block,
|
ArcUnionBorrow::First(ref rule) => &rule.get().read_unchecked().block,
|
||||||
|
@ -1739,10 +1741,23 @@ impl Drop for StrongRuleNode {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if cfg!(debug_assertions) || crate::gecko_bindings::structs::GECKO_IS_NIGHTLY {
|
#[cfg(feature = "gecko")]
|
||||||
|
#[inline(always)]
|
||||||
|
fn assert_on_release() -> bool {
|
||||||
|
crate::gecko_bindings::structs::GECKO_IS_NIGHTLY
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "servo")]
|
||||||
|
fn assert_on_release() -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
if cfg!(debug_assertions) || assert_on_release() {
|
||||||
let children = node.children.read();
|
let children = node.children.read();
|
||||||
if !children.is_empty() {
|
if !children.is_empty() {
|
||||||
let mut crash_str = vec![];
|
let mut crash_str = vec![];
|
||||||
|
|
||||||
|
#[cfg(feature = "gecko")]
|
||||||
unsafe {
|
unsafe {
|
||||||
// Try to unsafely collect some information of this before
|
// Try to unsafely collect some information of this before
|
||||||
// crashing the process.
|
// crashing the process.
|
||||||
|
@ -1755,6 +1770,7 @@ impl Drop for StrongRuleNode {
|
||||||
crash_str.push(b'\n');
|
crash_str.push(b'\n');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
panic!("Children left in the rule tree on drop: {}", String::from_utf8_lossy(&crash_str).trim());
|
panic!("Children left in the rule tree on drop: {}", String::from_utf8_lossy(&crash_str).trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,6 +165,11 @@ impl Device {
|
||||||
RGBA::new(255, 255, 255, 255)
|
RGBA::new(255, 255, 255, 255)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the default color color.
|
||||||
|
pub fn default_color(&self) -> RGBA {
|
||||||
|
RGBA::new(0, 0, 0, 255)
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns safe area insets
|
/// Returns safe area insets
|
||||||
pub fn safe_area_insets(&self) -> SideOffsets2D<f32, CSSPixel> {
|
pub fn safe_area_insets(&self) -> SideOffsets2D<f32, CSSPixel> {
|
||||||
SideOffsets2D::zero()
|
SideOffsets2D::zero()
|
||||||
|
|
|
@ -73,6 +73,10 @@ pub struct CalcVariant {
|
||||||
ptr: *mut CalcLengthPercentage,
|
ptr: *mut CalcLengthPercentage,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// `CalcLengthPercentage` is `Send + Sync` as asserted below.
|
||||||
|
unsafe impl Send for CalcVariant {}
|
||||||
|
unsafe impl Sync for CalcVariant {}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
@ -130,10 +134,14 @@ enum Tag {
|
||||||
// All the members should be 64 bits, even in 32-bit builds.
|
// All the members should be 64 bits, even in 32-bit builds.
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
unsafe fn static_assert() {
|
unsafe fn static_assert() {
|
||||||
|
fn assert_send_and_sync<T: Send + Sync>() {}
|
||||||
std::mem::transmute::<u64, LengthVariant>(0u64);
|
std::mem::transmute::<u64, LengthVariant>(0u64);
|
||||||
std::mem::transmute::<u64, PercentageVariant>(0u64);
|
std::mem::transmute::<u64, PercentageVariant>(0u64);
|
||||||
std::mem::transmute::<u64, CalcVariant>(0u64);
|
std::mem::transmute::<u64, CalcVariant>(0u64);
|
||||||
std::mem::transmute::<u64, LengthPercentage>(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 {
|
impl Drop for LengthPercentage {
|
||||||
|
|
|
@ -881,7 +881,17 @@ impl CalcNode {
|
||||||
return Ok(MathFunction::Calc);
|
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())));
|
return Err(location.new_unexpected_token_error(Token::Function(name.clone())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue