mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Implement :visited handling for lazy pseudo-elements in stylo.
Part 2 of the fix for Gecko bug 1364242: https://bugzilla.mozilla.org/show_bug.cgi?id=1364242
This commit is contained in:
parent
351c7f7859
commit
52d1b59515
5 changed files with 134 additions and 47 deletions
|
@ -166,7 +166,7 @@ impl CascadeVisitedMode {
|
|||
/// Returns the computed values based on the cascade mode. In visited mode,
|
||||
/// visited values are only returned if they already exist. If they don't,
|
||||
/// we fallback to the regular, unvisited styles.
|
||||
fn values<'a>(&self, values: &'a Arc<ComputedValues>) -> &'a Arc<ComputedValues> {
|
||||
pub fn values<'a>(&self, values: &'a Arc<ComputedValues>) -> &'a Arc<ComputedValues> {
|
||||
if *self == CascadeVisitedMode::Visited && values.get_visited_style().is_some() {
|
||||
return values.visited_style();
|
||||
}
|
||||
|
@ -1211,8 +1211,10 @@ 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.)
|
||||
// For eager pseudo-elements, we only try to match visited rules if
|
||||
// there are also unvisited rules. (This matches Gecko's behavior
|
||||
// for probing pseudo-elements, and for eager pseudo-elements Gecko
|
||||
// does not try to resolve style if the probe says there isn't any.)
|
||||
if visited_handling == VisitedHandlingMode::RelevantLinkVisited &&
|
||||
!context.cascade_inputs().pseudos.has(&pseudo) {
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue