Bug 1316764 - Update animations on layers whenever the frame generation is not equal; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Thu, 22 Dec 2016 08:47:14 +0900
changeset 452771 e74b3f7657a111dd0824e924dd55bca65de55c43
parent 451264 567894f026558e6dada617a3998f29aed06ac7d8
child 540298 86af18309cf07b1c66aaf33122207cf24afce4df
push id39483
push userbbirtles@mozilla.com
push dateThu, 22 Dec 2016 06:52:06 +0000
reviewershiro
bugs1316764, 1229280
milestone53.0a1
Bug 1316764 - Update animations on layers whenever the frame generation is not equal; r?hiro This fixes a problem where we fail to update animations on layers when an EffectSet is destroyed. In this case when we call RestyleManager::GetAnimationGenerationForFrame in ElementRestyler::AddLayerChangesForAnimation(), it will return zero but the animation generation on the layer will be set to some positive non-zero value. If we compare the two generation numbers using < we will think the layer is up-to-date. Using != fixes this. We only used < while we had independent generation numbers of animations and transitions but that was fixed in bug 1229280. MozReview-Commit-ID: Jsunjc145GR
layout/base/RestyleManager.cpp
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -1525,28 +1525,25 @@ ElementRestyler::ElementRestyler(nsPresC
   , mVisibleKidsOfHiddenElement(aVisibleKidsOfHiddenElement)
 #endif
 {
 }
 
 void
 ElementRestyler::AddLayerChangesForAnimation()
 {
-  // Bug 847286 - We should have separate animation generation counters
-  // on layers for transitions and animations and use != comparison below
-  // rather than a > comparison.
   uint64_t frameGeneration =
     RestyleManager::GetAnimationGenerationForFrame(mFrame);
 
   nsChangeHint hint = nsChangeHint(0);
   for (const LayerAnimationInfo::Record& layerInfo :
          LayerAnimationInfo::sRecords) {
     Layer* layer =
       FrameLayerBuilder::GetDedicatedLayer(mFrame, layerInfo.mLayerType);
-    if (layer && frameGeneration > layer->GetAnimationGeneration()) {
+    if (layer && frameGeneration != layer->GetAnimationGeneration()) {
       // If we have a transform layer but don't have any transform style, we
       // probably just removed the transform but haven't destroyed the layer
       // yet. In this case we will add the appropriate change hint
       // (nsChangeHint_UpdateContainingBlock) when we compare style contexts
       // so we can skip adding any change hint here. (If we *were* to add
       // nsChangeHint_UpdateTransformLayer, ApplyRenderingChangeToTree would
       // complain that we're updating a transform layer without a transform).
       if (layerInfo.mLayerType == nsDisplayItem::TYPE_TRANSFORM &&