style: Cleanup unused style traversal flags.

Some of these were unused, some of them were only used in combination with
others, so I've unified them.

In particular, Forgetful and ClearAnimationOnlyDirtyDescendants were used only
together for a very specific task (the final animation traversal), so I merged
them into something that has that name.

ClearDirtyBits was unused, so I removed along with some code that would no
longer be called.

Differential Revision: https://phabricator.services.mozilla.com/D25454
This commit is contained in:
Emilio Cobos Álvarez 2019-04-09 18:03:41 +00:00
parent a7636010ee
commit fce58015d6
5 changed files with 10 additions and 60 deletions

View file

@ -535,12 +535,6 @@ pub fn recalc_style_at<E, D, F>(
debug_assert!(!element.has_animation_only_dirty_descendants());
}
debug_assert!(
flags.for_animation_only() ||
!flags.contains(TraversalFlags::ClearDirtyBits) ||
!element.has_animation_only_dirty_descendants(),
"Should have cleared animation bits already"
);
clear_state_after_traversing(element, data, flags);
}
@ -548,27 +542,11 @@ fn clear_state_after_traversing<E>(element: E, data: &mut ElementData, flags: Tr
where
E: TElement,
{
// If we are in a forgetful traversal, drop the existing restyle
// data here, since we won't need to perform a post-traversal to pick up
// any change hints.
if flags.contains(TraversalFlags::Forgetful) {
if flags.intersects(TraversalFlags::FinalAnimationTraversal) {
debug_assert!(flags.for_animation_only());
data.clear_restyle_flags_and_damage();
}
// Clear dirty bits as appropriate.
if flags.for_animation_only() {
if flags.intersects(
TraversalFlags::ClearDirtyBits | TraversalFlags::ClearAnimationOnlyDirtyDescendants,
) {
unsafe {
element.unset_animation_only_dirty_descendants();
}
}
} else if flags.contains(TraversalFlags::ClearDirtyBits) {
// The animation traversal happens first, so we don't need to guard against
// clearing the animation bit on the regular traversal.
unsafe {
element.clear_dirty_bits();
element.unset_animation_only_dirty_descendants();
}
}
}