From 104f5c2553606d0b26d7cf2ad9b90eb2efd94792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 22 Jan 2018 23:50:40 +0100 Subject: [PATCH] style: Derive debug for CascadeInputs. It no longer has anything than rules. --- components/layout_thread/dom_wrapper.rs | 2 ++ components/layout_thread/lib.rs | 25 +++++++++++-------- .../script_layout_interface/wrapper_traits.rs | 10 +++++--- components/style/context.rs | 11 +------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/components/layout_thread/dom_wrapper.rs b/components/layout_thread/dom_wrapper.rs index 6eef1106c3d..f900854d1c4 100644 --- a/components/layout_thread/dom_wrapper.rs +++ b/components/layout_thread/dom_wrapper.rs @@ -860,6 +860,7 @@ impl<'ln> NodeInfo for ServoThreadSafeLayoutNode<'ln> { impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> { type ConcreteNode = ServoLayoutNode<'ln>; type ConcreteThreadSafeLayoutElement = ServoThreadSafeLayoutElement<'ln>; + type ConcreteElement = ServoLayoutElement<'ln>; type ChildrenIterator = ThreadSafeLayoutNodeChildrenIterator; fn opaque(&self) -> OpaqueNode { @@ -1084,6 +1085,7 @@ pub struct ServoThreadSafeLayoutElement<'le> { impl<'le> ThreadSafeLayoutElement for ServoThreadSafeLayoutElement<'le> { type ConcreteThreadSafeLayoutNode = ServoThreadSafeLayoutNode<'le>; + type ConcreteElement = ServoLayoutElement<'le>; fn as_node(&self) -> ServoThreadSafeLayoutNode<'le> { ServoThreadSafeLayoutNode { diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 3fb7d0c8c73..fcd790fe6ec 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -1491,8 +1491,11 @@ impl LayoutThread { self.profiler_metadata(), self.time_profiler_chan.clone(), || { - animation::recalc_style_for_animations( - &layout_context, FlowRef::deref_mut(&mut root_flow), &animations) + animation::recalc_style_for_animations::( + &layout_context, + FlowRef::deref_mut(&mut root_flow), + &animations, + ) }); } self.perform_post_style_recalc_layout_passes(&mut root_flow, @@ -1522,14 +1525,16 @@ impl LayoutThread { .as_mut() .map(|nodes| &mut **nodes); // Kick off animations if any were triggered, expire completed ones. - animation::update_animation_state(&self.constellation_chan, - &self.script_chan, - &mut *self.running_animations.write(), - &mut *self.expired_animations.write(), - newly_transitioning_nodes, - &self.new_animations_receiver, - self.id, - &self.timer); + animation::update_animation_state::( + &self.constellation_chan, + &self.script_chan, + &mut *self.running_animations.write(), + &mut *self.expired_animations.write(), + newly_transitioning_nodes, + &self.new_animations_receiver, + self.id, + &self.timer, + ); } profile(time::ProfilerCategory::LayoutRestyleDamagePropagation, diff --git a/components/script_layout_interface/wrapper_traits.rs b/components/script_layout_interface/wrapper_traits.rs index 17a9172cd71..ffdc9aa95ed 100644 --- a/components/script_layout_interface/wrapper_traits.rs +++ b/components/script_layout_interface/wrapper_traits.rs @@ -148,7 +148,7 @@ impl Iterator for TreeIterator /// node does not allow any parents or siblings of nodes to be accessed, to avoid races. pub trait ThreadSafeLayoutNode: Clone + Copy + Debug + GetLayoutData + NodeInfo + PartialEq + Sized { type ConcreteNode: LayoutNode; - type ConcreteElement: TElement = ::ConcreteElement; + type ConcreteElement: TElement; type ConcreteThreadSafeLayoutElement: ThreadSafeLayoutElement @@ -293,9 +293,11 @@ pub trait ThreadSafeLayoutElement { type ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode; - /// This type alias is just a hack to avoid writing the monstrosity after it - /// twice. - type ConcreteElement: TElement = ::ConcreteElement; + /// This type alias is just a work-around to avoid writing + /// + /// ::ConcreteElement + /// + type ConcreteElement: TElement; fn as_node(&self) -> Self::ConcreteThreadSafeLayoutNode; diff --git a/components/style/context.rs b/components/style/context.rs index 6c9ba7b47f6..3768289da0e 100644 --- a/components/style/context.rs +++ b/components/style/context.rs @@ -203,7 +203,7 @@ impl<'a> SharedStyleContext<'a> { /// within the `CurrentElementInfo`. At the end of the cascade, they are folded /// down into the main `ComputedValues` to reduce memory usage per element while /// still remaining accessible. -#[derive(Clone, Default)] +#[derive(Clone, Debug, Default)] pub struct CascadeInputs { /// The rule node representing the ordered list of rules matched for this /// node. @@ -226,15 +226,6 @@ impl CascadeInputs { } } -// We manually implement Debug for CascadeInputs so that we can avoid the -// verbose stringification of ComputedValues for normal logging. -impl fmt::Debug for CascadeInputs { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "CascadeInputs {{ rules: {:?}, visited_rules: {:?}, .. }}", - self.rules, self.visited_rules) - } -} - /// A list of cascade inputs for eagerly-cascaded pseudo-elements. /// The list is stored inline. #[derive(Debug)]