style: Add an AllLinksVisitedAndUnvisited for invalidation.

Otherwise, tests like the following fail, given we always match as unvisited,
and we'd never mark the link as needing invalidation.

<!doctype html>
<style>
a {
  color: red !important;
}

.foo :visited {
  color: green !important;
}
</style>
<div>
  <a href="https://google.es">visit me</a>
  <button onclick="this.parentNode.className = 'foo'">Then click me</button>
</div>

Bug: 1368240
MozReview-Commit-ID: LDv6S28c4ju
This commit is contained in:
Emilio Cobos Álvarez 2017-06-09 17:11:19 +02:00
parent fdf9093466
commit 4434509088
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
6 changed files with 42 additions and 2 deletions

View file

@ -420,8 +420,14 @@ impl<'a, 'b: 'a, E> TreeStyleInvalidator<'a, 'b, E>
debug!("TreeStyleInvalidator::process_invalidation({:?}, {:?})",
self.element, invalidation);
let mut context = MatchingContext::new(MatchingMode::Normal, None,
self.shared_context.quirks_mode);
let mut context =
MatchingContext::new_for_visited(
MatchingMode::Normal,
None,
VisitedHandlingMode::AllLinksVisitedAndUnvisited,
self.shared_context.quirks_mode,
);
let matching_result = matches_compound_selector(
&invalidation.selector,
invalidation.offset,