mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Further changes required by Servo
This commit is contained in:
parent
92742f7f90
commit
2389650734
2 changed files with 14 additions and 6 deletions
|
@ -3289,6 +3289,15 @@ impl ComputedValues {
|
|||
/// Get the initial computed values.
|
||||
pub fn initial_values() -> &'static Self { &*INITIAL_SERVO_VALUES }
|
||||
|
||||
/// Converts the computed values to an Arc<> from a reference.
|
||||
pub fn to_arc(&self) -> Arc<Self> {
|
||||
// SAFETY: We're guaranteed to be allocated as an Arc<> since the
|
||||
// functions above are the only ones that create ComputedValues
|
||||
// instances in Servo (and that must be the case since ComputedValues'
|
||||
// member is private).
|
||||
unsafe { Arc::from_raw_addrefed(self) }
|
||||
}
|
||||
|
||||
/// Serializes the computed value of this property as a string.
|
||||
pub fn computed_value_to_string(&self, property: PropertyDeclarationId) -> String {
|
||||
match property {
|
||||
|
@ -4103,7 +4112,7 @@ mod lazy_static_module {
|
|||
|
||||
lazy_static! {
|
||||
/// The initial values for all style structs as defined by the specification.
|
||||
pub static ref INITIAL_SERVO_VALUES: ComputedValues = ComputedValues {
|
||||
pub static ref INITIAL_SERVO_VALUES : Arc<ComputedValues> = Arc::new(ComputedValues {
|
||||
inner: ComputedValuesInner {
|
||||
% for style_struct in data.active_style_structs():
|
||||
${style_struct.ident}: Arc::new(style_structs::${style_struct.name} {
|
||||
|
@ -4131,7 +4140,7 @@ mod lazy_static_module {
|
|||
flags: ComputedValueFlags::empty(),
|
||||
},
|
||||
pseudo: None,
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ use fxhash::FxHashMap;
|
|||
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::parser::SelectorParseErrorKind;
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
use servo_arc::Arc;
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
@ -411,7 +410,7 @@ pub struct SelectorImpl;
|
|||
/// A set of extra data to carry along with the matching context, either for
|
||||
/// selector-matching or invalidation.
|
||||
#[derive(Debug, Default)]
|
||||
pub struct ExtraMatchingData {
|
||||
pub struct ExtraMatchingData<'a> {
|
||||
/// The invalidation data to invalidate doc-state pseudo-classes correctly.
|
||||
pub invalidation_data: InvalidationMatchingData,
|
||||
|
||||
|
@ -421,14 +420,14 @@ pub struct ExtraMatchingData {
|
|||
|
||||
/// The style of the originating element in order to evaluate @container
|
||||
/// size queries affecting pseudo-elements.
|
||||
pub originating_element_style: Option<Arc<ComputedValues>>,
|
||||
pub originating_element_style: Option<&'a ComputedValues>,
|
||||
}
|
||||
|
||||
impl ::selectors::SelectorImpl for SelectorImpl {
|
||||
type PseudoElement = PseudoElement;
|
||||
type NonTSPseudoClass = NonTSPseudoClass;
|
||||
|
||||
type ExtraMatchingData = ExtraMatchingData;
|
||||
type ExtraMatchingData<'a> = ExtraMatchingData<'a>;
|
||||
type AttrValue = AtomString;
|
||||
type Identifier = AtomIdent;
|
||||
type LocalName = LocalName;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue