Skip to content

Commit

Permalink
Fix dynamic restyling that changes whether our element may generate a…
Browse files Browse the repository at this point in the history
… pseudo to clear out stale pseudo styles.

Gecko bug 1324618 part 1: https://bugzilla.mozilla.org/show_bug.cgi?id=1324618
  • Loading branch information
bzbarsky committed Jun 27, 2017
1 parent 4b99a75 commit acb27de
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions components/style/matching.rs
Expand Up @@ -1202,26 +1202,22 @@ pub trait MatchMethods : TElement {
// Compute rule nodes for eagerly-cascaded pseudo-elements.
let mut matches_different_pseudos = false;
SelectorImpl::each_eagerly_cascaded_pseudo_element(|pseudo| {
let bloom_filter = context.thread_local.bloom_filter.filter();

let mut matching_context =
MatchingContext::new_for_visited(MatchingMode::ForStatelessPseudoElement,
Some(bloom_filter),
visited_handling,
context.shared.quirks_mode);

// For pseudo-elements, we only try to match visited rules if there
// are also unvisited rules. (This matches Gecko's behavior.)
if visited_handling == VisitedHandlingMode::RelevantLinkVisited &&
!context.cascade_inputs().pseudos.has(&pseudo) {
return
}

if !self.may_generate_pseudo(&pseudo, data.styles.primary()) {
return;
}
if self.may_generate_pseudo(&pseudo, data.styles.primary()) {
let bloom_filter = context.thread_local.bloom_filter.filter();

let mut matching_context =
MatchingContext::new_for_visited(MatchingMode::ForStatelessPseudoElement,
Some(bloom_filter),
visited_handling,
context.shared.quirks_mode);

{
let map = &mut context.thread_local.selector_flags;
let mut set_selector_flags = |element: &Self, flags: ElementSelectorFlags| {
self.apply_selector_flags(map, element, flags);
Expand Down

0 comments on commit acb27de

Please sign in to comment.