From 04d2db5747ce85b5ee7f9cbc9f6d13e523c68a76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 13 Feb 2016 13:31:38 +0100 Subject: [PATCH] layout: Stop parameterizing on N for RecalcStyleAndConstructFlows This is unfortunate, but making that useful would require parameterizing `SharedLayoutContext` and `LayoutContext` depending on the `SelectorImpl` (which is a **huge** work right now). Probably the easier way to do it, and probably the one that keeps the layout code more legible, and since there won't be multiple implementations at the same compilation unit, would be "defining" a default implementation for layout via feature flags. That should allow us to remove the components/style/servo.rs file. --- components/layout/traversal.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index d5febecc483..35269529352 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -16,20 +16,18 @@ use incremental::{BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, REPAINT, RestyleDam use std::mem; use style::context::{StyleContext, ReflowGoal}; use style::matching::MatchMethods; -use style::selector_impl::ServoSelectorImpl; use style::traversal::{DomTraversalContext, STYLE_BLOOM}; use style::traversal::{put_thread_local_bloom_filter, recalc_style_at}; use util::opts; use util::tid::tid; -use wrapper::{LayoutNode, ThreadSafeLayoutNode}; +use wrapper::{LayoutNode, ServoLayoutNode, ThreadSafeLayoutNode}; pub struct RecalcStyleAndConstructFlows<'lc> { context: LayoutContext<'lc>, root: OpaqueNode, } -impl<'lc, 'ln, N: LayoutNode<'ln>> DomTraversalContext<'ln, N> for RecalcStyleAndConstructFlows<'lc> - where N::ConcreteElement: ::selectors::Element { +impl<'lc, 'ln> DomTraversalContext<'ln, ServoLayoutNode<'ln>> for RecalcStyleAndConstructFlows<'lc> { type SharedContext = SharedLayoutContext; #[allow(unsafe_code)] fn new<'a>(shared: &'a Self::SharedContext, root: OpaqueNode) -> Self { @@ -69,8 +67,8 @@ impl<'lc, 'ln, N: LayoutNode<'ln>> DomTraversalContext<'ln, N> for RecalcStyleAn } } - fn process_preorder(&self, node: N) { recalc_style_at(&self.context, self.root, node); } - fn process_postorder(&self, node: N) { construct_flows_at(&self.context, self.root, node); } + fn process_preorder(&self, node: ServoLayoutNode<'ln>) { recalc_style_at(&self.context, self.root, node); } + fn process_postorder(&self, node: ServoLayoutNode<'ln>) { construct_flows_at(&self.context, self.root, node); } } /// A bottom-up, parallelizable traversal.