diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-07-09 13:08:56 +0200 |
---|---|---|
committer | Ms2ger <Ms2ger@gmail.com> | 2015-10-26 17:51:26 +0100 |
commit | 9f919844156e526aaaf4400c10fa115ce997191d (patch) | |
tree | 8cac51711ec736f31f82efdb76372e9bc01f447f /components/layout/traversal.rs | |
parent | f6e3146de248554607790108680a43844dff70bf (diff) | |
download | servo-9f919844156e526aaaf4400c10fa115ce997191d.tar.gz servo-9f919844156e526aaaf4400c10fa115ce997191d.zip |
Use the passed-in reflow root rather than the one stored in the SharedLayoutContext.
Diffstat (limited to 'components/layout/traversal.rs')
-rw-r--r-- | components/layout/traversal.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 0ed6a2cd32f..d833c240d63 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -9,6 +9,7 @@ use context::LayoutContext; use css::matching::{ApplicableDeclarations, ElementMatchMethods, MatchMethods, StyleSharingResult}; use flow::{MutableFlowUtils, PostorderFlowTraversal, PreorderFlowTraversal}; use flow::{self, Flow}; +use gfx::display_list::OpaqueNode; use incremental::{self, BUBBLE_ISIZES, REFLOW, REFLOW_OUT_OF_FLOW, RestyleDamage}; use script::layout_interface::ReflowGoal; use selectors::bloom::BloomFilter; @@ -50,7 +51,9 @@ thread_local!( /// /// If one does not exist, a new one will be made for you. If it is out of date, /// it will be cleared and reused. -fn take_task_local_bloom_filter(parent_node: Option<LayoutNode>, layout_context: &LayoutContext) +fn take_task_local_bloom_filter(parent_node: Option<LayoutNode>, + root: OpaqueNode, + layout_context: &LayoutContext) -> Box<BloomFilter> { STYLE_BLOOM.with(|style_bloom| { match (parent_node, style_bloom.borrow_mut().take()) { @@ -62,7 +65,7 @@ fn take_task_local_bloom_filter(parent_node: Option<LayoutNode>, layout_context: // No bloom filter for this thread yet. (Some(parent), None) => { let mut bloom_filter = box BloomFilter::new(); - insert_ancestors_into_bloom_filter(&mut bloom_filter, parent, layout_context); + insert_ancestors_into_bloom_filter(&mut bloom_filter, parent, root); bloom_filter } // Found cached bloom filter. @@ -75,7 +78,7 @@ fn take_task_local_bloom_filter(parent_node: Option<LayoutNode>, layout_context: // Oh no. the cached parent is stale. I guess we need a new one. Reuse the existing // allocation to avoid malloc churn. bloom_filter.clear(); - insert_ancestors_into_bloom_filter(&mut bloom_filter, parent, layout_context); + insert_ancestors_into_bloom_filter(&mut bloom_filter, parent, root); } bloom_filter }, @@ -96,14 +99,14 @@ fn put_task_local_bloom_filter(bf: Box<BloomFilter>, /// "Ancestors" in this context is inclusive of ourselves. fn insert_ancestors_into_bloom_filter(bf: &mut Box<BloomFilter>, mut n: LayoutNode, - layout_context: &LayoutContext) { + root: OpaqueNode) { debug!("[{}] Inserting ancestors.", tid()); let mut ancestors = 0; loop { ancestors += 1; n.insert_into_bloom_filter(&mut **bf); - n = match n.layout_parent_node(layout_context.shared) { + n = match n.layout_parent_node(root) { None => break, Some(p) => p, }; @@ -135,6 +138,7 @@ pub trait PostorderNodeMutTraversal { #[derive(Copy, Clone)] pub struct RecalcStyleForNode<'a> { pub layout_context: &'a LayoutContext<'a>, + pub root: OpaqueNode, } impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> { @@ -148,10 +152,10 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> { node.initialize_layout_data(); // Get the parent node. - let parent_opt = node.layout_parent_node(self.layout_context.shared); + let parent_opt = node.layout_parent_node(self.root); // Get the style bloom filter. - let mut bf = take_task_local_bloom_filter(parent_opt, self.layout_context); + let mut bf = take_task_local_bloom_filter(parent_opt, self.root, self.layout_context); let nonincremental_layout = opts::get().nonincremental_layout; if nonincremental_layout || node.is_dirty() { @@ -239,6 +243,7 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> { #[derive(Copy, Clone)] pub struct ConstructFlows<'a> { pub layout_context: &'a LayoutContext<'a>, + pub root: OpaqueNode, } impl<'a> PostorderDomTraversal for ConstructFlows<'a> { @@ -283,7 +288,7 @@ impl<'a> PostorderDomTraversal for ConstructFlows<'a> { assert_eq!(old_node, unsafe_layout_node); assert_eq!(old_generation, self.layout_context.shared.generation); - match node.layout_parent_node(self.layout_context.shared) { + match node.layout_parent_node(self.root) { None => { debug!("[{}] - {:X}, and deleting BF.", tid(), unsafe_layout_node.0); // If this is the reflow root, eat the task-local bloom filter. |