diff options
author | Matt Brubeck <mbrubeck@limpet.net> | 2016-05-05 15:54:42 -0700 |
---|---|---|
committer | Matt Brubeck <mbrubeck@limpet.net> | 2016-05-05 16:06:27 -0700 |
commit | dff1de46b2e54a3339cf9d8e354295929879a4a8 (patch) | |
tree | 7469b677a2871ee9fb8b99b76d22580d4fd969e2 /components/layout/incremental.rs | |
parent | 0baf665721c74b03c879a14f2fafc24a5dc6dda6 (diff) | |
download | servo-dff1de46b2e54a3339cf9d8e354295929879a4a8.tar.gz servo-dff1de46b2e54a3339cf9d8e354295929879a4a8.zip |
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.
Diffstat (limited to 'components/layout/incremental.rs')
-rw-r--r-- | components/layout/incremental.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs index e8cf8e4c500..9670028cfa3 100644 --- a/components/layout/incremental.rs +++ b/components/layout/incremental.rs @@ -274,13 +274,15 @@ 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, - 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; special_damage.insert(kid.compute_layout_damage()); |