diff --git a/components/style/animation.rs b/components/style/animation.rs index 3812542d78c..73bdab66e0e 100644 --- a/components/style/animation.rs +++ b/components/style/animation.rs @@ -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::transition_timing_function::computed_value::StartEnd; use properties::longhands::transition_timing_function::computed_value::TransitionTimingFunction; -use properties::{self, ComputedValuesStruct}; +use properties::{self, ComputedValues}; use selector_impl::SelectorImplExt; use selectors::matching::DeclarationBlock; use std::sync::Arc; @@ -71,7 +71,7 @@ pub struct KeyframesAnimationState { pub expired: bool, /// The original cascade style, needed to compute the generated keyframes of /// the animation. - pub cascade_style: Arc, + pub cascade_style: Arc, } impl KeyframesAnimationState { @@ -249,8 +249,8 @@ impl PropertyAnimation { /// 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`). pub fn from_transition(transition_index: usize, - old_style: &ComputedValuesStruct, - new_style: &mut ComputedValuesStruct) + old_style: &ComputedValues, + new_style: &mut ComputedValues) -> Vec { let mut result = vec![]; let box_style = new_style.get_box(); @@ -288,8 +288,8 @@ impl PropertyAnimation { fn from_transition_property(transition_property: TransitionProperty, timing_function: TransitionTimingFunction, duration: Time, - old_style: &ComputedValuesStruct, - new_style: &ComputedValuesStruct) + old_style: &ComputedValues, + new_style: &ComputedValues) -> Option { let animated_property = AnimatedProperty::from_transition_property(&transition_property, 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 { TransitionTimingFunction::CubicBezier(p1, p2) => { // See `WebCore::AnimationBase::solveEpsilon(double)` in WebKit. @@ -341,8 +341,8 @@ impl PropertyAnimation { // cloneable part and a non-cloneable part.. pub fn start_transitions_if_applicable(new_animations_sender: &Sender, node: OpaqueNode, - old_style: &ComputedValuesStruct, - new_style: &mut Arc) + old_style: &ComputedValues, + new_style: &mut Arc) -> bool { let mut had_animations = false; for i in 0..new_style.get_box().transition_property_count() { @@ -374,9 +374,9 @@ pub fn start_transitions_if_applicable(new_animations_sen fn compute_style_for_animation_step(context: &SharedStyleContext, step: &KeyframesStep, - previous_style: &ComputedValuesStruct, - style_from_cascade: &ComputedValuesStruct) - -> ComputedValuesStruct { + previous_style: &ComputedValues, + style_from_cascade: &ComputedValues) + -> ComputedValues { match step.value { // TODO: avoiding this spurious clone might involve having to create // an Arc in the below (more common case). @@ -401,7 +401,7 @@ fn compute_style_for_animation_step(context: &SharedStyle pub fn maybe_start_animations(context: &SharedStyleContext, new_animations_sender: &Sender, node: OpaqueNode, - new_style: &Arc) -> bool + new_style: &Arc) -> bool { let mut had_animations = false; @@ -469,7 +469,7 @@ pub fn maybe_start_animations(context: &SharedStyleContex /// Updates a given computed style for a given animation frame. Returns a bool /// representing if the style was indeed updated. -pub fn update_style_for_animation_frame(mut new_style: &mut Arc, +pub fn update_style_for_animation_frame(mut new_style: &mut Arc, now: f64, start_time: f64, frame: &AnimationFrame) -> bool { @@ -490,7 +490,7 @@ pub fn update_style_for_animation_frame(mut new_style: &mut Arc(context: &SharedStyleContext, animation: &Animation, - style: &mut Arc, + style: &mut Arc, damage: Option<&mut Damage>) where Impl: SelectorImplExt, Damage: TRestyleDamage { diff --git a/components/style/data.rs b/components/style/data.rs index 80f974f0354..82ad8bc6f44 100644 --- a/components/style/data.rs +++ b/components/style/data.rs @@ -4,7 +4,7 @@ //! Per-node data used in style calculation. -use properties::ComputedValuesStruct; +use properties::ComputedValues; use selectors::parser::SelectorImpl; use std::collections::HashMap; use std::hash::BuildHasherDefault; @@ -13,10 +13,10 @@ use std::sync::atomic::AtomicIsize; pub struct PrivateStyleData { /// The results of CSS styling for this node. - pub style: Option>, + pub style: Option>, /// The results of CSS styling for each pseudo-element (if any). - pub per_pseudo: HashMap, + pub per_pseudo: HashMap, BuildHasherDefault<::fnv::FnvHasher>>, /// Information needed during parallel traversals. diff --git a/components/style/dom.rs b/components/style/dom.rs index 9c56f8aca4c..8c4c68a2b64 100644 --- a/components/style/dom.rs +++ b/components/style/dom.rs @@ -9,7 +9,7 @@ use context::SharedStyleContext; use data::PrivateStyleData; use element_state::ElementState; -use properties::{ComputedValuesStruct, PropertyDeclaration, PropertyDeclarationBlock}; +use properties::{ComputedValues, PropertyDeclaration, PropertyDeclarationBlock}; use refcell::{Ref, RefMut}; use restyle_hints::{ElementSnapshot, RESTYLE_DESCENDANTS, RESTYLE_LATER_SIBLINGS, RESTYLE_SELF, RestyleHint}; use selector_impl::{ElementExt, SelectorImplExt}; @@ -46,7 +46,7 @@ impl OpaqueNode { } pub trait TRestyleDamage : BitOr + Copy { - fn compute(old: Option<&Arc>, new: &ComputedValuesStruct) -> Self; + fn compute(old: Option<&Arc>, new: &ComputedValues) -> Self; fn rebuild_and_reflow() -> Self; } @@ -178,7 +178,7 @@ pub trait TNode : Sized + Copy + Clone { /// has not yet been performed, fails. fn style(&self, _context: &SharedStyleContext<::Impl>) - -> Ref> + -> Ref> where ::Impl: SelectorImplExt { Ref::map(self.borrow_data().unwrap(), |data| data.style.as_ref().unwrap()) } diff --git a/components/style/matching.rs b/components/style/matching.rs index d90d071f036..350e5921873 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -12,7 +12,7 @@ use cache::{LRUCache, SimpleHashCache}; use context::{StyleContext, SharedStyleContext}; use data::PrivateStyleData; use dom::{TElement, TNode, TRestyleDamage}; -use properties::{ComputedValuesStruct, PropertyDeclaration, cascade}; +use properties::{ComputedValues, PropertyDeclaration, cascade}; use selector_impl::{ElementExt, SelectorImplExt}; use selector_matching::{DeclarationBlock, Stylist}; use selectors::Element; @@ -150,7 +150,7 @@ impl<'a> Hash for ApplicableDeclarationsCacheQuery<'a> { static APPLICABLE_DECLARATIONS_CACHE_SIZE: usize = 32; pub struct ApplicableDeclarationsCache { - cache: SimpleHashCache>, + cache: SimpleHashCache>, } impl ApplicableDeclarationsCache { @@ -160,14 +160,14 @@ impl ApplicableDeclarationsCache { } } - pub fn find(&self, declarations: &[DeclarationBlock]) -> Option> { + pub fn find(&self, declarations: &[DeclarationBlock]) -> Option> { match self.cache.find(&ApplicableDeclarationsCacheQuery::new(declarations)) { None => None, Some(ref values) => Some((*values).clone()), } } - pub fn insert(&mut self, declarations: Vec, style: Arc) { + pub fn insert(&mut self, declarations: Vec, style: Arc) { self.cache.insert(ApplicableDeclarationsCacheEntry::new(declarations), style) } @@ -183,8 +183,8 @@ pub struct StyleSharingCandidateCache { #[derive(Clone)] pub struct StyleSharingCandidate { - pub style: Arc, - pub parent_style: Arc, + pub style: Arc, + pub parent_style: Arc, pub local_name: Atom, pub classes: Vec, pub namespace: Namespace, @@ -369,14 +369,14 @@ trait PrivateMatchMethods: TNode /// pseudo-elements. fn cascade_node_pseudo_element<'a, Ctx>(&self, context: &Ctx, - parent_style: Option<&Arc>, + parent_style: Option<&Arc>, applicable_declarations: &[DeclarationBlock], - mut style: Option<&mut Arc>, + mut style: Option<&mut Arc>, applicable_declarations_cache: &mut ApplicableDeclarationsCache, shareable: bool, animate_properties: bool) - -> (Self::ConcreteRestyleDamage, Arc) + -> (Self::ConcreteRestyleDamage, Arc) where Ctx: StyleContext<'a, ::Impl> { let mut cacheable = true; let shared_context = context.shared_context(); @@ -456,7 +456,7 @@ trait PrivateMatchMethods: TNode fn update_animations_for_cascade(&self, context: &SharedStyleContext<::Impl>, - style: &mut Option<&mut Arc>) + style: &mut Option<&mut Arc>) -> bool { let style = match *style { None => return false, @@ -524,7 +524,7 @@ trait PrivateElementMatchMethods: TElement { fn share_style_with_candidate_if_possible(&self, parent_node: Option, candidate: &StyleSharingCandidate) - -> Option> { + -> Option> { let parent_node = match parent_node { Some(ref parent_node) if parent_node.as_element().is_some() => parent_node, Some(_) | None => return None, @@ -694,7 +694,7 @@ pub trait MatchMethods : TNode { if self.is_text_node() { let mut data_ref = self.mutate_data().unwrap(); 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(), &*cloned_parent_style); data.style = Some(cloned_parent_style); diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index f24ef0614a6..6cc7592de81 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -45,7 +45,7 @@ pub mod style_structs { } #[derive(Clone, Debug)] -pub struct ComputedValuesStruct { +pub struct ComputedValues { % for style_struct in data.style_structs: ${style_struct.ident}: Arc, % endfor @@ -56,9 +56,9 @@ pub struct ComputedValuesStruct { pub root_font_size: Au, } -impl ComputedValuesStruct { +impl ComputedValues { pub fn inherit_from(parent: &Arc) -> Arc { - Arc::new(ComputedValuesStruct { + Arc::new(ComputedValues { custom_properties: parent.custom_properties.clone(), shareable: parent.shareable, writing_mode: parent.writing_mode, @@ -81,7 +81,7 @@ impl ComputedValuesStruct { ${style_struct.ident}: Arc, % endfor ) -> Self { - ComputedValuesStruct { + ComputedValues { custom_properties: custom_properties, shareable: shareable, writing_mode: writing_mode, @@ -96,7 +96,7 @@ impl ComputedValuesStruct { // Gecko expects text nodes to be styled as if they were elements that // matched no rules (that is, inherited style structs are inherited and // 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 } @@ -1296,7 +1296,7 @@ fn static_assert() { #[allow(non_snake_case, unused_variables)] pub extern "C" fn Servo_GetStyle${style_struct.gecko_name}(computed_values: *mut bindings::ServoComputedValues) -> *const ${style_struct.gecko_ffi_name} { - type Helpers = ArcHelpers; + type Helpers = ArcHelpers; Helpers::with(computed_values, |values| values.get_${style_struct.name_lower}().get_gecko() as *const ${style_struct.gecko_ffi_name}) } @@ -1312,7 +1312,7 @@ ${define_ffi_struct_accessor(style_struct)} % endfor 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: ${style_struct.ident}: style_structs::${style_struct.name}::initial(), % endfor diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index c50efff3951..40bef518de9 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -170,7 +170,7 @@ use error_reporting::ParseErrorReporter; use properties::longhands; use properties::property_bit_field::PropertyBitField; - use properties::{ComputedValuesStruct, PropertyDeclaration}; + use properties::{ComputedValues, PropertyDeclaration}; use properties::style_structs; use std::boxed::Box as StdBox; use std::collections::HashMap; @@ -181,7 +181,7 @@ ${caller.body()} #[allow(unused_variables)] pub fn cascade_property(declaration: &PropertyDeclaration, - inherited_style: &ComputedValuesStruct, + inherited_style: &ComputedValues, context: &mut computed::Context, seen: &mut PropertyBitField, cacheable: &mut bool, @@ -210,7 +210,7 @@ DeclaredValue::Initial => { // We assume that it's faster to use copy_*_from rather than // set_*(get_initial_value()); - let initial_struct = ComputedValuesStruct::initial_values() + let initial_struct = ComputedValues::initial_values() .get_${data.current_style_struct.name_lower}(); context.mutate_style().mutate_${data.current_style_struct.name_lower}() .copy_${property.ident}_from(initial_struct); diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index b98c6e8ff22..10bac440f30 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -26,7 +26,7 @@ use properties::longhands::visibility::computed_value::T as Visibility; use properties::longhands::z_index::computed_value::T as ZIndex; use std::cmp; use std::fmt; -use super::ComputedValuesStruct; +use super::ComputedValues; use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone}; use values::computed::{BorderRadiusSize, LengthOrNone}; 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 { % for prop in data.longhands: % if prop.animatable: @@ -129,8 +129,8 @@ impl AnimatedProperty { } pub fn from_transition_property(transition_property: &TransitionProperty, - old_style: &ComputedValuesStruct, - new_style: &ComputedValuesStruct) + old_style: &ComputedValues, + new_style: &ComputedValues) -> AnimatedProperty { match *transition_property { TransitionProperty::All => panic!("Can't use TransitionProperty::All here."), diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index 84a25162759..87af34df33e 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -77,7 +77,7 @@ % if product == "servo": fn cascade_property_custom(_declaration: &PropertyDeclaration, - _inherited_style: &ComputedValuesStruct, + _inherited_style: &ComputedValues, context: &mut computed::Context, _seen: &mut PropertyBitField, _cacheable: &mut bool, diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs index 86ae7258471..2a886999ef0 100644 --- a/components/style/properties/longhand/text.mako.rs +++ b/components/style/properties/longhand/text.mako.rs @@ -109,7 +109,7 @@ ${helpers.single_keyword("unicode-bidi", % if product == "servo": fn cascade_property_custom(_declaration: &PropertyDeclaration, - _inherited_style: &ComputedValuesStruct, + _inherited_style: &ComputedValues, context: &mut computed::Context, _seen: &mut PropertyBitField, _cacheable: &mut bool, diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index be95a12732b..cb9ef5152df 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1242,14 +1242,14 @@ pub mod style_structs { #[cfg(feature = "gecko")] -pub use gecko_properties::ComputedValuesStruct; +pub use gecko_properties::ComputedValues; #[cfg(feature = "servo")] -pub type ServoComputedValues = ComputedValuesStruct; +pub type ServoComputedValues = ComputedValues; #[cfg(feature = "servo")] #[cfg_attr(feature = "servo", derive(Clone, Debug, HeapSizeOf))] -pub struct ComputedValuesStruct { +pub struct ComputedValues { % for style_struct in data.active_style_structs(): ${style_struct.ident}: Arc, % endfor @@ -1260,7 +1260,7 @@ pub struct ComputedValuesStruct { } #[cfg(feature = "servo")] -impl ComputedValuesStruct { +impl ComputedValues { pub fn new(custom_properties: Option>, shareable: bool, writing_mode: WritingMode, @@ -1269,7 +1269,7 @@ impl ComputedValuesStruct { ${style_struct.ident}: Arc, % endfor ) -> Self { - ComputedValuesStruct { + ComputedValues { custom_properties: custom_properties, shareable: shareable, writing_mode: writing_mode, @@ -1562,11 +1562,11 @@ pub use self::lazy_static_module::INITIAL_SERVO_VALUES; mod lazy_static_module { use logical_geometry::WritingMode; 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. 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(): ${style_struct.ident}: Arc::new(style_structs::${style_struct.name} { % for longhand in style_struct.longhands: @@ -1591,16 +1591,16 @@ fn cascade_with_cached_declarations( viewport_size: Size2D, applicable_declarations: &[DeclarationBlock>], shareable: bool, - parent_style: &ComputedValuesStruct, - cached_style: &ComputedValuesStruct, + parent_style: &ComputedValues, + cached_style: &ComputedValues, custom_properties: Option>, mut error_reporter: StdBox) - -> ComputedValuesStruct { + -> ComputedValues { let mut context = computed::Context { is_root_element: false, viewport_size: viewport_size, inherited_style: parent_style, - style: ComputedValuesStruct::new( + style: ComputedValues::new( custom_properties, shareable, WritingMode::empty(), @@ -1693,7 +1693,7 @@ fn cascade_with_cached_declarations( pub type CascadePropertyFn = extern "Rust" fn(declaration: &PropertyDeclaration, - inherited_style: &ComputedValuesStruct, + inherited_style: &ComputedValues, context: &mut computed::Context, seen: &mut PropertyBitField, cacheable: &mut bool, @@ -1727,11 +1727,11 @@ static CASCADE_PROPERTY: [CascadePropertyFn; ${len(data.longhands)}] = [ pub fn cascade(viewport_size: Size2D, applicable_declarations: &[DeclarationBlock>], shareable: bool, - parent_style: Option<<&ComputedValuesStruct>, - cached_style: Option<<&ComputedValuesStruct>, + parent_style: Option<<&ComputedValues>, + cached_style: Option<<&ComputedValues>, mut error_reporter: StdBox) - -> (ComputedValuesStruct, bool) { - let initial_values = ComputedValuesStruct::initial_values(); + -> (ComputedValues, bool) { + let initial_values = ComputedValues::initial_values(); let (is_root_element, inherited_style) = match parent_style { Some(parent_style) => (false, parent_style), None => (true, initial_values), @@ -1771,7 +1771,7 @@ pub fn cascade(viewport_size: Size2D, is_root_element: is_root_element, viewport_size: viewport_size, inherited_style: inherited_style, - style: ComputedValuesStruct::new( + style: ComputedValues::new( custom_properties, shareable, WritingMode::empty(), @@ -1796,7 +1796,7 @@ pub fn cascade(viewport_size: Size2D, // 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 // virtual dispatch instead. - ComputedValuesStruct::do_cascade_property(|cascade_property| { + ComputedValues::do_cascade_property(|cascade_property| { % for category_to_cascade_now in ["early", "other"]: for sub_list in applicable_declarations.iter().rev() { // Declarations are already stored in reverse order. @@ -1941,7 +1941,7 @@ pub fn cascade(viewport_size: Size2D, } #[cfg(feature = "servo")] -pub fn modify_style_for_anonymous_flow(style: &mut Arc, +pub fn modify_style_for_anonymous_flow(style: &mut Arc, new_display_value: longhands::display::computed_value::T) { // The 'align-self' property needs some special treatment since // 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, /// FIXME(#5625, pcwalton): It would probably be cleaner and faster to do this in the cascade. #[cfg(feature = "servo")] #[inline] -pub fn modify_style_for_replaced_content(style: &mut Arc) { +pub fn modify_style_for_replaced_content(style: &mut Arc) { // Reset `position` to handle cases like `
foo bar baz
`. if style.box_.display != longhands::display::computed_value::T::inline { let mut style = Arc::make_mut(style); @@ -2027,10 +2027,10 @@ pub fn modify_style_for_replaced_content(style: &mut Arc) /// not outermost. #[cfg(feature = "servo")] #[inline] -pub fn modify_border_style_for_inline_sides(style: &mut Arc, +pub fn modify_border_style_for_inline_sides(style: &mut Arc, is_first_fragment_of_element: bool, is_last_fragment_of_element: bool) { - fn modify_side(style: &mut Arc, side: PhysicalSide) { + fn modify_side(style: &mut Arc, side: PhysicalSide) { { let border = &style.border; let current_style = match side { @@ -2080,7 +2080,7 @@ pub fn modify_border_style_for_inline_sides(style: &mut Arc, + style: &mut Arc, new_display_value: longhands::display::computed_value::T) { let mut style = Arc::make_mut(style); 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. #[cfg(feature = "servo")] #[inline] -pub fn modify_style_for_outer_inline_block_fragment(style: &mut Arc) { +pub fn modify_style_for_outer_inline_block_fragment(style: &mut Arc) { let mut style = Arc::make_mut(style); let box_style = Arc::make_mut(&mut style.box_); 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) { +pub fn modify_style_for_text(style: &mut Arc) { 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 // 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) { /// Margins apply to the `input` element itself, so including them in the text will cause them to /// be double-counted. #[cfg(feature = "servo")] -pub fn modify_style_for_input_text(style: &mut Arc) { +pub fn modify_style_for_input_text(style: &mut Arc) { let mut style = Arc::make_mut(style); let margin_style = Arc::make_mut(&mut style.margin); margin_style.margin_top = computed::LengthOrPercentageOrAuto::Length(Au(0)); @@ -2155,7 +2155,7 @@ pub fn modify_style_for_input_text(style: &mut Arc) { /// Adjusts the `clip` property so that an inline absolute hypothetical fragment doesn't clip its /// children. #[cfg(feature = "servo")] -pub fn modify_style_for_inline_absolute_hypothetical_fragment(style: &mut Arc) { +pub fn modify_style_for_inline_absolute_hypothetical_fragment(style: &mut Arc) { if style.get_effects().clip.0.is_some() { let mut style = Arc::make_mut(style); let effects_style = Arc::make_mut(&mut style.effects); diff --git a/components/style/selector_matching.rs b/components/style/selector_matching.rs index 14ad1b279f0..a07685b9dd4 100644 --- a/components/style/selector_matching.rs +++ b/components/style/selector_matching.rs @@ -9,7 +9,7 @@ use element_state::*; use error_reporting::StdoutErrorReporter; use keyframes::KeyframesAnimation; use media_queries::{Device, MediaType}; -use properties::{self, PropertyDeclaration, PropertyDeclarationBlock, ComputedValuesStruct}; +use properties::{self, PropertyDeclaration, PropertyDeclarationBlock, ComputedValues}; use restyle_hints::{ElementSnapshot, RestyleHint, DependencySet}; use selector_impl::SelectorImplExt; use selectors::bloom::BloomFilter; @@ -231,8 +231,8 @@ impl Stylist { /// universal rules and applying them. pub fn precomputed_values_for_pseudo(&self, pseudo: &Impl::PseudoElement, - parent: Option<&Arc>) - -> Option> { + parent: Option<&Arc>) + -> Option> { debug_assert!(Impl::pseudo_element_cascade_type(pseudo).is_precomputed()); if let Some(declarations) = self.precomputed_pseudo_element_decls.get(pseudo) { let (computed, _) = @@ -250,8 +250,8 @@ impl Stylist { pub fn lazily_compute_pseudo_element_style(&self, element: &E, pseudo: &Impl::PseudoElement, - parent: &Arc) - -> Option> + parent: &Arc) + -> Option> where E: Element + PresentationalHintsSynthetizer { debug_assert!(Impl::pseudo_element_cascade_type(pseudo).is_lazy()); diff --git a/components/style/values.rs b/components/style/values.rs index 6068db124d9..35063977aa6 100644 --- a/components/style/values.rs +++ b/components/style/values.rs @@ -1657,7 +1657,7 @@ pub mod specified { pub mod computed { use app_units::Au; use euclid::size::Size2D; - use properties::ComputedValuesStruct; + use properties::ComputedValues; use std::fmt; use super::LocalToCss; use super::specified::AngleOrCorner; @@ -1669,19 +1669,19 @@ pub mod computed { pub struct Context<'a> { pub is_root_element: bool, pub viewport_size: Size2D, - pub inherited_style: &'a ComputedValuesStruct, + pub inherited_style: &'a ComputedValues, /// Values access through this need to be in the properties "computed early": /// color, text-decoration, font-size, display, position, float, border-*-style, outline-style - pub style: ComputedValuesStruct, + pub style: ComputedValues, } impl<'a> Context<'a> { pub fn is_root_element(&self) -> bool { self.is_root_element } pub fn viewport_size(&self) -> Size2D { self.viewport_size } - pub fn inherited_style(&self) -> &ComputedValuesStruct { &self.inherited_style } - pub fn style(&self) -> &ComputedValuesStruct { &self.style } - pub fn mutate_style(&mut self) -> &mut ComputedValuesStruct { &mut self.style } + pub fn inherited_style(&self) -> &ComputedValues { &self.inherited_style } + pub fn style(&self) -> &ComputedValues { &self.style } + pub fn mutate_style(&mut self) -> &mut ComputedValues { &mut self.style } } pub trait ToComputedValue { diff --git a/components/style/viewport.rs b/components/style/viewport.rs index baedb77d971..ebed8cc2600 100644 --- a/components/style/viewport.rs +++ b/components/style/viewport.rs @@ -13,7 +13,7 @@ use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser, use euclid::scale_factor::ScaleFactor; use euclid::size::{Size2D, TypedSize2D}; use parser::{ParserContext, log_css_error}; -use properties::ComputedValuesStruct; +use properties::ComputedValues; use std::ascii::AsciiExt; use std::fmt; use std::iter::Enumerate; @@ -646,8 +646,8 @@ impl MaybeNew for ViewportConstraints { let context = Context { is_root_element: false, viewport_size: initial_viewport, - inherited_style: ComputedValuesStruct::initial_values(), - style: ComputedValuesStruct::initial_values().clone(), + inherited_style: ComputedValues::initial_values(), + style: ComputedValues::initial_values().clone(), }; // DEVICE-ADAPT ยง 9.3 Resolving 'extend-to-zoom' diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index edeed7eece5..117056fe14c 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -14,7 +14,7 @@ use gecko_bindings::bindings::{ServoDeclarationBlock, ServoNodeData, ThreadSafeP use gecko_bindings::bindings::{ThreadSafeURIHolder, nsHTMLCSSStyleSheet}; use gecko_bindings::ptr::{GeckoArcPrincipal, GeckoArcURI}; use gecko_bindings::structs::{SheetParsingMode, nsIAtom}; -use properties::ComputedValuesStruct; +use properties::ComputedValues; use selector_impl::{GeckoSelectorImpl, PseudoElement, SharedStyleContext, Stylesheet}; use std::mem::transmute; use std::ptr; @@ -87,7 +87,7 @@ fn restyle_subtree(node: GeckoNode, raw_data: *mut RawServoStyleSet) { // rid of the HackilyFindSomeDeviceContext stuff that happens during // initial_values computation, since that stuff needs to be called further // 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() .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 // traversed. We should remove this as soon as possible. error!("stylo: encountered unstyled node, substituting default values."); - Arc::new(ComputedValuesStruct::initial_values().clone()) + Arc::new(ComputedValues::initial_values().clone()) }, }; unsafe { transmute(arc_cv) } @@ -280,7 +280,7 @@ pub extern "C" fn Servo_GetComputedValuesForAnonymousBox(parent_style_or_null: * } }; - type Helpers = ArcHelpers; + type Helpers = ArcHelpers; Helpers::maybe_with(parent_style_or_null, |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) }; - type Helpers = ArcHelpers; + type Helpers = ArcHelpers; match GeckoSelectorImpl::pseudo_element_cascade_type(&pseudo) { PseudoElementCascadeType::Eager => { @@ -347,22 +347,22 @@ pub extern "C" fn Servo_GetComputedValuesForPseudoElement(parent_style: *mut Ser #[no_mangle] pub extern "C" fn Servo_InheritComputedValues(parent_style: *mut ServoComputedValues) -> *mut ServoComputedValues { - type Helpers = ArcHelpers; + type Helpers = ArcHelpers; Helpers::with(parent_style, |parent| { - let style = ComputedValuesStruct::inherit_from(parent); + let style = ComputedValues::inherit_from(parent); Helpers::from(style) }) } #[no_mangle] pub extern "C" fn Servo_AddRefComputedValues(ptr: *mut ServoComputedValues) -> () { - type Helpers = ArcHelpers; + type Helpers = ArcHelpers; unsafe { Helpers::addref(ptr) }; } #[no_mangle] pub extern "C" fn Servo_ReleaseComputedValues(ptr: *mut ServoComputedValues) -> () { - type Helpers = ArcHelpers; + type Helpers = ArcHelpers; unsafe { Helpers::release(ptr) }; } diff --git a/ports/geckolib/wrapper.rs b/ports/geckolib/wrapper.rs index d4c163166ef..32215fbfe78 100644 --- a/ports/geckolib/wrapper.rs +++ b/ports/geckolib/wrapper.rs @@ -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 glue::GeckoDeclarationBlock; use libc::uintptr_t; -use properties::ComputedValuesStruct; +use properties::ComputedValues; use selector_impl::{GeckoSelectorImpl, NonTSPseudoClass, PrivateStyleData}; use selectors::Element; use selectors::matching::DeclarationBlock; @@ -99,7 +99,7 @@ impl<'ln> GeckoNode<'ln> { #[derive(Clone, Copy)] pub struct DummyRestyleDamage; impl TRestyleDamage for DummyRestyleDamage { - fn compute(_: Option<&Arc>, _: &ComputedValuesStruct) -> Self { DummyRestyleDamage } + fn compute(_: Option<&Arc>, _: &ComputedValues) -> Self { DummyRestyleDamage } fn rebuild_and_reflow() -> Self { DummyRestyleDamage } } impl BitOr for DummyRestyleDamage {