mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
style: Track the visited-handling-mode on the MatchingContext.
Instead of on the stack. This fixes bugs where we're not passing the value around correctly, like from ::-moz-any. This is a fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1431539.
This commit is contained in:
parent
e4f08ee2bb
commit
8e25c9e674
8 changed files with 50 additions and 52 deletions
|
@ -1997,7 +1997,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
&self,
|
||||
pseudo_class: &NonTSPseudoClass,
|
||||
context: &mut MatchingContext<Self::Impl>,
|
||||
visited_handling: VisitedHandlingMode,
|
||||
flags_setter: &mut F,
|
||||
) -> bool
|
||||
where
|
||||
|
@ -2057,10 +2056,10 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
|||
},
|
||||
NonTSPseudoClass::AnyLink => self.is_link(),
|
||||
NonTSPseudoClass::Link => {
|
||||
self.is_link() && visited_handling.matches_unvisited()
|
||||
self.is_link() && context.visited_handling().matches_unvisited()
|
||||
}
|
||||
NonTSPseudoClass::Visited => {
|
||||
self.is_link() && visited_handling.matches_visited()
|
||||
self.is_link() && context.visited_handling().matches_visited()
|
||||
}
|
||||
NonTSPseudoClass::MozFirstNode => {
|
||||
flags_setter(self, ElementSelectorFlags::HAS_EDGE_CHILD_SELECTOR);
|
||||
|
|
|
@ -11,7 +11,6 @@ use element_state::ElementState;
|
|||
use selector_parser::{NonTSPseudoClass, PseudoElement, SelectorImpl, Snapshot, SnapshotMap, AttrValue};
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::context::VisitedHandlingMode;
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext};
|
||||
use std::cell::Cell;
|
||||
use std::fmt;
|
||||
|
@ -150,7 +149,6 @@ impl<'a, E> Element for ElementWrapper<'a, E>
|
|||
&self,
|
||||
pseudo_class: &NonTSPseudoClass,
|
||||
context: &mut MatchingContext<Self::Impl>,
|
||||
visited_handling: VisitedHandlingMode,
|
||||
_setter: &mut F,
|
||||
) -> bool
|
||||
where
|
||||
|
@ -198,10 +196,10 @@ impl<'a, E> Element for ElementWrapper<'a, E>
|
|||
// Instead, we use the `visited_handling` to determine if they
|
||||
// match.
|
||||
NonTSPseudoClass::Link => {
|
||||
return self.is_link() && visited_handling.matches_unvisited()
|
||||
return self.is_link() && context.visited_handling().matches_unvisited()
|
||||
}
|
||||
NonTSPseudoClass::Visited => {
|
||||
return self.is_link() && visited_handling.matches_visited()
|
||||
return self.is_link() && context.visited_handling().matches_visited()
|
||||
}
|
||||
|
||||
#[cfg(feature = "gecko")]
|
||||
|
@ -236,7 +234,6 @@ impl<'a, E> Element for ElementWrapper<'a, E>
|
|||
return self.element.match_non_ts_pseudo_class(
|
||||
pseudo_class,
|
||||
context,
|
||||
visited_handling,
|
||||
&mut |_, _| {},
|
||||
)
|
||||
}
|
||||
|
@ -246,7 +243,6 @@ impl<'a, E> Element for ElementWrapper<'a, E>
|
|||
self.element.match_non_ts_pseudo_class(
|
||||
pseudo_class,
|
||||
context,
|
||||
visited_handling,
|
||||
&mut |_, _| {},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1246,7 +1246,7 @@ impl Stylist {
|
|||
// Step 2: Presentational hints.
|
||||
let length_before_preshints = applicable_declarations.len();
|
||||
element.synthesize_presentational_hints_for_legacy_attributes(
|
||||
context.visited_handling,
|
||||
context.visited_handling(),
|
||||
applicable_declarations
|
||||
);
|
||||
if applicable_declarations.len() != length_before_preshints {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue