Bug 1334036 - Part 3: Add a flag to represent we are in pre-traversal. r=birtles

We need this flag to avoid assertion in PostRestyleForAnimation(), which
may be called from MaybeUpdateCascadeResults() in pre-traversal.

MozReview-Commit-ID: 46AfoIUb9o3

--HG--
extra : rebase_source : 3290d9954be43ffaeb94b501ac346622651c452a
This commit is contained in:
Boris Chiou 2017-05-11 13:08:35 +08:00
Родитель 5561a71847
Коммит f1f6a5d9dc
2 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -13,6 +13,7 @@
#include "mozilla/AnimationPerformanceWarning.h"
#include "mozilla/AnimationTarget.h"
#include "mozilla/AnimationUtils.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/EffectSet.h"
#include "mozilla/LayerAnimationInfo.h"
#include "mozilla/RestyleManager.h"
@ -315,7 +316,7 @@ EffectCompositor::PostRestyleForAnimation(dom::Element* aElement,
MOZ_ASSERT(NS_IsMainThread(),
"Restyle request during restyling should be requested only on "
"the main-thread. e.g. after the parallel traversal");
if (ServoStyleSet::IsInServoTraversal()) {
if (ServoStyleSet::IsInServoTraversal() || mIsInPreTraverse) {
MOZ_ASSERT(hint == eRestyle_CSSAnimations ||
hint == eRestyle_CSSTransitions);
@ -960,6 +961,9 @@ EffectCompositor::PreTraverseInSubtree(Element* aRoot)
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mPresContext->RestyleManager()->IsServo());
AutoRestore<bool> guard(mIsInPreTraverse);
mIsInPreTraverse = true;
// We need to force flush all throttled animations if there are any
// non-animation restyles.
bool flushThrottledRestyles = aRoot && aRoot->HasDirtyDescendantsForServo();
@ -1074,6 +1078,9 @@ EffectCompositor::PreTraverse(dom::Element* aElement,
return found;
}
AutoRestore<bool> guard(mIsInPreTraverse);
mIsInPreTraverse = true;
PseudoElementHashEntry::KeyType key = { aElement, aPseudoType };
// We need to flush all throttled animation restyles too if there are

Просмотреть файл

@ -293,6 +293,8 @@ private:
nsDataHashtable<PseudoElementHashEntry, bool>>
mElementsToRestyle;
bool mIsInPreTraverse = false;
class AnimationStyleRuleProcessor final : public nsIStyleRuleProcessor
{
public: