Fix dynamic restyling that changes whether our element may generate a pseudo to clear out stale pseudo styles.

Gecko bug 1324618 part 1: https://bugzilla.mozilla.org/show_bug.cgi?id=1324618
This commit is contained in:
Boris Zbarsky 2017-06-26 23:23:04 -07:00
parent 4b99a75508
commit acb27de71c

View file

@ -1202,6 +1202,14 @@ 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| {
// 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()) {
let bloom_filter = context.thread_local.bloom_filter.filter();
let mut matching_context =
@ -1210,18 +1218,6 @@ pub trait MatchMethods : TElement {
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;
}
{
let map = &mut context.thread_local.selector_flags;
let mut set_selector_flags = |element: &Self, flags: ElementSelectorFlags| {
self.apply_selector_flags(map, element, flags);