Skip to content

Commit

Permalink
Bug 1329854 - Avoid propagating the dirty descendants bit when append…
Browse files Browse the repository at this point in the history
…ing items to display:none subtrees. r=heycam
  • Loading branch information
bholley committed Jan 13, 2017
1 parent 22ae062 commit e29cd8f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions components/style/traversal.rs
Expand Up @@ -418,6 +418,19 @@ pub fn recalc_style_at<E, D>(traversal: &D,
(element.has_dirty_descendants() || !propagated_hint.is_empty() || inherited_style_changed) {
preprocess_children(traversal, element, propagated_hint, inherited_style_changed);
}

// Make sure the dirty descendants bit is not set for the root of a
// display:none subtree, even if the style didn't change (since, if
// the style did change, we'd have already cleared it in compute_style).
//
// This keeps the tree in a valid state without requiring the DOM to
// check display:none on the parent when inserting new children (which
// can be moderately expensive). Instead, DOM implementations can
// unconditionally set the dirty descendants bit on any styled parent,
// and let the traversal sort it out.
if data.styles().is_display_none() {
unsafe { element.unset_dirty_descendants(); }
}
}

// Computes style, returning true if the inherited styles changed for this
Expand Down

0 comments on commit e29cd8f

Please sign in to comment.