Bug 1428982 - Skip the rules of anonymous boxes that use something other than a universal selector.
MozReview-Commit-ID: 15RhR4e02Mw
--- a/servo/components/style/stylist.rs
+++ b/servo/components/style/stylist.rs
@@ -2012,17 +2012,23 @@ impl CascadeData {
let style_rule = locked.read_with(&guard);
self.num_declarations +=
style_rule.block.read_with(&guard).len();
for selector in &style_rule.selectors.0 {
self.num_selectors += 1;
let map = match selector.pseudo_element() {
Some(pseudo) if pseudo.is_precomputed() => {
- debug_assert!(selector.is_universal());
+
+ // We don't allow anonymous boxes to use some selector other than a
+ // universal selector.
+ if !selector.is_universal() {
+ continue;
+ }
+
debug_assert!(matches!(origin, Origin::UserAgent));
precomputed_pseudo_element_decls
.as_mut()
.expect("Expected precomputed declarations for the UA level")
.get_or_insert_with(&pseudo.canonical(), Vec::new)
.push(ApplicableDeclarationBlock::new(
StyleSource::Style(locked.clone()),