Bug 1388566 - We don't need to check dirty descendant bit whether we need to flush throttled animations in PreTraverseInSubtree(). r?birtles
When styles which affect animations on running on the compositor,
we create a UpdateAnimationsTasks::CascadeResults and ends up calling
RequestRestyle, so we don't need to care about the case in
PreTraverseInSubtree().
MozReview-Commit-ID: 6KgVzqD8JhD
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -1004,23 +1004,20 @@ EffectCompositor::PreTraverseInSubtree(S
(aRoot->IsGeneratedContentContainerForBefore() ||
aRoot->IsGeneratedContentContainerForAfter())) {
aRoot = aRoot->GetParentElement();
}
AutoRestore<bool> guard(mIsInPreTraverse);
mIsInPreTraverse = true;
- // We need to force flush all throttled animations if we also have
- // non-animation restyles (since we'll want the up-to-date animation style
- // when we go to process them so we can trigger transitions correctly), and
- // if we are currently flushing all throttled animation restyles.
+ // We need to force flush all throttled animations if we are currently
+ // flushing all throttled animation restyles for hit testing.
bool flushThrottledRestyles =
- (aRoot && aRoot->HasDirtyDescendantsForServo()) ||
- (aFlags & ServoTraversalFlags::FlushThrottledAnimations);
+ !!(aFlags & ServoTraversalFlags::FlushThrottledAnimations);
using ElementsToRestyleIterType =
nsDataHashtable<PseudoElementHashEntry, bool>::Iterator;
auto getNeededRestyleTarget = [&](const ElementsToRestyleIterType& aIter)
-> NonOwningAnimationTarget {
NonOwningAnimationTarget returnTarget;
// If aIter.Data() is false, the element only requested a throttled
@@ -1156,32 +1153,25 @@ EffectCompositor::PreTraverse(dom::Eleme
return found;
}
AutoRestore<bool> guard(mIsInPreTraverse);
mIsInPreTraverse = true;
PseudoElementHashEntry::KeyType key = { aElement, aPseudoType };
- // We need to flush all throttled animation restyles too if we also have
- // non-animation restyles (since we'll want the up-to-date animation style
- // when we go to process them so we can trigger transitions correctly).
- Element* elementToRestyle = GetElementToRestyle(aElement, aPseudoType);
- bool flushThrottledRestyles = elementToRestyle &&
- elementToRestyle->HasDirtyDescendantsForServo();
-
for (size_t i = 0; i < kCascadeLevelCount; ++i) {
CascadeLevel cascadeLevel = CascadeLevel(i);
auto& elementSet = mElementsToRestyle[cascadeLevel];
// Skip if we don't have a restyle, or if we only have a throttled
// (skippable) restyle and we're not required to flush throttled restyles.
bool hasUnthrottledRestyle = false;
if (!elementSet.Get(key, &hasUnthrottledRestyle) ||
- (!flushThrottledRestyles && !hasUnthrottledRestyle)) {
+ !hasUnthrottledRestyle) {
continue;
}
mPresContext->RestyleManager()->AsServo()->
PostRestyleEventForAnimations(aElement,
aPseudoType,
cascadeLevel == CascadeLevel::Transitions
? eRestyle_CSSTransitions