Bug 1428982 - Skip the rules of anonymous boxes that use something other than a universal selector. draft
authorKuoE0 <kuoe0.tw@gmail.com>
Tue, 09 Jan 2018 16:37:15 +0800
changeset 717555 9a128320f8e9b5b9ea8cfbec7effc48ff32faea4
parent 717554 9cd55e3acae4a91370102e0b4282280d92b93d12
child 745301 2ccee308c7069d13c646dde3bb8c97a581275649
push id94727
push userbmo:kuoe0@mozilla.com
push dateTue, 09 Jan 2018 08:38:25 +0000
bugs1428982
milestone59.0a1
Bug 1428982 - Skip the rules of anonymous boxes that use something other than a universal selector. MozReview-Commit-ID: 15RhR4e02Mw
servo/components/style/stylist.rs
--- 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()),