From 604601f1f46cb23008a759f85b71d9352866a237 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 15 Oct 2015 11:25:07 +0200 Subject: [PATCH] Return the result from match_element rather than using an outparam. --- components/layout/css/matching.rs | 14 +++++++------- components/layout/traversal.rs | 7 +++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 2e05046b089..71aa44147be 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -375,8 +375,8 @@ pub trait ElementMatchMethods { fn match_element(&self, stylist: &Stylist, parent_bf: Option<&BloomFilter>, - applicable_declarations: &mut ApplicableDeclarations, - shareable: &mut bool); + applicable_declarations: &mut ApplicableDeclarations) + -> bool; } pub trait MatchMethods { @@ -549,8 +549,8 @@ impl<'ln> ElementMatchMethods for LayoutElement<'ln> { fn match_element(&self, stylist: &Stylist, parent_bf: Option<&BloomFilter>, - applicable_declarations: &mut ApplicableDeclarations, - shareable: &mut bool) { + applicable_declarations: &mut ApplicableDeclarations) + -> bool { let style_attribute = self.style_attribute().as_ref(); applicable_declarations.normal_shareable = @@ -570,9 +570,9 @@ impl<'ln> ElementMatchMethods for LayoutElement<'ln> { Some(PseudoElement::After), &mut applicable_declarations.after); - *shareable = applicable_declarations.normal_shareable && - applicable_declarations.before.is_empty() && - applicable_declarations.after.is_empty() + applicable_declarations.normal_shareable && + applicable_declarations.before.is_empty() && + applicable_declarations.after.is_empty() } } diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 1b0c3782e75..a190707a8a5 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -177,10 +177,9 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> { if let Some(element) = node.as_element() { // Perform the CSS selector matching. let stylist = unsafe { &*self.layout_context.shared.stylist }; - element.match_element(stylist, - Some(&*bf), - &mut applicable_declarations, - &mut shareable); + shareable = element.match_element(stylist, + Some(&*bf), + &mut applicable_declarations); } else if node.has_changed() { ThreadSafeLayoutNode::new(&node).set_restyle_damage( incremental::rebuild_and_reflow())