aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2016-06-13 13:49:41 +0100
committerMs2ger <Ms2ger@gmail.com>2016-06-13 15:11:21 +0100
commitae5cb0ceb0a9f05cbc302fe61394a28c35fcc7e9 (patch)
tree25bfecc0bfa7f2bcbafca1d83372f226959c2dce /components
parente32b2c9ddf7f6c44057812d7840e2e93ce5eb7bd (diff)
downloadservo-ae5cb0ceb0a9f05cbc302fe61394a28c35fcc7e9.tar.gz
servo-ae5cb0ceb0a9f05cbc302fe61394a28c35fcc7e9.zip
Move the TNode::initialize_data() call from recalc_style_at to its callers.
This will allow us to make it an inherent method.
Diffstat (limited to 'components')
-rw-r--r--components/layout/traversal.rs9
-rw-r--r--components/style/traversal.rs6
2 files changed, 8 insertions, 7 deletions
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 692d956f000..bd07e1f72bb 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -65,7 +65,14 @@ impl<'lc, 'ln> DomTraversalContext<ServoLayoutNode<'ln>> for RecalcStyleAndConst
}
}
- fn process_preorder(&self, node: ServoLayoutNode<'ln>) { recalc_style_at(&self.context, self.root, node); }
+ fn process_preorder(&self, node: ServoLayoutNode<'ln>) {
+ // FIXME(pcwalton): Stop allocating here. Ideally this should just be done by the HTML
+ // parser.
+ node.initialize_data();
+
+ recalc_style_at(&self.context, self.root, node);
+ }
+
fn process_postorder(&self, node: ServoLayoutNode<'ln>) { construct_flows_at(&self.context, self.root, node); }
}
diff --git a/components/style/traversal.rs b/components/style/traversal.rs
index 386af02e5ef..1afdcbb34c7 100644
--- a/components/style/traversal.rs
+++ b/components/style/traversal.rs
@@ -125,12 +125,6 @@ pub fn recalc_style_at<'a, N, C>(context: &'a C,
where N: TNode,
C: StyleContext<'a, <N::ConcreteElement as Element>::Impl>,
<N::ConcreteElement as Element>::Impl: SelectorImplExt<ComputedValues=N::ConcreteComputedValues> + 'a {
- // Initialize layout data.
- //
- // FIXME(pcwalton): Stop allocating here. Ideally this should just be done by the HTML
- // parser.
- node.initialize_data();
-
// Get the parent node.
let parent_opt = match node.parent_node() {
Some(parent) if parent.is_element() => Some(parent),