diff options
author | Bobby Holley <bobbyholley@gmail.com> | 2017-08-14 16:55:20 -0700 |
---|---|---|
committer | Bobby Holley <bobbyholley@gmail.com> | 2017-08-15 14:25:50 -0700 |
commit | 05a1b682bbbc0997069ac43ca38d43adf4f44789 (patch) | |
tree | 58d5845d882484a84f32243bf93ffe8d94a3fa97 /components | |
parent | 2e60b27a2186a8cba4b952960155dfcf3f47d7db (diff) | |
download | servo-05a1b682bbbc0997069ac43ca38d43adf4f44789.tar.gz servo-05a1b682bbbc0997069ac43ca38d43adf4f44789.zip |
Avoid leaving stale ANCESTOR_WAS_RECONSTRUCTED bits in the tree.
MozReview-Commit-ID: 76q5XxK2o2a
Diffstat (limited to 'components')
-rw-r--r-- | components/style/data.rs | 12 | ||||
-rw-r--r-- | components/style/traversal.rs | 10 |
2 files changed, 15 insertions, 7 deletions
diff --git a/components/style/data.rs b/components/style/data.rs index 096f09f00de..35f75b10b3d 100644 --- a/components/style/data.rs +++ b/components/style/data.rs @@ -106,10 +106,14 @@ impl RestyleData { } /// Sets the flag that tells us whether we've reconstructed an ancestor. - pub fn set_reconstructed_ancestor(&mut self) { - // If it weren't for animation-only traversals, we could assert - // `!self.reconstructed_ancestor()` here. - self.flags.insert(ANCESTOR_WAS_RECONSTRUCTED); + pub fn set_reconstructed_ancestor(&mut self, reconstructed: bool) { + if reconstructed { + // If it weren't for animation-only traversals, we could assert + // `!self.reconstructed_ancestor()` here. + self.flags.insert(ANCESTOR_WAS_RECONSTRUCTED); + } else { + self.flags.remove(ANCESTOR_WAS_RECONSTRUCTED); + } } /// Mark this element as restyled, which is useful to know whether we need diff --git a/components/style/traversal.rs b/components/style/traversal.rs index 546e254adf4..c6bf7e8ee39 100644 --- a/components/style/traversal.rs +++ b/components/style/traversal.rs @@ -170,6 +170,12 @@ pub trait DomTraversal<E: TElement> : Sync { // Invalidate our style, and the one of our siblings and descendants // as needed. data.invalidate_style_if_needed(root, shared_context); + + // Make sure we don't have any stale RECONSTRUCTED_ANCESTOR bits from + // the last traversal (at a potentially-higher root). From the + // perspective of this traversal, the root cannot have reconstructed + // ancestors. + data.restyle.set_reconstructed_ancestor(false); }; let parent = root.traversal_parent(); @@ -793,9 +799,7 @@ where if let Some(ref mut child_data) = child_data { // Propagate the parent restyle hint, that may make us restyle the whole // subtree. - if reconstructed_ancestor { - child_data.restyle.set_reconstructed_ancestor(); - } + child_data.restyle.set_reconstructed_ancestor(reconstructed_ancestor); child_data.restyle.hint.insert(propagated_hint); |