Bug 1304922 - Part 1: Rename nsLayoutUtils::HasCurrentAnimationOfProperty() to nsLayoutUtils::HasActiveAnimationOfProperty(). r?birtles draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Wed, 05 Oct 2016 14:25:41 +0900
changeset 421026 dd2c4f52abbe74a55a8954d0f198f20f3d9df019
parent 420680 42c95d88aaaa7c2eca1d278399421d437441ac4d
child 421027 58d1629479317e6acd23da08b79f890c188e8dc3
push id31361
push userbmo:hiikezoe@mozilla-japan.org
push dateWed, 05 Oct 2016 06:56:42 +0000
reviewersbirtles
bugs1304922
milestone52.0a1
Bug 1304922 - Part 1: Rename nsLayoutUtils::HasCurrentAnimationOfProperty() to nsLayoutUtils::HasActiveAnimationOfProperty(). r?birtles KeyframeEffectReadOnly::HasAnimationOfProperty() calls GetAnimationOfProperty() which checks mWinsInCascade flag and the mWinsInCascade flag is set to true only if the effect is in-effect. That means nsLayoutUtils::HasCurrentAnimationOfProperty() actually represents that a given frame has at least one animation which is current and *in-effect* (i.e. active). MozReview-Commit-ID: 93rMMmzrBMi
layout/base/ActiveLayerTracker.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/generic/nsFrame.cpp
--- a/layout/base/ActiveLayerTracker.cpp
+++ b/layout/base/ActiveLayerTracker.cpp
@@ -441,17 +441,17 @@ ActiveLayerTracker::IsStyleAnimated(nsDi
     }
     if (CheckScrollInducedActivity(layerActivity, activityIndex, aBuilder)) {
       return true;
     }
   }
   if (aProperty == eCSSProperty_transform && aFrame->Combines3DTransformWithAncestors()) {
     return IsStyleAnimated(aBuilder, aFrame->GetParent(), aProperty);
   }
-  return nsLayoutUtils::HasCurrentAnimationOfProperty(aFrame, aProperty);
+  return nsLayoutUtils::HasActiveAnimationOfProperty(aFrame, aProperty);
 }
 
 /* static */ bool
 ActiveLayerTracker::IsOffsetOrMarginStyleAnimated(nsIFrame* aFrame)
 {
   LayerActivity* layerActivity = GetLayerActivity(aFrame);
   if (layerActivity) {
     if (layerActivity->mRestyleCounts[LayerActivity::ACTIVITY_LEFT] >= 2 ||
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -471,23 +471,24 @@ HasMatchingAnimations(const nsIFrame* aF
       return true;
     }
   }
 
   return false;
 }
 
 bool
-nsLayoutUtils::HasCurrentAnimationOfProperty(const nsIFrame* aFrame,
-                                             nsCSSPropertyID aProperty)
+nsLayoutUtils::HasActiveAnimationOfProperty(const nsIFrame* aFrame,
+                                            nsCSSPropertyID aProperty)
 {
   return HasMatchingAnimations(aFrame,
     [&aProperty](KeyframeEffectReadOnly& aEffect)
     {
-      return aEffect.IsCurrent() && aEffect.HasAnimationOfProperty(aProperty);
+      return aEffect.IsCurrent() && aEffect.IsInEffect() &&
+        aEffect.HasAnimationOfProperty(aProperty);
     }
   );
 }
 
 bool
 nsLayoutUtils::HasCurrentTransitions(const nsIFrame* aFrame)
 {
   return HasMatchingAnimations(aFrame,
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -2225,21 +2225,21 @@ public:
    *    (void)SizeOfTextRunsForFrames(rootFrame, nullptr, true);
    *    total = SizeOfTextRunsForFrames(rootFrame, mallocSizeOf, false);
    */
   static size_t SizeOfTextRunsForFrames(nsIFrame* aFrame,
                                         mozilla::MallocSizeOf aMallocSizeOf,
                                         bool clear);
 
   /**
-   * Returns true if the frame has current (i.e. running or scheduled-to-run)
-   * animations or transitions for the property.
+   * Returns true if the frame has animations or transitions that are running
+   * or filling forwards for the specified property.
    */
-  static bool HasCurrentAnimationOfProperty(const nsIFrame* aFrame,
-                                            nsCSSPropertyID aProperty);
+  static bool HasActiveAnimationOfProperty(const nsIFrame* aFrame,
+                                           nsCSSPropertyID aProperty);
 
   /**
    * Returns true if the frame has any current CSS transitions.
    * A current transition is any transition that has not yet finished playing
    * including paused transitions.
    */
   static bool HasCurrentTransitions(const nsIFrame* aFrame);
 
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2110,18 +2110,18 @@ nsIFrame::BuildDisplayListForStackingCon
   // need to have display items built for them.
   bool needEventRegions =
     aBuilder->IsBuildingLayerEventRegions() &&
     StyleUserInterface()->GetEffectivePointerEvents(this) !=
       NS_STYLE_POINTER_EVENTS_NONE;
   bool opacityItemForEventsAndPluginsOnly = false;
   if (effects->mOpacity == 0.0 && aBuilder->IsForPainting() &&
       !(disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_OPACITY) &&
-      !nsLayoutUtils::HasCurrentAnimationOfProperty(this,
-                                                    eCSSProperty_opacity)) {
+      !nsLayoutUtils::HasActiveAnimationOfProperty(this,
+                                                   eCSSProperty_opacity)) {
     if (needEventRegions ||
         aBuilder->WillComputePluginGeometry()) {
       opacityItemForEventsAndPluginsOnly = true;
     } else {
       return;
     }
   }