Bug 1384769 - Break TraversalFlags::ForReconstruct down into several independent pieces. r=emilio

These will be useful in followup work.

MozReview-Commit-ID: Dyp9R0PG36v
This commit is contained in:
Bobby Holley 2017-07-26 16:57:13 -07:00
parent f3de753524
commit ab415510c2
2 changed files with 18 additions and 6 deletions

View File

@ -288,7 +288,7 @@ ServoStyleSet::PrepareAndTraverseSubtree(
const SnapshotTable& snapshots = Snapshots();
bool isInitial = !aRoot->HasServoData();
bool forReconstruct = !!(aFlags & ServoTraversalFlags::ForReconstruct);
bool forReconstruct = !!(aFlags & ServoTraversalFlags::AggressivelyForgetful);
bool postTraversalRequired =
Servo_TraverseSubtree(aRoot, mRawSet.get(), &snapshots, aFlags);
MOZ_ASSERT(!(isInitial || forReconstruct) || !postTraversalRequired);
@ -839,8 +839,12 @@ ServoStyleSet::StyleSubtreeForReconstruct(Element* aRoot)
{
PreTraverse(aRoot);
auto flags = ServoTraversalFlags::Forgetful |
ServoTraversalFlags::AggressivelyForgetful |
ServoTraversalFlags::ClearDirtyDescendants |
ServoTraversalFlags::ClearAnimationOnlyDirtyDescendants;
DebugOnly<bool> postTraversalRequired =
PrepareAndTraverseSubtree(aRoot, ServoTraversalFlags::ForReconstruct);
PrepareAndTraverseSubtree(aRoot, flags);
MOZ_ASSERT(!postTraversalRequired);
}

View File

@ -58,10 +58,18 @@ enum class ServoTraversalFlags : uint32_t {
ForCSSRuleChanges = 1 << 1,
// Traverse only unstyled children of the root (and their descendants).
UnstyledChildrenOnly = 1 << 2,
// Traverses in a mode that doesn't generate any change hints, which is what's
// required when handling frame reconstruction. The change hints in this case
// are unneeded, since the old frames have already been destroyed.
ForReconstruct = 1 << 3,
// A forgetful traversal ignores the previous state of the frame tree, and
// thus does not compute damage or maintain other state describing the styles
// pre-traversal. A forgetful traversal is usually the right thing if you
// aren't going to do a post-traversal.
Forgetful = 1 << 3,
// Actively seeks out and clears change hints that may have been posted into
// the tree. Nonsensical without also passing Forgetful.
AggressivelyForgetful = 1 << 4,
// Clears the dirty descendants bit in the subtree.
ClearDirtyDescendants = 1 << 5,
// Clears the animation-only dirty descendants bit in the subtree.
ClearAnimationOnlyDirtyDescendants = 1 << 6,
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ServoTraversalFlags)