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
--- 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;
}
}