зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1371450 - Rename TraversalRestyleBehavior::ForAnimationOnly to TraversalRestyleBehavior::ForThrottledAnimationFlush. r=birtles,emilio
ForAnimationOnly is somewhat misleading, it means actually we process *only* animation-only restyle without normal restyle. The purpose of ForAnimationOnly is for updating throttled animations to get correct position of the animations when we need to handle events. Currently we do also update unthrottled animations though. MozReview-Commit-ID: HBCCluKrZs9 --HG-- extra : rebase_source : bb37080e44b161b8b0210e3ba3c055604cf43a72
This commit is contained in:
Родитель
951ca9e4d5
Коммит
c040adf510
|
@ -766,8 +766,8 @@ ServoRestyleManager::DoProcessPendingRestyles(TraversalRestyleBehavior
|
|||
|
||||
ServoStyleSet* styleSet = StyleSet();
|
||||
nsIDocument* doc = PresContext()->Document();
|
||||
bool animationOnly = aRestyleBehavior ==
|
||||
TraversalRestyleBehavior::ForAnimationOnly;
|
||||
bool forThrottledAnimationFlush =
|
||||
aRestyleBehavior == TraversalRestyleBehavior::ForThrottledAnimationFlush;
|
||||
|
||||
// Ensure the refresh driver is active during traversal to avoid mutating
|
||||
// mActiveTimer and mMostRecentRefresh time.
|
||||
|
@ -778,16 +778,17 @@ ServoRestyleManager::DoProcessPendingRestyles(TraversalRestyleBehavior
|
|||
// in a loop because certain rare paths in the frame constructor (like
|
||||
// uninstalling XBL bindings) can trigger additional style validations.
|
||||
mInStyleRefresh = true;
|
||||
if (mHaveNonAnimationRestyles && !animationOnly) {
|
||||
if (mHaveNonAnimationRestyles && !forThrottledAnimationFlush) {
|
||||
++mAnimationGeneration;
|
||||
}
|
||||
|
||||
TraversalRestyleBehavior restyleBehavior = mRestyleForCSSRuleChanges
|
||||
? TraversalRestyleBehavior::ForCSSRuleChanges
|
||||
: TraversalRestyleBehavior::Normal;
|
||||
while (animationOnly ? styleSet->StyleDocumentForAnimationOnly()
|
||||
: styleSet->StyleDocument(restyleBehavior)) {
|
||||
if (!animationOnly) {
|
||||
while (forThrottledAnimationFlush
|
||||
? styleSet->StyleDocumentForThrottledAnimationFlush()
|
||||
: styleSet->StyleDocument(restyleBehavior)) {
|
||||
if (!forThrottledAnimationFlush) {
|
||||
ClearSnapshots();
|
||||
}
|
||||
|
||||
|
@ -798,7 +799,7 @@ ServoRestyleManager::DoProcessPendingRestyles(TraversalRestyleBehavior
|
|||
// lazy frame construction).
|
||||
{
|
||||
AutoRestyleTimelineMarker marker(
|
||||
mPresContext->GetDocShell(), animationOnly);
|
||||
mPresContext->GetDocShell(), forThrottledAnimationFlush);
|
||||
DocumentStyleRootIterator iter(doc);
|
||||
while (Element* root = iter.GetNextStyleRoot()) {
|
||||
ServoRestyleState state(*styleSet, currentChanges);
|
||||
|
@ -851,7 +852,7 @@ ServoRestyleManager::DoProcessPendingRestyles(TraversalRestyleBehavior
|
|||
|
||||
FlushOverflowChangedTracker();
|
||||
|
||||
if (!animationOnly) {
|
||||
if (!forThrottledAnimationFlush) {
|
||||
ClearSnapshots();
|
||||
styleSet->AssertTreeIsClean();
|
||||
mHaveNonAnimationRestyles = false;
|
||||
|
@ -884,7 +885,7 @@ ServoRestyleManager::UpdateOnlyAnimationStyles()
|
|||
return;
|
||||
}
|
||||
|
||||
DoProcessPendingRestyles(TraversalRestyleBehavior::ForAnimationOnly);
|
||||
DoProcessPendingRestyles(TraversalRestyleBehavior::ForThrottledAnimationFlush);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -360,11 +360,11 @@ ServoStyleSet::PrepareAndTraverseSubtree(
|
|||
TraversalRootBehavior aRootBehavior,
|
||||
TraversalRestyleBehavior aRestyleBehavior)
|
||||
{
|
||||
bool forAnimationOnly =
|
||||
aRestyleBehavior == TraversalRestyleBehavior::ForAnimationOnly;
|
||||
bool forThrottledAnimationFlush =
|
||||
aRestyleBehavior == TraversalRestyleBehavior::ForThrottledAnimationFlush;
|
||||
|
||||
AutoRestyleTimelineMarker marker(
|
||||
mPresContext->GetDocShell(), forAnimationOnly);
|
||||
mPresContext->GetDocShell(), forThrottledAnimationFlush);
|
||||
|
||||
// Get the Document's root element to ensure that the cache is valid before
|
||||
// calling into the (potentially-parallel) Servo traversal, where a cache hit
|
||||
|
@ -388,9 +388,12 @@ ServoStyleSet::PrepareAndTraverseSubtree(
|
|||
MOZ_ASSERT(!(isInitial || forReconstruct || forNewlyBoundElement) ||
|
||||
!postTraversalRequired);
|
||||
|
||||
// Don't need to trigger a second traversal if this restyle only needs
|
||||
// animation-only restyle.
|
||||
if (forAnimationOnly) {
|
||||
// We don't need to trigger a second traversal if this restyle only for
|
||||
// flushing throttled animations. That's because the first traversal only
|
||||
// performs the animation-only restyle, skipping the normal restyle, and so
|
||||
// will not generate any SequentialTask that could update animation state
|
||||
// requiring a subsequent traversal.
|
||||
if (forThrottledAnimationFlush) {
|
||||
return postTraversalRequired;
|
||||
}
|
||||
|
||||
|
@ -921,16 +924,17 @@ ServoStyleSet::StyleDocument(TraversalRestyleBehavior aRestyleBehavior)
|
|||
}
|
||||
|
||||
bool
|
||||
ServoStyleSet::StyleDocumentForAnimationOnly()
|
||||
ServoStyleSet::StyleDocumentForThrottledAnimationFlush()
|
||||
{
|
||||
PreTraverse(nullptr, EffectCompositor::AnimationRestyleType::Full);
|
||||
|
||||
bool postTraversalRequired = false;
|
||||
DocumentStyleRootIterator iter(mPresContext->Document());
|
||||
while (Element* root = iter.GetNextStyleRoot()) {
|
||||
if (PrepareAndTraverseSubtree(root,
|
||||
TraversalRootBehavior::Normal,
|
||||
TraversalRestyleBehavior::ForAnimationOnly)) {
|
||||
if (PrepareAndTraverseSubtree(
|
||||
root,
|
||||
TraversalRootBehavior::Normal,
|
||||
TraversalRestyleBehavior::ForThrottledAnimationFlush)) {
|
||||
postTraversalRequired = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ public:
|
|||
* This will traverse all of the document's style roots (that is, its document
|
||||
* element, and the roots of the document-level native anonymous content).
|
||||
*/
|
||||
bool StyleDocumentForAnimationOnly();
|
||||
bool StyleDocumentForThrottledAnimationFlush();
|
||||
|
||||
/**
|
||||
* Eagerly styles a subtree of unstyled nodes that was just appended to the
|
||||
|
|
|
@ -71,8 +71,12 @@ enum class TraversalRestyleBehavior {
|
|||
// required when handling frame reconstruction. The change hints in this case
|
||||
// are unneeded, since the old frames have already been destroyed.
|
||||
ForReconstruct,
|
||||
// Processes animation-only restyle.
|
||||
ForAnimationOnly,
|
||||
// Processes just the traversal for animation-only restyles and skips the
|
||||
// normal traversal for other restyles unrelated to animations.
|
||||
// This is used to bring throttled animations up-to-date such as when we need
|
||||
// to get correct position for transform animations that are throttled because
|
||||
// they are running on the compositor.
|
||||
ForThrottledAnimationFlush,
|
||||
// Traverses as normal mode but tries to update all CSS animations.
|
||||
ForCSSRuleChanges,
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче