Bug 1344619 - Part 2: Introduce EffectCompositor::PreTraverse(). r=birtles

MozReview-Commit-ID: 6ijDJttB9eo

--HG--
extra : rebase_source : 451601b1daf37e7b36d0b8ecda71c34388b78412
This commit is contained in:
Hiroyuki Ikezoe 2017-03-09 05:20:17 +09:00
parent f9b0c33a05
commit 90d73a1135
2 changed files with 39 additions and 0 deletions

View File

@ -940,6 +940,40 @@ EffectCompositor::SetPerformanceWarning(
}
}
void
EffectCompositor::PreTraverse()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mPresContext->RestyleManager()->IsServo());
for (auto& elementsToRestyle : mElementsToRestyle) {
for (auto iter = elementsToRestyle.Iter(); !iter.Done(); iter.Next()) {
bool postedRestyle = iter.Data();
// Ignore throttled restyle.
if (!postedRestyle) {
continue;
}
NonOwningAnimationTarget target = iter.Key();
EffectSet* effects =
EffectSet::GetEffectSet(target.mElement, target.mPseudoType);
if (!effects) {
// Drop the EffectSets that have been destroyed.
iter.Remove();
continue;
}
for (KeyframeEffectReadOnly* effect : *effects) {
effect->GetAnimation()->WillComposeStyle();
}
// Remove the element from the list of elements to restyle since we are
// about to restyle it.
iter.Remove();
}
}
}
// ---------------------------------------------------------
//
// Nested class: AnimationStyleRuleProcessor

View File

@ -233,6 +233,11 @@ public:
nsCSSPropertyID aProperty,
const AnimationPerformanceWarning& aWarning);
// Do a bunch of stuff that we should avoid doing during the parallel
// traversal (e.g. changing member variables) for all elements that we expect
// to restyle on the next traversal.
void PreTraverse();
private:
~EffectCompositor() = default;