Bug 1304922 - Part 1: Rename nsLayoutUtils::HasCurrentAnimationOfProperty() to nsLayoutUtils::HasActiveAnimationOfProperty(). r?birtles draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Mon, 03 Oct 2016 06:33:29 +0900
changeset 420099 95046e3f3d8321544bb86234cd8b28a24e6d0bbb
parent 419914 7c576fe3279d87543f0a03b844eba7bc215e17f1
child 420100 ee0d1808b13d6a0da9e7a232e3c7ff1a9cb73a05
push id31094
push userbmo:hiikezoe@mozilla-japan.org
push dateMon, 03 Oct 2016 10:02:30 +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: kHqSs3WvJ
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;
     }
   }