style: Do not optimize out lazy pseudo rules if the main stylist doesn't have rules for it.

This could prevent an XBL binding to use some pseudo-elements fairly randomly.

MozReview-Commit-ID: b44DO8qcfD
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2017-09-27 13:27:01 +02:00
parent 1162aed4e5
commit d82e6926fc
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -964,12 +964,6 @@ impl Stylist {
) )
} }
fn has_rules_for_pseudo(&self, pseudo: &PseudoElement) -> bool {
self.cascade_data
.iter_origins()
.any(|(d, _)| d.has_rules_for_pseudo(pseudo))
}
/// Computes the cascade inputs for a lazily-cascaded pseudo-element. /// Computes the cascade inputs for a lazily-cascaded pseudo-element.
/// ///
/// See the documentation on lazy pseudo-elements in /// See the documentation on lazy pseudo-elements in
@ -988,10 +982,6 @@ impl Stylist {
let pseudo = pseudo.canonical(); let pseudo = pseudo.canonical();
debug_assert!(pseudo.is_lazy()); debug_assert!(pseudo.is_lazy());
if !self.has_rules_for_pseudo(&pseudo) {
return CascadeInputs::default()
}
// Apply the selector flags. We should be in sequential mode // Apply the selector flags. We should be in sequential mode
// already, so we can directly apply the parent flags. // already, so we can directly apply the parent flags.
let mut set_selector_flags = |element: &E, flags: ElementSelectorFlags| { let mut set_selector_flags = |element: &E, flags: ElementSelectorFlags| {
@ -2195,10 +2185,6 @@ impl CascadeData {
} }
} }
fn has_rules_for_pseudo(&self, pseudo: &PseudoElement) -> bool {
self.pseudos_map.get(pseudo).is_some()
}
/// Clears the cascade data, but not the invalidation data. /// Clears the cascade data, but not the invalidation data.
fn clear_cascade_data(&mut self) { fn clear_cascade_data(&mut self) {
self.element_map.clear(); self.element_map.clear();