mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Implement "handled for descendants" tracking for RestyleDamage.
MozReview-Commit-ID: Bbk99ogILXC
This commit is contained in:
parent
1afae52c47
commit
d9606a4fae
6 changed files with 135 additions and 23 deletions
|
@ -455,7 +455,10 @@ pub fn recalc_style_at<E, D>(traversal: &D,
|
|||
// Preprocess children, propagating restyle hints and handling sibling relationships.
|
||||
if traversal.should_traverse_children(&mut context.thread_local, element, &data, DontLog) &&
|
||||
(element.has_dirty_descendants() || !propagated_hint.is_empty() || inherited_style_changed) {
|
||||
preprocess_children(traversal, element, propagated_hint, inherited_style_changed);
|
||||
let damage_handled = data.get_restyle().map_or(RestyleDamage::empty(), |r| {
|
||||
r.damage_handled() | r.damage.handled_for_descendants()
|
||||
});
|
||||
preprocess_children(traversal, element, propagated_hint, damage_handled, inherited_style_changed);
|
||||
}
|
||||
|
||||
// Make sure the dirty descendants bit is not set for the root of a
|
||||
|
@ -557,6 +560,7 @@ fn compute_style<E, D>(_traversal: &D,
|
|||
fn preprocess_children<E, D>(traversal: &D,
|
||||
element: E,
|
||||
mut propagated_hint: StoredRestyleHint,
|
||||
damage_handled: RestyleDamage,
|
||||
parent_inherited_style_changed: bool)
|
||||
where E: TElement,
|
||||
D: DomTraversal<E>
|
||||
|
@ -580,8 +584,7 @@ fn preprocess_children<E, D>(traversal: &D,
|
|||
// any reason to create one, avoid the useless allocation and move on to
|
||||
// the next child.
|
||||
if propagated_hint.is_empty() && !parent_inherited_style_changed &&
|
||||
!child_data.has_restyle()
|
||||
{
|
||||
damage_handled.is_empty() && !child_data.has_restyle() {
|
||||
continue;
|
||||
}
|
||||
let mut restyle_data = child_data.ensure_restyle();
|
||||
|
@ -598,6 +601,9 @@ fn preprocess_children<E, D>(traversal: &D,
|
|||
propagated_hint.insert(&(RESTYLE_SELF | RESTYLE_DESCENDANTS).into());
|
||||
}
|
||||
|
||||
// Store the damage already handled by ancestors.
|
||||
restyle_data.set_damage_handled(damage_handled);
|
||||
|
||||
// If properties that we inherited from the parent changed, we need to recascade.
|
||||
//
|
||||
// FIXME(bholley): Need to handle explicitly-inherited reset properties somewhere.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue