From 2bfca9cace31e034d8f5010239311875ae300f92 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 15 Oct 2015 14:26:20 +0200 Subject: [PATCH] Remove the boolean shareable flag in RecalcStyleForNode::process. --- components/layout/traversal.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 339ec420486..67e480e0726 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -181,20 +181,24 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> { StyleSharingResult::CannotShare => { let mut applicable_declarations = ApplicableDeclarations::new(); - let shareable = match node.as_element() { + let shareable_element = match node.as_element() { Some(element) => { // Perform the CSS selector matching. let stylist = unsafe { &*self.layout_context.shared.stylist }; - element.match_element(stylist, - Some(&*bf), - &mut applicable_declarations) + if element.match_element(stylist, + Some(&*bf), + &mut applicable_declarations) { + Some(element) + } else { + None + } }, None => { if node.has_changed() { ThreadSafeLayoutNode::new(&node).set_restyle_damage( incremental::rebuild_and_reflow()) } - false + None }, }; @@ -208,10 +212,8 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> { } // Add ourselves to the LRU cache. - if shareable { - if let Some(element) = node.as_element() { - style_sharing_candidate_cache.insert_if_possible(&element); - } + if let Some(element) = shareable_element { + style_sharing_candidate_cache.insert_if_possible(&element); } } StyleSharingResult::StyleWasShared(index, damage) => {