Rename ComputedValuesStruct to ComputedValues.

Doing this in a separate commit avoids mixups
with the ComputedValues trait that the previous commit removed.
This commit is contained in:
Simon Sapin 2016-07-19 23:04:44 +02:00
parent 789807b7b0
commit 4b7060554b
15 changed files with 101 additions and 101 deletions

View file

@ -15,7 +15,7 @@ use properties::longhands::animation_iteration_count::computed_value::AnimationI
use properties::longhands::animation_play_state::computed_value::AnimationPlayState; use properties::longhands::animation_play_state::computed_value::AnimationPlayState;
use properties::longhands::transition_timing_function::computed_value::StartEnd; use properties::longhands::transition_timing_function::computed_value::StartEnd;
use properties::longhands::transition_timing_function::computed_value::TransitionTimingFunction; use properties::longhands::transition_timing_function::computed_value::TransitionTimingFunction;
use properties::{self, ComputedValuesStruct}; use properties::{self, ComputedValues};
use selector_impl::SelectorImplExt; use selector_impl::SelectorImplExt;
use selectors::matching::DeclarationBlock; use selectors::matching::DeclarationBlock;
use std::sync::Arc; use std::sync::Arc;
@ -71,7 +71,7 @@ pub struct KeyframesAnimationState {
pub expired: bool, pub expired: bool,
/// The original cascade style, needed to compute the generated keyframes of /// The original cascade style, needed to compute the generated keyframes of
/// the animation. /// the animation.
pub cascade_style: Arc<ComputedValuesStruct>, pub cascade_style: Arc<ComputedValues>,
} }
impl KeyframesAnimationState { impl KeyframesAnimationState {
@ -249,8 +249,8 @@ impl PropertyAnimation {
/// Any number of animations may be returned, from zero (if the property did not animate) to /// Any number of animations may be returned, from zero (if the property did not animate) to
/// one (for a single transition property) to arbitrarily many (for `all`). /// one (for a single transition property) to arbitrarily many (for `all`).
pub fn from_transition(transition_index: usize, pub fn from_transition(transition_index: usize,
old_style: &ComputedValuesStruct, old_style: &ComputedValues,
new_style: &mut ComputedValuesStruct) new_style: &mut ComputedValues)
-> Vec<PropertyAnimation> { -> Vec<PropertyAnimation> {
let mut result = vec![]; let mut result = vec![];
let box_style = new_style.get_box(); let box_style = new_style.get_box();
@ -288,8 +288,8 @@ impl PropertyAnimation {
fn from_transition_property(transition_property: TransitionProperty, fn from_transition_property(transition_property: TransitionProperty,
timing_function: TransitionTimingFunction, timing_function: TransitionTimingFunction,
duration: Time, duration: Time,
old_style: &ComputedValuesStruct, old_style: &ComputedValues,
new_style: &ComputedValuesStruct) new_style: &ComputedValues)
-> Option<PropertyAnimation> { -> Option<PropertyAnimation> {
let animated_property = AnimatedProperty::from_transition_property(&transition_property, let animated_property = AnimatedProperty::from_transition_property(&transition_property,
old_style, old_style,
@ -308,7 +308,7 @@ impl PropertyAnimation {
} }
} }
pub fn update(&self, style: &mut ComputedValuesStruct, time: f64) { pub fn update(&self, style: &mut ComputedValues, time: f64) {
let progress = match self.timing_function { let progress = match self.timing_function {
TransitionTimingFunction::CubicBezier(p1, p2) => { TransitionTimingFunction::CubicBezier(p1, p2) => {
// See `WebCore::AnimationBase::solveEpsilon(double)` in WebKit. // See `WebCore::AnimationBase::solveEpsilon(double)` in WebKit.
@ -341,8 +341,8 @@ impl PropertyAnimation {
// cloneable part and a non-cloneable part.. // cloneable part and a non-cloneable part..
pub fn start_transitions_if_applicable<Impl: SelectorImplExt>(new_animations_sender: &Sender<Animation>, pub fn start_transitions_if_applicable<Impl: SelectorImplExt>(new_animations_sender: &Sender<Animation>,
node: OpaqueNode, node: OpaqueNode,
old_style: &ComputedValuesStruct, old_style: &ComputedValues,
new_style: &mut Arc<ComputedValuesStruct>) new_style: &mut Arc<ComputedValues>)
-> bool { -> bool {
let mut had_animations = false; let mut had_animations = false;
for i in 0..new_style.get_box().transition_property_count() { for i in 0..new_style.get_box().transition_property_count() {
@ -374,9 +374,9 @@ pub fn start_transitions_if_applicable<Impl: SelectorImplExt>(new_animations_sen
fn compute_style_for_animation_step<Impl: SelectorImplExt>(context: &SharedStyleContext<Impl>, fn compute_style_for_animation_step<Impl: SelectorImplExt>(context: &SharedStyleContext<Impl>,
step: &KeyframesStep, step: &KeyframesStep,
previous_style: &ComputedValuesStruct, previous_style: &ComputedValues,
style_from_cascade: &ComputedValuesStruct) style_from_cascade: &ComputedValues)
-> ComputedValuesStruct { -> ComputedValues {
match step.value { match step.value {
// TODO: avoiding this spurious clone might involve having to create // TODO: avoiding this spurious clone might involve having to create
// an Arc in the below (more common case). // an Arc in the below (more common case).
@ -401,7 +401,7 @@ fn compute_style_for_animation_step<Impl: SelectorImplExt>(context: &SharedStyle
pub fn maybe_start_animations<Impl: SelectorImplExt>(context: &SharedStyleContext<Impl>, pub fn maybe_start_animations<Impl: SelectorImplExt>(context: &SharedStyleContext<Impl>,
new_animations_sender: &Sender<Animation>, new_animations_sender: &Sender<Animation>,
node: OpaqueNode, node: OpaqueNode,
new_style: &Arc<ComputedValuesStruct>) -> bool new_style: &Arc<ComputedValues>) -> bool
{ {
let mut had_animations = false; let mut had_animations = false;
@ -469,7 +469,7 @@ pub fn maybe_start_animations<Impl: SelectorImplExt>(context: &SharedStyleContex
/// Updates a given computed style for a given animation frame. Returns a bool /// Updates a given computed style for a given animation frame. Returns a bool
/// representing if the style was indeed updated. /// representing if the style was indeed updated.
pub fn update_style_for_animation_frame(mut new_style: &mut Arc<ComputedValuesStruct>, pub fn update_style_for_animation_frame(mut new_style: &mut Arc<ComputedValues>,
now: f64, now: f64,
start_time: f64, start_time: f64,
frame: &AnimationFrame) -> bool { frame: &AnimationFrame) -> bool {
@ -490,7 +490,7 @@ pub fn update_style_for_animation_frame(mut new_style: &mut Arc<ComputedValuesSt
/// If `damage` is provided, inserts the appropriate restyle damage. /// If `damage` is provided, inserts the appropriate restyle damage.
pub fn update_style_for_animation<Damage, Impl>(context: &SharedStyleContext<Impl>, pub fn update_style_for_animation<Damage, Impl>(context: &SharedStyleContext<Impl>,
animation: &Animation, animation: &Animation,
style: &mut Arc<ComputedValuesStruct>, style: &mut Arc<ComputedValues>,
damage: Option<&mut Damage>) damage: Option<&mut Damage>)
where Impl: SelectorImplExt, where Impl: SelectorImplExt,
Damage: TRestyleDamage { Damage: TRestyleDamage {

View file

@ -4,7 +4,7 @@
//! Per-node data used in style calculation. //! Per-node data used in style calculation.
use properties::ComputedValuesStruct; use properties::ComputedValues;
use selectors::parser::SelectorImpl; use selectors::parser::SelectorImpl;
use std::collections::HashMap; use std::collections::HashMap;
use std::hash::BuildHasherDefault; use std::hash::BuildHasherDefault;
@ -13,10 +13,10 @@ use std::sync::atomic::AtomicIsize;
pub struct PrivateStyleData<Impl: SelectorImpl> { pub struct PrivateStyleData<Impl: SelectorImpl> {
/// The results of CSS styling for this node. /// The results of CSS styling for this node.
pub style: Option<Arc<ComputedValuesStruct>>, pub style: Option<Arc<ComputedValues>>,
/// The results of CSS styling for each pseudo-element (if any). /// The results of CSS styling for each pseudo-element (if any).
pub per_pseudo: HashMap<Impl::PseudoElement, Arc<ComputedValuesStruct>, pub per_pseudo: HashMap<Impl::PseudoElement, Arc<ComputedValues>,
BuildHasherDefault<::fnv::FnvHasher>>, BuildHasherDefault<::fnv::FnvHasher>>,
/// Information needed during parallel traversals. /// Information needed during parallel traversals.

View file

@ -9,7 +9,7 @@
use context::SharedStyleContext; use context::SharedStyleContext;
use data::PrivateStyleData; use data::PrivateStyleData;
use element_state::ElementState; use element_state::ElementState;
use properties::{ComputedValuesStruct, PropertyDeclaration, PropertyDeclarationBlock}; use properties::{ComputedValues, PropertyDeclaration, PropertyDeclarationBlock};
use refcell::{Ref, RefMut}; use refcell::{Ref, RefMut};
use restyle_hints::{ElementSnapshot, RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint}; use restyle_hints::{ElementSnapshot, RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint};
use selector_impl::{ElementExt, SelectorImplExt}; use selector_impl::{ElementExt, SelectorImplExt};
@ -46,7 +46,7 @@ impl OpaqueNode {
} }
pub trait TRestyleDamage : BitOr<Output=Self> + Copy { pub trait TRestyleDamage : BitOr<Output=Self> + Copy {
fn compute(old: Option<&Arc<ComputedValuesStruct>>, new: &ComputedValuesStruct) -> Self; fn compute(old: Option<&Arc<ComputedValues>>, new: &ComputedValues) -> Self;
fn rebuild_and_reflow() -> Self; fn rebuild_and_reflow() -> Self;
} }
@ -178,7 +178,7 @@ pub trait TNode : Sized + Copy + Clone {
/// has not yet been performed, fails. /// has not yet been performed, fails.
fn style(&self, fn style(&self,
_context: &SharedStyleContext<<Self::ConcreteElement as Element>::Impl>) _context: &SharedStyleContext<<Self::ConcreteElement as Element>::Impl>)
-> Ref<Arc<ComputedValuesStruct>> -> Ref<Arc<ComputedValues>>
where <Self::ConcreteElement as Element>::Impl: SelectorImplExt { where <Self::ConcreteElement as Element>::Impl: SelectorImplExt {
Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap()) Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap())
} }

View file

@ -12,7 +12,7 @@ use cache::{LRUCache, SimpleHashCache};
use context::{StyleContext, SharedStyleContext}; use context::{StyleContext, SharedStyleContext};
use data::PrivateStyleData; use data::PrivateStyleData;
use dom::{TElement, TNode, TRestyleDamage}; use dom::{TElement, TNode, TRestyleDamage};
use properties::{ComputedValuesStruct, PropertyDeclaration, cascade}; use properties::{ComputedValues, PropertyDeclaration, cascade};
use selector_impl::{ElementExt, SelectorImplExt}; use selector_impl::{ElementExt, SelectorImplExt};
use selector_matching::{DeclarationBlock, Stylist}; use selector_matching::{DeclarationBlock, Stylist};
use selectors::Element; use selectors::Element;
@ -150,7 +150,7 @@ impl<'a> Hash for ApplicableDeclarationsCacheQuery<'a> {
static APPLICABLE_DECLARATIONS_CACHE_SIZE: usize = 32; static APPLICABLE_DECLARATIONS_CACHE_SIZE: usize = 32;
pub struct ApplicableDeclarationsCache { pub struct ApplicableDeclarationsCache {
cache: SimpleHashCache<ApplicableDeclarationsCacheEntry, Arc<ComputedValuesStruct>>, cache: SimpleHashCache<ApplicableDeclarationsCacheEntry, Arc<ComputedValues>>,
} }
impl ApplicableDeclarationsCache { impl ApplicableDeclarationsCache {
@ -160,14 +160,14 @@ impl ApplicableDeclarationsCache {
} }
} }
pub fn find(&self, declarations: &[DeclarationBlock]) -> Option<Arc<ComputedValuesStruct>> { pub fn find(&self, declarations: &[DeclarationBlock]) -> Option<Arc<ComputedValues>> {
match self.cache.find(&ApplicableDeclarationsCacheQuery::new(declarations)) { match self.cache.find(&ApplicableDeclarationsCacheQuery::new(declarations)) {
None => None, None => None,
Some(ref values) => Some((*values).clone()), Some(ref values) => Some((*values).clone()),
} }
} }
pub fn insert(&mut self, declarations: Vec<DeclarationBlock>, style: Arc<ComputedValuesStruct>) { pub fn insert(&mut self, declarations: Vec<DeclarationBlock>, style: Arc<ComputedValues>) {
self.cache.insert(ApplicableDeclarationsCacheEntry::new(declarations), style) self.cache.insert(ApplicableDeclarationsCacheEntry::new(declarations), style)
} }
@ -183,8 +183,8 @@ pub struct StyleSharingCandidateCache {
#[derive(Clone)] #[derive(Clone)]
pub struct StyleSharingCandidate { pub struct StyleSharingCandidate {
pub style: Arc<ComputedValuesStruct>, pub style: Arc<ComputedValues>,
pub parent_style: Arc<ComputedValuesStruct>, pub parent_style: Arc<ComputedValues>,
pub local_name: Atom, pub local_name: Atom,
pub classes: Vec<Atom>, pub classes: Vec<Atom>,
pub namespace: Namespace, pub namespace: Namespace,
@ -369,14 +369,14 @@ trait PrivateMatchMethods: TNode
/// pseudo-elements. /// pseudo-elements.
fn cascade_node_pseudo_element<'a, Ctx>(&self, fn cascade_node_pseudo_element<'a, Ctx>(&self,
context: &Ctx, context: &Ctx,
parent_style: Option<&Arc<ComputedValuesStruct>>, parent_style: Option<&Arc<ComputedValues>>,
applicable_declarations: &[DeclarationBlock], applicable_declarations: &[DeclarationBlock],
mut style: Option<&mut Arc<ComputedValuesStruct>>, mut style: Option<&mut Arc<ComputedValues>>,
applicable_declarations_cache: applicable_declarations_cache:
&mut ApplicableDeclarationsCache, &mut ApplicableDeclarationsCache,
shareable: bool, shareable: bool,
animate_properties: bool) animate_properties: bool)
-> (Self::ConcreteRestyleDamage, Arc<ComputedValuesStruct>) -> (Self::ConcreteRestyleDamage, Arc<ComputedValues>)
where Ctx: StyleContext<'a, <Self::ConcreteElement as Element>::Impl> { where Ctx: StyleContext<'a, <Self::ConcreteElement as Element>::Impl> {
let mut cacheable = true; let mut cacheable = true;
let shared_context = context.shared_context(); let shared_context = context.shared_context();
@ -456,7 +456,7 @@ trait PrivateMatchMethods: TNode
fn update_animations_for_cascade(&self, fn update_animations_for_cascade(&self,
context: &SharedStyleContext<<Self::ConcreteElement as Element>::Impl>, context: &SharedStyleContext<<Self::ConcreteElement as Element>::Impl>,
style: &mut Option<&mut Arc<ComputedValuesStruct>>) style: &mut Option<&mut Arc<ComputedValues>>)
-> bool { -> bool {
let style = match *style { let style = match *style {
None => return false, None => return false,
@ -524,7 +524,7 @@ trait PrivateElementMatchMethods: TElement {
fn share_style_with_candidate_if_possible(&self, fn share_style_with_candidate_if_possible(&self,
parent_node: Option<Self::ConcreteNode>, parent_node: Option<Self::ConcreteNode>,
candidate: &StyleSharingCandidate) candidate: &StyleSharingCandidate)
-> Option<Arc<ComputedValuesStruct>> { -> Option<Arc<ComputedValues>> {
let parent_node = match parent_node { let parent_node = match parent_node {
Some(ref parent_node) if parent_node.as_element().is_some() => parent_node, Some(ref parent_node) if parent_node.as_element().is_some() => parent_node,
Some(_) | None => return None, Some(_) | None => return None,
@ -694,7 +694,7 @@ pub trait MatchMethods : TNode {
if self.is_text_node() { if self.is_text_node() {
let mut data_ref = self.mutate_data().unwrap(); let mut data_ref = self.mutate_data().unwrap();
let mut data = &mut *data_ref; let mut data = &mut *data_ref;
let cloned_parent_style = ComputedValuesStruct::style_for_child_text_node(parent_style.unwrap()); let cloned_parent_style = ComputedValues::style_for_child_text_node(parent_style.unwrap());
damage = Self::ConcreteRestyleDamage::compute(data.style.as_ref(), damage = Self::ConcreteRestyleDamage::compute(data.style.as_ref(),
&*cloned_parent_style); &*cloned_parent_style);
data.style = Some(cloned_parent_style); data.style = Some(cloned_parent_style);

View file

@ -45,7 +45,7 @@ pub mod style_structs {
} }
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct ComputedValuesStruct { pub struct ComputedValues {
% for style_struct in data.style_structs: % for style_struct in data.style_structs:
${style_struct.ident}: Arc<style_structs::${style_struct.name}>, ${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
% endfor % endfor
@ -56,9 +56,9 @@ pub struct ComputedValuesStruct {
pub root_font_size: Au, pub root_font_size: Au,
} }
impl ComputedValuesStruct { impl ComputedValues {
pub fn inherit_from(parent: &Arc<Self>) -> Arc<Self> { pub fn inherit_from(parent: &Arc<Self>) -> Arc<Self> {
Arc::new(ComputedValuesStruct { Arc::new(ComputedValues {
custom_properties: parent.custom_properties.clone(), custom_properties: parent.custom_properties.clone(),
shareable: parent.shareable, shareable: parent.shareable,
writing_mode: parent.writing_mode, writing_mode: parent.writing_mode,
@ -81,7 +81,7 @@ impl ComputedValuesStruct {
${style_struct.ident}: Arc<style_structs::${style_struct.name}>, ${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
% endfor % endfor
) -> Self { ) -> Self {
ComputedValuesStruct { ComputedValues {
custom_properties: custom_properties, custom_properties: custom_properties,
shareable: shareable, shareable: shareable,
writing_mode: writing_mode, writing_mode: writing_mode,
@ -96,7 +96,7 @@ impl ComputedValuesStruct {
// Gecko expects text nodes to be styled as if they were elements that // Gecko expects text nodes to be styled as if they were elements that
// matched no rules (that is, inherited style structs are inherited and // matched no rules (that is, inherited style structs are inherited and
// non-inherited style structs are set to their initial values). // non-inherited style structs are set to their initial values).
ComputedValuesStruct::inherit_from(parent) ComputedValues::inherit_from(parent)
} }
pub fn initial_values() -> &'static Self { &*INITIAL_GECKO_VALUES } pub fn initial_values() -> &'static Self { &*INITIAL_GECKO_VALUES }
@ -1296,7 +1296,7 @@ fn static_assert() {
#[allow(non_snake_case, unused_variables)] #[allow(non_snake_case, unused_variables)]
pub extern "C" fn Servo_GetStyle${style_struct.gecko_name}(computed_values: *mut bindings::ServoComputedValues) pub extern "C" fn Servo_GetStyle${style_struct.gecko_name}(computed_values: *mut bindings::ServoComputedValues)
-> *const ${style_struct.gecko_ffi_name} { -> *const ${style_struct.gecko_ffi_name} {
type Helpers = ArcHelpers<bindings::ServoComputedValues, ComputedValuesStruct>; type Helpers = ArcHelpers<bindings::ServoComputedValues, ComputedValues>;
Helpers::with(computed_values, |values| values.get_${style_struct.name_lower}().get_gecko() Helpers::with(computed_values, |values| values.get_${style_struct.name_lower}().get_gecko()
as *const ${style_struct.gecko_ffi_name}) as *const ${style_struct.gecko_ffi_name})
} }
@ -1312,7 +1312,7 @@ ${define_ffi_struct_accessor(style_struct)}
% endfor % endfor
lazy_static! { lazy_static! {
pub static ref INITIAL_GECKO_VALUES: ComputedValuesStruct = ComputedValuesStruct { pub static ref INITIAL_GECKO_VALUES: ComputedValues = ComputedValues {
% for style_struct in data.style_structs: % for style_struct in data.style_structs:
${style_struct.ident}: style_structs::${style_struct.name}::initial(), ${style_struct.ident}: style_structs::${style_struct.name}::initial(),
% endfor % endfor

View file

@ -170,7 +170,7 @@
use error_reporting::ParseErrorReporter; use error_reporting::ParseErrorReporter;
use properties::longhands; use properties::longhands;
use properties::property_bit_field::PropertyBitField; use properties::property_bit_field::PropertyBitField;
use properties::{ComputedValuesStruct, PropertyDeclaration}; use properties::{ComputedValues, PropertyDeclaration};
use properties::style_structs; use properties::style_structs;
use std::boxed::Box as StdBox; use std::boxed::Box as StdBox;
use std::collections::HashMap; use std::collections::HashMap;
@ -181,7 +181,7 @@
${caller.body()} ${caller.body()}
#[allow(unused_variables)] #[allow(unused_variables)]
pub fn cascade_property(declaration: &PropertyDeclaration, pub fn cascade_property(declaration: &PropertyDeclaration,
inherited_style: &ComputedValuesStruct, inherited_style: &ComputedValues,
context: &mut computed::Context, context: &mut computed::Context,
seen: &mut PropertyBitField, seen: &mut PropertyBitField,
cacheable: &mut bool, cacheable: &mut bool,
@ -210,7 +210,7 @@
DeclaredValue::Initial => { DeclaredValue::Initial => {
// We assume that it's faster to use copy_*_from rather than // We assume that it's faster to use copy_*_from rather than
// set_*(get_initial_value()); // set_*(get_initial_value());
let initial_struct = ComputedValuesStruct::initial_values() let initial_struct = ComputedValues::initial_values()
.get_${data.current_style_struct.name_lower}(); .get_${data.current_style_struct.name_lower}();
context.mutate_style().mutate_${data.current_style_struct.name_lower}() context.mutate_style().mutate_${data.current_style_struct.name_lower}()
.copy_${property.ident}_from(initial_struct); .copy_${property.ident}_from(initial_struct);

View file

@ -26,7 +26,7 @@ use properties::longhands::visibility::computed_value::T as Visibility;
use properties::longhands::z_index::computed_value::T as ZIndex; use properties::longhands::z_index::computed_value::T as ZIndex;
use std::cmp; use std::cmp;
use std::fmt; use std::fmt;
use super::ComputedValuesStruct; use super::ComputedValues;
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
use values::computed::{BorderRadiusSize, LengthOrNone}; use values::computed::{BorderRadiusSize, LengthOrNone};
use values::computed::{CalcLengthOrPercentage, LengthOrPercentage}; use values::computed::{CalcLengthOrPercentage, LengthOrPercentage};
@ -114,7 +114,7 @@ impl AnimatedProperty {
} }
} }
pub fn update(&self, style: &mut ComputedValuesStruct, progress: f64) { pub fn update(&self, style: &mut ComputedValues, progress: f64) {
match *self { match *self {
% for prop in data.longhands: % for prop in data.longhands:
% if prop.animatable: % if prop.animatable:
@ -129,8 +129,8 @@ impl AnimatedProperty {
} }
pub fn from_transition_property(transition_property: &TransitionProperty, pub fn from_transition_property(transition_property: &TransitionProperty,
old_style: &ComputedValuesStruct, old_style: &ComputedValues,
new_style: &ComputedValuesStruct) new_style: &ComputedValues)
-> AnimatedProperty { -> AnimatedProperty {
match *transition_property { match *transition_property {
TransitionProperty::All => panic!("Can't use TransitionProperty::All here."), TransitionProperty::All => panic!("Can't use TransitionProperty::All here."),

View file

@ -77,7 +77,7 @@
% if product == "servo": % if product == "servo":
fn cascade_property_custom(_declaration: &PropertyDeclaration, fn cascade_property_custom(_declaration: &PropertyDeclaration,
_inherited_style: &ComputedValuesStruct, _inherited_style: &ComputedValues,
context: &mut computed::Context, context: &mut computed::Context,
_seen: &mut PropertyBitField, _seen: &mut PropertyBitField,
_cacheable: &mut bool, _cacheable: &mut bool,

View file

@ -109,7 +109,7 @@ ${helpers.single_keyword("unicode-bidi",
% if product == "servo": % if product == "servo":
fn cascade_property_custom(_declaration: &PropertyDeclaration, fn cascade_property_custom(_declaration: &PropertyDeclaration,
_inherited_style: &ComputedValuesStruct, _inherited_style: &ComputedValues,
context: &mut computed::Context, context: &mut computed::Context,
_seen: &mut PropertyBitField, _seen: &mut PropertyBitField,
_cacheable: &mut bool, _cacheable: &mut bool,

View file

@ -1242,14 +1242,14 @@ pub mod style_structs {
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
pub use gecko_properties::ComputedValuesStruct; pub use gecko_properties::ComputedValues;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
pub type ServoComputedValues = ComputedValuesStruct; pub type ServoComputedValues = ComputedValues;
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
#[cfg_attr(feature = "servo", derive(Clone, Debug, HeapSizeOf))] #[cfg_attr(feature = "servo", derive(Clone, Debug, HeapSizeOf))]
pub struct ComputedValuesStruct { pub struct ComputedValues {
% for style_struct in data.active_style_structs(): % for style_struct in data.active_style_structs():
${style_struct.ident}: Arc<style_structs::${style_struct.name}>, ${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
% endfor % endfor
@ -1260,7 +1260,7 @@ pub struct ComputedValuesStruct {
} }
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
impl ComputedValuesStruct { impl ComputedValues {
pub fn new(custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>, pub fn new(custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
shareable: bool, shareable: bool,
writing_mode: WritingMode, writing_mode: WritingMode,
@ -1269,7 +1269,7 @@ impl ComputedValuesStruct {
${style_struct.ident}: Arc<style_structs::${style_struct.name}>, ${style_struct.ident}: Arc<style_structs::${style_struct.name}>,
% endfor % endfor
) -> Self { ) -> Self {
ComputedValuesStruct { ComputedValues {
custom_properties: custom_properties, custom_properties: custom_properties,
shareable: shareable, shareable: shareable,
writing_mode: writing_mode, writing_mode: writing_mode,
@ -1562,11 +1562,11 @@ pub use self::lazy_static_module::INITIAL_SERVO_VALUES;
mod lazy_static_module { mod lazy_static_module {
use logical_geometry::WritingMode; use logical_geometry::WritingMode;
use std::sync::Arc; use std::sync::Arc;
use super::{ComputedValuesStruct, longhands, style_structs}; use super::{ComputedValues, longhands, style_structs};
/// The initial values for all style structs as defined by the specification. /// The initial values for all style structs as defined by the specification.
lazy_static! { lazy_static! {
pub static ref INITIAL_SERVO_VALUES: ComputedValuesStruct = ComputedValuesStruct { pub static ref INITIAL_SERVO_VALUES: ComputedValues = ComputedValues {
% for style_struct in data.active_style_structs(): % for style_struct in data.active_style_structs():
${style_struct.ident}: Arc::new(style_structs::${style_struct.name} { ${style_struct.ident}: Arc::new(style_structs::${style_struct.name} {
% for longhand in style_struct.longhands: % for longhand in style_struct.longhands:
@ -1591,16 +1591,16 @@ fn cascade_with_cached_declarations(
viewport_size: Size2D<Au>, viewport_size: Size2D<Au>,
applicable_declarations: &[DeclarationBlock<Vec<PropertyDeclaration>>], applicable_declarations: &[DeclarationBlock<Vec<PropertyDeclaration>>],
shareable: bool, shareable: bool,
parent_style: &ComputedValuesStruct, parent_style: &ComputedValues,
cached_style: &ComputedValuesStruct, cached_style: &ComputedValues,
custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>, custom_properties: Option<Arc<::custom_properties::ComputedValuesMap>>,
mut error_reporter: StdBox<ParseErrorReporter + Send>) mut error_reporter: StdBox<ParseErrorReporter + Send>)
-> ComputedValuesStruct { -> ComputedValues {
let mut context = computed::Context { let mut context = computed::Context {
is_root_element: false, is_root_element: false,
viewport_size: viewport_size, viewport_size: viewport_size,
inherited_style: parent_style, inherited_style: parent_style,
style: ComputedValuesStruct::new( style: ComputedValues::new(
custom_properties, custom_properties,
shareable, shareable,
WritingMode::empty(), WritingMode::empty(),
@ -1693,7 +1693,7 @@ fn cascade_with_cached_declarations(
pub type CascadePropertyFn = pub type CascadePropertyFn =
extern "Rust" fn(declaration: &PropertyDeclaration, extern "Rust" fn(declaration: &PropertyDeclaration,
inherited_style: &ComputedValuesStruct, inherited_style: &ComputedValues,
context: &mut computed::Context, context: &mut computed::Context,
seen: &mut PropertyBitField, seen: &mut PropertyBitField,
cacheable: &mut bool, cacheable: &mut bool,
@ -1727,11 +1727,11 @@ static CASCADE_PROPERTY: [CascadePropertyFn; ${len(data.longhands)}] = [
pub fn cascade(viewport_size: Size2D<Au>, pub fn cascade(viewport_size: Size2D<Au>,
applicable_declarations: &[DeclarationBlock<Vec<PropertyDeclaration>>], applicable_declarations: &[DeclarationBlock<Vec<PropertyDeclaration>>],
shareable: bool, shareable: bool,
parent_style: Option<<&ComputedValuesStruct>, parent_style: Option<<&ComputedValues>,
cached_style: Option<<&ComputedValuesStruct>, cached_style: Option<<&ComputedValues>,
mut error_reporter: StdBox<ParseErrorReporter + Send>) mut error_reporter: StdBox<ParseErrorReporter + Send>)
-> (ComputedValuesStruct, bool) { -> (ComputedValues, bool) {
let initial_values = ComputedValuesStruct::initial_values(); let initial_values = ComputedValues::initial_values();
let (is_root_element, inherited_style) = match parent_style { let (is_root_element, inherited_style) = match parent_style {
Some(parent_style) => (false, parent_style), Some(parent_style) => (false, parent_style),
None => (true, initial_values), None => (true, initial_values),
@ -1771,7 +1771,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
is_root_element: is_root_element, is_root_element: is_root_element,
viewport_size: viewport_size, viewport_size: viewport_size,
inherited_style: inherited_style, inherited_style: inherited_style,
style: ComputedValuesStruct::new( style: ComputedValues::new(
custom_properties, custom_properties,
shareable, shareable,
WritingMode::empty(), WritingMode::empty(),
@ -1796,7 +1796,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
// We could (and used to) use a pattern match here, but that bloats this function to over 100K // We could (and used to) use a pattern match here, but that bloats this function to over 100K
// of compiled code! To improve i-cache behavior, we outline the individual functions and use // of compiled code! To improve i-cache behavior, we outline the individual functions and use
// virtual dispatch instead. // virtual dispatch instead.
ComputedValuesStruct::do_cascade_property(|cascade_property| { ComputedValues::do_cascade_property(|cascade_property| {
% for category_to_cascade_now in ["early", "other"]: % for category_to_cascade_now in ["early", "other"]:
for sub_list in applicable_declarations.iter().rev() { for sub_list in applicable_declarations.iter().rev() {
// Declarations are already stored in reverse order. // Declarations are already stored in reverse order.
@ -1941,7 +1941,7 @@ pub fn cascade(viewport_size: Size2D<Au>,
} }
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
pub fn modify_style_for_anonymous_flow(style: &mut Arc<ComputedValuesStruct>, pub fn modify_style_for_anonymous_flow(style: &mut Arc<ComputedValues>,
new_display_value: longhands::display::computed_value::T) { new_display_value: longhands::display::computed_value::T) {
// The 'align-self' property needs some special treatment since // The 'align-self' property needs some special treatment since
// its value depends on the 'align-items' value of its parent. // its value depends on the 'align-items' value of its parent.
@ -1990,7 +1990,7 @@ pub fn modify_style_for_anonymous_flow(style: &mut Arc<ComputedValuesStruct>,
/// FIXME(#5625, pcwalton): It would probably be cleaner and faster to do this in the cascade. /// FIXME(#5625, pcwalton): It would probably be cleaner and faster to do this in the cascade.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
#[inline] #[inline]
pub fn modify_style_for_replaced_content(style: &mut Arc<ComputedValuesStruct>) { pub fn modify_style_for_replaced_content(style: &mut Arc<ComputedValues>) {
// Reset `position` to handle cases like `<div style="position: absolute">foo bar baz</div>`. // Reset `position` to handle cases like `<div style="position: absolute">foo bar baz</div>`.
if style.box_.display != longhands::display::computed_value::T::inline { if style.box_.display != longhands::display::computed_value::T::inline {
let mut style = Arc::make_mut(style); let mut style = Arc::make_mut(style);
@ -2027,10 +2027,10 @@ pub fn modify_style_for_replaced_content(style: &mut Arc<ComputedValuesStruct>)
/// not outermost. /// not outermost.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
#[inline] #[inline]
pub fn modify_border_style_for_inline_sides(style: &mut Arc<ComputedValuesStruct>, pub fn modify_border_style_for_inline_sides(style: &mut Arc<ComputedValues>,
is_first_fragment_of_element: bool, is_first_fragment_of_element: bool,
is_last_fragment_of_element: bool) { is_last_fragment_of_element: bool) {
fn modify_side(style: &mut Arc<ComputedValuesStruct>, side: PhysicalSide) { fn modify_side(style: &mut Arc<ComputedValues>, side: PhysicalSide) {
{ {
let border = &style.border; let border = &style.border;
let current_style = match side { let current_style = match side {
@ -2080,7 +2080,7 @@ pub fn modify_border_style_for_inline_sides(style: &mut Arc<ComputedValuesStruct
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
#[inline] #[inline]
pub fn modify_style_for_anonymous_table_object( pub fn modify_style_for_anonymous_table_object(
style: &mut Arc<ComputedValuesStruct>, style: &mut Arc<ComputedValues>,
new_display_value: longhands::display::computed_value::T) { new_display_value: longhands::display::computed_value::T) {
let mut style = Arc::make_mut(style); let mut style = Arc::make_mut(style);
let box_style = Arc::make_mut(&mut style.box_); let box_style = Arc::make_mut(&mut style.box_);
@ -2091,7 +2091,7 @@ pub fn modify_style_for_anonymous_table_object(
/// Adjusts the `position` property as necessary for the outer fragment wrapper of an inline-block. /// Adjusts the `position` property as necessary for the outer fragment wrapper of an inline-block.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
#[inline] #[inline]
pub fn modify_style_for_outer_inline_block_fragment(style: &mut Arc<ComputedValuesStruct>) { pub fn modify_style_for_outer_inline_block_fragment(style: &mut Arc<ComputedValues>) {
let mut style = Arc::make_mut(style); let mut style = Arc::make_mut(style);
let box_style = Arc::make_mut(&mut style.box_); let box_style = Arc::make_mut(&mut style.box_);
box_style.position = longhands::position::computed_value::T::static_ box_style.position = longhands::position::computed_value::T::static_
@ -2103,7 +2103,7 @@ pub fn modify_style_for_outer_inline_block_fragment(style: &mut Arc<ComputedValu
/// itself relatively positioned. /// itself relatively positioned.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
#[inline] #[inline]
pub fn modify_style_for_text(style: &mut Arc<ComputedValuesStruct>) { pub fn modify_style_for_text(style: &mut Arc<ComputedValues>) {
if style.box_.position == longhands::position::computed_value::T::relative { if style.box_.position == longhands::position::computed_value::T::relative {
// We leave the `position` property set to `relative` so that we'll still establish a // We leave the `position` property set to `relative` so that we'll still establish a
// containing block if needed. But we reset all position offsets to `auto`. // containing block if needed. But we reset all position offsets to `auto`.
@ -2139,7 +2139,7 @@ pub fn modify_style_for_text(style: &mut Arc<ComputedValuesStruct>) {
/// Margins apply to the `input` element itself, so including them in the text will cause them to /// Margins apply to the `input` element itself, so including them in the text will cause them to
/// be double-counted. /// be double-counted.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
pub fn modify_style_for_input_text(style: &mut Arc<ComputedValuesStruct>) { pub fn modify_style_for_input_text(style: &mut Arc<ComputedValues>) {
let mut style = Arc::make_mut(style); let mut style = Arc::make_mut(style);
let margin_style = Arc::make_mut(&mut style.margin); let margin_style = Arc::make_mut(&mut style.margin);
margin_style.margin_top = computed::LengthOrPercentageOrAuto::Length(Au(0)); margin_style.margin_top = computed::LengthOrPercentageOrAuto::Length(Au(0));
@ -2155,7 +2155,7 @@ pub fn modify_style_for_input_text(style: &mut Arc<ComputedValuesStruct>) {
/// Adjusts the `clip` property so that an inline absolute hypothetical fragment doesn't clip its /// Adjusts the `clip` property so that an inline absolute hypothetical fragment doesn't clip its
/// children. /// children.
#[cfg(feature = "servo")] #[cfg(feature = "servo")]
pub fn modify_style_for_inline_absolute_hypothetical_fragment(style: &mut Arc<ComputedValuesStruct>) { pub fn modify_style_for_inline_absolute_hypothetical_fragment(style: &mut Arc<ComputedValues>) {
if style.get_effects().clip.0.is_some() { if style.get_effects().clip.0.is_some() {
let mut style = Arc::make_mut(style); let mut style = Arc::make_mut(style);
let effects_style = Arc::make_mut(&mut style.effects); let effects_style = Arc::make_mut(&mut style.effects);

View file

@ -9,7 +9,7 @@ use element_state::*;
use error_reporting::StdoutErrorReporter; use error_reporting::StdoutErrorReporter;
use keyframes::KeyframesAnimation; use keyframes::KeyframesAnimation;
use media_queries::{Device, MediaType}; use media_queries::{Device, MediaType};
use properties::{self, PropertyDeclaration, PropertyDeclarationBlock, ComputedValuesStruct}; use properties::{self, PropertyDeclaration, PropertyDeclarationBlock, ComputedValues};
use restyle_hints::{ElementSnapshot, RestyleHint, DependencySet}; use restyle_hints::{ElementSnapshot, RestyleHint, DependencySet};
use selector_impl::SelectorImplExt; use selector_impl::SelectorImplExt;
use selectors::bloom::BloomFilter; use selectors::bloom::BloomFilter;
@ -231,8 +231,8 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
/// universal rules and applying them. /// universal rules and applying them.
pub fn precomputed_values_for_pseudo(&self, pub fn precomputed_values_for_pseudo(&self,
pseudo: &Impl::PseudoElement, pseudo: &Impl::PseudoElement,
parent: Option<&Arc<ComputedValuesStruct>>) parent: Option<&Arc<ComputedValues>>)
-> Option<Arc<ComputedValuesStruct>> { -> Option<Arc<ComputedValues>> {
debug_assert!(Impl::pseudo_element_cascade_type(pseudo).is_precomputed()); debug_assert!(Impl::pseudo_element_cascade_type(pseudo).is_precomputed());
if let Some(declarations) = self.precomputed_pseudo_element_decls.get(pseudo) { if let Some(declarations) = self.precomputed_pseudo_element_decls.get(pseudo) {
let (computed, _) = let (computed, _) =
@ -250,8 +250,8 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
pub fn lazily_compute_pseudo_element_style<E>(&self, pub fn lazily_compute_pseudo_element_style<E>(&self,
element: &E, element: &E,
pseudo: &Impl::PseudoElement, pseudo: &Impl::PseudoElement,
parent: &Arc<ComputedValuesStruct>) parent: &Arc<ComputedValues>)
-> Option<Arc<ComputedValuesStruct>> -> Option<Arc<ComputedValues>>
where E: Element<Impl=Impl, AttrString=Impl::AttrString> + where E: Element<Impl=Impl, AttrString=Impl::AttrString> +
PresentationalHintsSynthetizer { PresentationalHintsSynthetizer {
debug_assert!(Impl::pseudo_element_cascade_type(pseudo).is_lazy()); debug_assert!(Impl::pseudo_element_cascade_type(pseudo).is_lazy());

View file

@ -1657,7 +1657,7 @@ pub mod specified {
pub mod computed { pub mod computed {
use app_units::Au; use app_units::Au;
use euclid::size::Size2D; use euclid::size::Size2D;
use properties::ComputedValuesStruct; use properties::ComputedValues;
use std::fmt; use std::fmt;
use super::LocalToCss; use super::LocalToCss;
use super::specified::AngleOrCorner; use super::specified::AngleOrCorner;
@ -1669,19 +1669,19 @@ pub mod computed {
pub struct Context<'a> { pub struct Context<'a> {
pub is_root_element: bool, pub is_root_element: bool,
pub viewport_size: Size2D<Au>, pub viewport_size: Size2D<Au>,
pub inherited_style: &'a ComputedValuesStruct, pub inherited_style: &'a ComputedValues,
/// Values access through this need to be in the properties "computed early": /// Values access through this need to be in the properties "computed early":
/// color, text-decoration, font-size, display, position, float, border-*-style, outline-style /// color, text-decoration, font-size, display, position, float, border-*-style, outline-style
pub style: ComputedValuesStruct, pub style: ComputedValues,
} }
impl<'a> Context<'a> { impl<'a> Context<'a> {
pub fn is_root_element(&self) -> bool { self.is_root_element } pub fn is_root_element(&self) -> bool { self.is_root_element }
pub fn viewport_size(&self) -> Size2D<Au> { self.viewport_size } pub fn viewport_size(&self) -> Size2D<Au> { self.viewport_size }
pub fn inherited_style(&self) -> &ComputedValuesStruct { &self.inherited_style } pub fn inherited_style(&self) -> &ComputedValues { &self.inherited_style }
pub fn style(&self) -> &ComputedValuesStruct { &self.style } pub fn style(&self) -> &ComputedValues { &self.style }
pub fn mutate_style(&mut self) -> &mut ComputedValuesStruct { &mut self.style } pub fn mutate_style(&mut self) -> &mut ComputedValues { &mut self.style }
} }
pub trait ToComputedValue { pub trait ToComputedValue {

View file

@ -13,7 +13,7 @@ use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser,
use euclid::scale_factor::ScaleFactor; use euclid::scale_factor::ScaleFactor;
use euclid::size::{Size2D, TypedSize2D}; use euclid::size::{Size2D, TypedSize2D};
use parser::{ParserContext, log_css_error}; use parser::{ParserContext, log_css_error};
use properties::ComputedValuesStruct; use properties::ComputedValues;
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use std::fmt; use std::fmt;
use std::iter::Enumerate; use std::iter::Enumerate;
@ -646,8 +646,8 @@ impl MaybeNew for ViewportConstraints {
let context = Context { let context = Context {
is_root_element: false, is_root_element: false,
viewport_size: initial_viewport, viewport_size: initial_viewport,
inherited_style: ComputedValuesStruct::initial_values(), inherited_style: ComputedValues::initial_values(),
style: ComputedValuesStruct::initial_values().clone(), style: ComputedValues::initial_values().clone(),
}; };
// DEVICE-ADAPT § 9.3 Resolving 'extend-to-zoom' // DEVICE-ADAPT § 9.3 Resolving 'extend-to-zoom'

View file

@ -14,7 +14,7 @@ use gecko_bindings::bindings::{ServoDeclarationBlock, ServoNodeData, ThreadSafeP
use gecko_bindings::bindings::{ThreadSafeURIHolder, nsHTMLCSSStyleSheet}; use gecko_bindings::bindings::{ThreadSafeURIHolder, nsHTMLCSSStyleSheet};
use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI}; use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI};
use gecko_bindings::structs::{SheetParsingMode, nsIAtom}; use gecko_bindings::structs::{SheetParsingMode, nsIAtom};
use properties::ComputedValuesStruct; use properties::ComputedValues;
use selector_impl::{GeckoSelectorImpl, PseudoElement, SharedStyleContext, Stylesheet}; use selector_impl::{GeckoSelectorImpl, PseudoElement, SharedStyleContext, Stylesheet};
use std::mem::transmute; use std::mem::transmute;
use std::ptr; use std::ptr;
@ -87,7 +87,7 @@ fn restyle_subtree(node: GeckoNode, raw_data: *mut RawServoStyleSet) {
// rid of the HackilyFindSomeDeviceContext stuff that happens during // rid of the HackilyFindSomeDeviceContext stuff that happens during
// initial_values computation, since that stuff needs to be called further // initial_values computation, since that stuff needs to be called further
// along in startup than the sensible place to call Servo_Initialize. // along in startup than the sensible place to call Servo_Initialize.
ComputedValuesStruct::initial_values(); ComputedValues::initial_values();
let _needs_dirtying = Arc::get_mut(&mut per_doc_data.stylist).unwrap() let _needs_dirtying = Arc::get_mut(&mut per_doc_data.stylist).unwrap()
.update(&per_doc_data.stylesheets, .update(&per_doc_data.stylesheets,
@ -259,7 +259,7 @@ pub extern "C" fn Servo_GetComputedValues(node: *mut RawGeckoNode)
// cases where Gecko wants the style for a node that Servo never // cases where Gecko wants the style for a node that Servo never
// traversed. We should remove this as soon as possible. // traversed. We should remove this as soon as possible.
error!("stylo: encountered unstyled node, substituting default values."); error!("stylo: encountered unstyled node, substituting default values.");
Arc::new(ComputedValuesStruct::initial_values().clone()) Arc::new(ComputedValues::initial_values().clone())
}, },
}; };
unsafe { transmute(arc_cv) } unsafe { transmute(arc_cv) }
@ -280,7 +280,7 @@ pub extern "C" fn Servo_GetComputedValuesForAnonymousBox(parent_style_or_null: *
} }
}; };
type Helpers = ArcHelpers<ServoComputedValues, ComputedValuesStruct>; type Helpers = ArcHelpers<ServoComputedValues, ComputedValues>;
Helpers::maybe_with(parent_style_or_null, |maybe_parent| { Helpers::maybe_with(parent_style_or_null, |maybe_parent| {
let new_computed = data.stylist.precomputed_values_for_pseudo(&pseudo, maybe_parent); let new_computed = data.stylist.precomputed_values_for_pseudo(&pseudo, maybe_parent);
@ -319,7 +319,7 @@ pub extern "C" fn Servo_GetComputedValuesForPseudoElement(parent_style: *mut Ser
let element = unsafe { GeckoElement::from_raw(match_element) }; let element = unsafe { GeckoElement::from_raw(match_element) };
type Helpers = ArcHelpers<ServoComputedValues, ComputedValuesStruct>; type Helpers = ArcHelpers<ServoComputedValues, ComputedValues>;
match GeckoSelectorImpl::pseudo_element_cascade_type(&pseudo) { match GeckoSelectorImpl::pseudo_element_cascade_type(&pseudo) {
PseudoElementCascadeType::Eager => { PseudoElementCascadeType::Eager => {
@ -347,22 +347,22 @@ pub extern "C" fn Servo_GetComputedValuesForPseudoElement(parent_style: *mut Ser
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_InheritComputedValues(parent_style: *mut ServoComputedValues) pub extern "C" fn Servo_InheritComputedValues(parent_style: *mut ServoComputedValues)
-> *mut ServoComputedValues { -> *mut ServoComputedValues {
type Helpers = ArcHelpers<ServoComputedValues, ComputedValuesStruct>; type Helpers = ArcHelpers<ServoComputedValues, ComputedValues>;
Helpers::with(parent_style, |parent| { Helpers::with(parent_style, |parent| {
let style = ComputedValuesStruct::inherit_from(parent); let style = ComputedValues::inherit_from(parent);
Helpers::from(style) Helpers::from(style)
}) })
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_AddRefComputedValues(ptr: *mut ServoComputedValues) -> () { pub extern "C" fn Servo_AddRefComputedValues(ptr: *mut ServoComputedValues) -> () {
type Helpers = ArcHelpers<ServoComputedValues, ComputedValuesStruct>; type Helpers = ArcHelpers<ServoComputedValues, ComputedValues>;
unsafe { Helpers::addref(ptr) }; unsafe { Helpers::addref(ptr) };
} }
#[no_mangle] #[no_mangle]
pub extern "C" fn Servo_ReleaseComputedValues(ptr: *mut ServoComputedValues) -> () { pub extern "C" fn Servo_ReleaseComputedValues(ptr: *mut ServoComputedValues) -> () {
type Helpers = ArcHelpers<ServoComputedValues, ComputedValuesStruct>; type Helpers = ArcHelpers<ServoComputedValues, ComputedValues>;
unsafe { Helpers::release(ptr) }; unsafe { Helpers::release(ptr) };
} }

View file

@ -27,7 +27,7 @@ use gecko_bindings::structs::nsIAtom;
use gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRTY_FOR_SERVO}; use gecko_bindings::structs::{NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO, NODE_IS_DIRTY_FOR_SERVO};
use glue::GeckoDeclarationBlock; use glue::GeckoDeclarationBlock;
use libc::uintptr_t; use libc::uintptr_t;
use properties::ComputedValuesStruct; use properties::ComputedValues;
use selector_impl::{GeckoSelectorImpl, NonTSPseudoClass, PrivateStyleData}; use selector_impl::{GeckoSelectorImpl, NonTSPseudoClass, PrivateStyleData};
use selectors::Element; use selectors::Element;
use selectors::matching::DeclarationBlock; use selectors::matching::DeclarationBlock;
@ -99,7 +99,7 @@ impl<'ln> GeckoNode<'ln> {
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
pub struct DummyRestyleDamage; pub struct DummyRestyleDamage;
impl TRestyleDamage for DummyRestyleDamage { impl TRestyleDamage for DummyRestyleDamage {
fn compute(_: Option<&Arc<ComputedValuesStruct>>, _: &ComputedValuesStruct) -> Self { DummyRestyleDamage } fn compute(_: Option<&Arc<ComputedValues>>, _: &ComputedValues) -> Self { DummyRestyleDamage }
fn rebuild_and_reflow() -> Self { DummyRestyleDamage } fn rebuild_and_reflow() -> Self { DummyRestyleDamage }
} }
impl BitOr for DummyRestyleDamage { impl BitOr for DummyRestyleDamage {