Bug 1336646 - Use the bloom filter for manual style resolves and pass a mutable StyleContext into match_element. r=emilio

We need to do something here to avoid a double-borrow when passing a mutable
StyleContext to match_element. After some discussion on IRC, we decided that
building the bloom filter for this case is probably worthwhile.
This commit is contained in:
Bobby Holley 2017-02-06 12:57:25 -08:00
parent 8aec1ccdd2
commit e7a8f5ec30
3 changed files with 35 additions and 15 deletions

View file

@ -577,8 +577,7 @@ impl<E: TElement> PrivateMatchMethods for E {}
pub trait MatchMethods : TElement {
/// Runs selector matching of this element, and returns the result.
fn match_element(&self,
context: &StyleContext<Self>,
parent_bf: Option<&BloomFilter>)
context: &mut StyleContext<Self>)
-> MatchResults
{
let mut applicable_declarations =
@ -591,7 +590,7 @@ pub trait MatchMethods : TElement {
// Compute the primary rule node.
let mut primary_relations =
stylist.push_applicable_declarations(self,
parent_bf,
Some(context.thread_local.bloom_filter.filter()),
style_attribute,
animation_rules,
None,
@ -604,8 +603,9 @@ pub trait MatchMethods : TElement {
SelectorImpl::each_eagerly_cascaded_pseudo_element(|pseudo| {
debug_assert!(applicable_declarations.is_empty());
let pseudo_animation_rules = self.get_animation_rules(Some(&pseudo));
stylist.push_applicable_declarations(self, parent_bf, None,
pseudo_animation_rules,
stylist.push_applicable_declarations(self,
Some(context.thread_local.bloom_filter.filter()),
None, pseudo_animation_rules,
Some(&pseudo),
&mut applicable_declarations,
MatchingReason::ForStyling);