Centralize note_dirty_descendants implementation, and fully propagate dirty_descendants in resolve_style.

The current code can leave the tree in an inconsistent state, with the dirty
descendants bit not fully propagated.

MozReview-Commit-ID: ALI6etmlrDa
This commit is contained in:
Bobby Holley 2017-03-24 14:17:53 -07:00
parent 185d31f086
commit 7c58483aff
4 changed files with 68 additions and 27 deletions

View file

@ -9,7 +9,7 @@
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
use context::{SharedStyleContext, StyleContext, ThreadLocalStyleContext};
use data::{ElementData, ElementStyles, StoredRestyleHint};
use dom::{NodeInfo, TElement, TNode};
use dom::{DirtyDescendants, NodeInfo, TElement, TNode};
use matching::{MatchMethods, MatchResults};
use restyle_hints::{RESTYLE_DESCENDANTS, RESTYLE_SELF};
use selector_parser::RestyleDamage;
@ -388,7 +388,7 @@ fn resolve_style_internal<E, F>(context: &mut StyleContext<E>,
// Conservatively mark us as having dirty descendants, since there might
// be other unstyled siblings we miss when walking straight up the parent
// chain.
unsafe { element.set_dirty_descendants() };
unsafe { element.note_descendants::<DirtyDescendants>() };
}
// If we're display:none and none of our ancestors are, we're the root