Auto merge of #16159 - bholley:note_dirty_descendants, r=heycam

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.

Reviewed in https://bugzilla.mozilla.org/show_bug.cgi?id=1350441

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16159)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-03-29 06:52:07 -05:00 committed by GitHub
commit 8adf191973
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;
@ -387,7 +387,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