mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Properly handle -moz-any for revalidation selectors.
Note that, while the comment is correct that there is a fair amount of -moz-any usage in the UA sheet, it's always used as an ancestor selector, and thus ignored for our purposes. Nevertheless, it's straightforward enough to support properly, so we do that here. MozReview-Commit-ID: Kz1yNfPUIaP
This commit is contained in:
parent
6e413653e7
commit
f4d81b010b
3 changed files with 12 additions and 3 deletions
|
@ -342,6 +342,12 @@ impl NonTSPseudoClass {
|
|||
apply_non_ts_list!(pseudo_class_state)
|
||||
}
|
||||
|
||||
/// Returns true if the given pseudoclass should trigger style sharing cache revalidation.
|
||||
pub fn needs_cache_revalidation(&self) -> bool {
|
||||
self.state_flag().is_empty() &&
|
||||
!matches!(*self, NonTSPseudoClass::MozAny(_))
|
||||
}
|
||||
|
||||
/// Convert NonTSPseudoClass to Gecko's CSSPseudoClassType.
|
||||
pub fn to_gecko_pseudoclasstype(&self) -> Option<CSSPseudoClassType> {
|
||||
macro_rules! gecko_type {
|
||||
|
|
|
@ -235,6 +235,11 @@ impl NonTSPseudoClass {
|
|||
ServoNonZeroBorder => ElementState::empty(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if the given pseudoclass should trigger style sharing cache revalidation.
|
||||
pub fn needs_cache_revalidation(&self) -> bool {
|
||||
self.state_flag().is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
/// The abstract struct we implement the selector parser implementation on top
|
||||
|
|
|
@ -953,9 +953,7 @@ impl SelectorVisitor for RevalidationVisitor {
|
|||
Component::OnlyOfType => {
|
||||
false
|
||||
},
|
||||
// FIXME(emilio): This sets the "revalidation" flag for :any, which is
|
||||
// probably expensive given we use it a lot in UA sheets.
|
||||
Component::NonTSPseudoClass(ref p) if p.state_flag().is_empty() => {
|
||||
Component::NonTSPseudoClass(ref p) if p.needs_cache_revalidation() => {
|
||||
false
|
||||
},
|
||||
_ => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue