style: Don't traverse children if the root of the restyle is display:none.

If we append a child to a display:none element, and we use StyleNewChildren on
that parent, we should skip restyling the children.
This commit is contained in:
Cameron McCormack 2017-04-04 19:22:42 +08:00
parent 63988b9103
commit 5fa9a56247

View file

@ -149,6 +149,12 @@ pub trait DomTraversal<E: TElement> : Sync {
-> PreTraverseToken
{
if traversal_flags.for_unstyled_children_only() {
if root.borrow_data().map_or(true, |d| d.has_styles() && d.styles().is_display_none()) {
return PreTraverseToken {
traverse: false,
unstyled_children_only: false,
};
}
return PreTraverseToken {
traverse: true,
unstyled_children_only: true,