Bug 1340322 - Part 4: Make BuildAnimations() independent from nsStyleDisplay r?birtles.
MozReview-Commit-ID: JiV2WxBVH3i
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -1006,26 +1006,26 @@ CSSAnimationBuilder::GetComputedValue(ns
return result;
}
static nsAnimationManager::OwningCSSAnimationPtrArray
BuildAnimations(nsPresContext* aPresContext,
nsStyleContext* aStyleContext,
const NonOwningAnimationTarget& aTarget,
+ const nsStyleAutoArray<StyleAnimation>& aStyleAnimations,
+ uint32_t aStyleAnimationNameCount,
nsAnimationManager::CSSAnimationCollection* aCollection)
{
nsAnimationManager::OwningCSSAnimationPtrArray result;
- const nsStyleDisplay *disp = aStyleContext->StyleDisplay();
-
CSSAnimationBuilder builder(aStyleContext, aTarget);
- for (size_t animIdx = disp->mAnimationNameCount; animIdx-- != 0;) {
- const StyleAnimation& src = disp->mAnimations[animIdx];
+ for (size_t animIdx = aStyleAnimationNameCount; animIdx-- != 0;) {
+ const StyleAnimation& src = aStyleAnimations[animIdx];
// CSS Animations whose animation-name does not match a @keyframes rule do
// not generate animation events. This includes when the animation-name is
// "none" which is represented by an empty name in the StyleAnimation.
// Since such animations neither affect style nor dispatch events, we do
// not generate a corresponding CSSAnimation for them.
if (src.GetName().IsEmpty()) {
continue;
@@ -1078,16 +1078,18 @@ nsAnimationManager::UpdateAnimations(nsS
// Build the updated animations list, extracting matching animations from
// the existing collection as we go.
OwningCSSAnimationPtrArray newAnimations;
if (!aStyleContext->IsInDisplayNoneSubtree()) {
newAnimations = BuildAnimations(mPresContext,
aStyleContext,
target,
+ disp->mAnimations,
+ disp->mAnimationNameCount,
collection);
}
if (newAnimations.IsEmpty()) {
if (collection) {
collection->Destroy();
}
return;