mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Don't let restyle damage infect siblings
Currently `compute_layout_damage` does the following for each child of the node it's processing. 1. Update the child with damage from the parent. 2. Update the parent with damage from the child. When these steps are repeated for the next child, the parent's damage may include flags that came from its previous sibling(s). This means that damage ends up propagating to later siblings, and not just between parents and children as indended. This patch propagates the same damage to all children, not including any damage from their siblings.
This commit is contained in:
parent
0baf665721
commit
dff1de46b2
1 changed files with 6 additions and 4 deletions
|
@ -274,12 +274,14 @@ impl<'a> LayoutDamageComputation for &'a mut Flow {
|
|||
|
||||
{
|
||||
let self_base = flow::mut_base(self);
|
||||
// Take a snapshot of the parent damage before updating it with damage from children.
|
||||
let parent_damage = self_base.restyle_damage;
|
||||
|
||||
for kid in self_base.children.iter_mut() {
|
||||
let child_is_absolutely_positioned =
|
||||
flow::base(kid).flags.contains(IS_ABSOLUTELY_POSITIONED);
|
||||
flow::mut_base(kid).restyle_damage
|
||||
.insert(self_base.restyle_damage.damage_for_child(
|
||||
is_absolutely_positioned,
|
||||
flow::mut_base(kid).restyle_damage.insert(
|
||||
parent_damage.damage_for_child(is_absolutely_positioned,
|
||||
child_is_absolutely_positioned));
|
||||
{
|
||||
let kid: &mut Flow = kid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue