Bug 1345699 - stylo: Always re-cascade in native anonymous subtrees. r?emilio draft
authorCameron McCormack <cam@mcc.id.au>
Mon, 05 Jun 2017 16:25:44 +0800
changeset 588872 9bae91e0a9e5aa896a6bb7ecf2a38375f49c4f1e
parent 588783 8a3aa1701537ea6b8334f432cd030d260d492fa3
child 631712 9d9d9a8c28796b7ba86314c4d0d35f793caf7fe2
push id62191
push userbmo:cam@mcc.id.au
push dateMon, 05 Jun 2017 08:26:39 +0000
reviewersemilio
bugs1345699
milestone55.0a1
Bug 1345699 - stylo: Always re-cascade in native anonymous subtrees. r?emilio MozReview-Commit-ID: E1PhDnGkNIA
servo/components/style/traversal.rs
--- a/servo/components/style/traversal.rs
+++ b/servo/components/style/traversal.rs
@@ -694,16 +694,22 @@ pub fn recalc_style_at<E, D>(traversal: 
         // data in the subtree, notify the caller to early-return.
         if data.styles().is_display_none() {
             debug!("{:?} style is display:none - clearing data from descendants.",
                    element);
             clear_descendant_data(element, &|e| unsafe { D::clear_element_data(&e) });
         }
     }
 
+    // We must always cascade native anonymous subtrees, since they inherit styles
+    // from their first non-NAC ancestor.
+    if element.is_native_anonymous() {
+        cascade_hint |= RECASCADE_SELF;
+    }
+
     // Now that matching and cascading is done, clear the bits corresponding to
     // those operations and compute the propagated restyle hint.
     let mut propagated_hint = match data.get_restyle_mut() {
         None => StoredRestyleHint::empty(),
         Some(r) => {
             debug_assert!(context.shared.traversal_flags.for_animation_only() ||
                           !r.hint.has_animation_hint(),
                           "animation restyle hint should be handled during \