From 843629b29f5c751324ae9296219ea0113eda645a Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 15 Oct 2015 14:19:27 +0200 Subject: [PATCH] Remove the unused boolean in StyleSharingResult::CannotShare. --- components/layout/css/matching.rs | 13 ++++++------- components/layout/traversal.rs | 30 ++++++++++++++++++------------ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs index 281d3e77438..76a25671546 100644 --- a/components/layout/css/matching.rs +++ b/components/layout/css/matching.rs @@ -363,9 +363,8 @@ impl StyleSharingCandidateCache { /// The results of attempting to share a style. pub enum StyleSharingResult { - /// We didn't find anybody to share the style with. The boolean indicates whether the style - /// is shareable at all. - CannotShare(bool), + /// We didn't find anybody to share the style with. + CannotShare, /// The node's style can be shared. The integer specifies the index in the LRU cache that was /// hit and the damage that was done. StyleWasShared(usize, RestyleDamage), @@ -581,14 +580,14 @@ impl<'ln> ElementMatchMethods for LayoutElement<'ln> { parent: Option) -> StyleSharingResult { if opts::get().disable_share_style_cache { - return StyleSharingResult::CannotShare(false) + return StyleSharingResult::CannotShare } if self.style_attribute().is_some() { - return StyleSharingResult::CannotShare(false) + return StyleSharingResult::CannotShare } if self.get_attr(&ns!(""), &atom!("id")).is_some() { - return StyleSharingResult::CannotShare(false) + return StyleSharingResult::CannotShare } for (i, &(ref candidate, ())) in style_sharing_candidate_cache.iter().enumerate() { @@ -607,7 +606,7 @@ impl<'ln> ElementMatchMethods for LayoutElement<'ln> { } } - StyleSharingResult::CannotShare(true) + StyleSharingResult::CannotShare } } diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs index 8d9f8da07ca..339ec420486 100644 --- a/components/layout/traversal.rs +++ b/components/layout/traversal.rs @@ -173,24 +173,30 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> { parent_opt.clone()) } }, - None => StyleSharingResult::CannotShare(false), + None => StyleSharingResult::CannotShare, }; // Otherwise, match and cascade selectors. match sharing_result { - StyleSharingResult::CannotShare(mut shareable) => { + StyleSharingResult::CannotShare => { let mut applicable_declarations = ApplicableDeclarations::new(); - if let Some(element) = node.as_element() { - // Perform the CSS selector matching. - let stylist = unsafe { &*self.layout_context.shared.stylist }; - 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()) - } + let shareable = 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) + }, + None => { + if node.has_changed() { + ThreadSafeLayoutNode::new(&node).set_restyle_damage( + incremental::rebuild_and_reflow()) + } + false + }, + }; // Perform the CSS cascade. unsafe {