Match and cascade visited styles

To support visited styles, we match and cascade a separate set of styles any
time we notice that an element has a relevant link.

The visited rules and values are held in `ComputedStyle` alongside the
regular rules and values, which simplifies supporting various APIs like
`cascade_primary_and_pseudos` which expect easy access to previously matched
rules.

To simplify passing the additional values around, an additional reference to the
visited `ComputedValues` is placed inside the regular `ComputedValues`.

MozReview-Commit-ID: 2ebbjcfkfWf
This commit is contained in:
J. Ryan Stinnett 2017-05-04 18:54:20 -05:00
parent e3a256803d
commit a7882cfeb9
9 changed files with 621 additions and 141 deletions

View file

@ -475,6 +475,8 @@ fn compute_style_for_animation_step(context: &SharedStyleContext,
guard.declarations().iter().rev().map(|&(ref decl, _importance)| decl)
};
// This currently ignores visited styles, which seems acceptable,
// as existing browsers don't appear to animate visited styles.
let computed =
properties::apply_declarations(context.stylist.device(),
/* is_root = */ false,
@ -482,6 +484,7 @@ fn compute_style_for_animation_step(context: &SharedStyleContext,
previous_style,
previous_style,
/* cascade_info = */ None,
/* visited_style = */ None,
&*context.error_reporter,
font_metrics_provider,
CascadeFlags::empty(),