From ab415510c2e8b0c8fbe70ea9b591c61bdbe0f7f9 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 26 Jul 2017 16:57:13 -0700 Subject: [PATCH] Bug 1384769 - Break TraversalFlags::ForReconstruct down into several independent pieces. r=emilio These will be useful in followup work. MozReview-Commit-ID: Dyp9R0PG36v --- layout/style/ServoStyleSet.cpp | 8 ++++++-- layout/style/ServoTypes.h | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index fc21cc1ea517..2d3d26af6d27 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -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 postTraversalRequired = - PrepareAndTraverseSubtree(aRoot, ServoTraversalFlags::ForReconstruct); + PrepareAndTraverseSubtree(aRoot, flags); MOZ_ASSERT(!postTraversalRequired); } diff --git a/layout/style/ServoTypes.h b/layout/style/ServoTypes.h index 8c68f64f9d87..f0d57eb5d741 100644 --- a/layout/style/ServoTypes.h +++ b/layout/style/ServoTypes.h @@ -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)