mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Bug 1329854 - Avoid propagating the dirty descendants bit when appending items to display:none subtrees. r=heycam
This commit is contained in:
parent
22ae06258a
commit
e29cd8f532
1 changed files with 13 additions and 0 deletions
|
@ -418,6 +418,19 @@ pub fn recalc_style_at<E, D>(traversal: &D,
|
||||||
(element.has_dirty_descendants() || !propagated_hint.is_empty() || inherited_style_changed) {
|
(element.has_dirty_descendants() || !propagated_hint.is_empty() || inherited_style_changed) {
|
||||||
preprocess_children(traversal, element, propagated_hint, 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
|
// Computes style, returning true if the inherited styles changed for this
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue