diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index 56926634c797..61d4a5862747 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -1108,6 +1108,7 @@ public: // Call AddAnimation to add a new animation to this layer from layout code. // Caller must fill in all the properties of the returned animation. + // A later animation overrides an earlier one. Animation* AddAnimation(); // ClearAnimations clears animations on this layer. void ClearAnimations(); diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 5cc6a4c008de..712b17b10366 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -440,7 +440,8 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint) bool activeAnimations = false; - for (uint32_t i = animations.Length(); i-- !=0; ) { + // Process in order, since later animations override earlier ones. + for (size_t i = 0, iEnd = animations.Length(); i < iEnd; ++i) { Animation& animation = animations[i]; AnimData& animData = animationData[i]; diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index f42895ab6d0d..8dcc4def286b 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -413,6 +413,7 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty, CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR), "inconsistent property flags"); + // Add from first to last (since last overrides) for (size_t playerIdx = 0; playerIdx < aPlayers.Length(); playerIdx++) { AnimationPlayer* player = aPlayers[playerIdx]; if (!player->IsPlaying()) { @@ -560,6 +561,8 @@ nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer, data = null_t(); } + // When both are running, animations override transitions. We want + // to add the ones that override last. if (transitions) { AddAnimationsForProperty(aFrame, aProperty, transitions->mPlayers, aLayer, data, pending);