diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index d7475e35d3a..e00a5cf613c 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -3057,7 +3057,7 @@ nsDisplayOpacity::BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerParameters& aContainerParameters) { if (mFrame->StyleDisplay()->mOpacity == 0 && mFrame->GetContent() && - !nsLayoutUtils::HasAnimations(mFrame->GetContent(), eCSSProperty_opacity)) { + !nsLayoutUtils::HasAnimationsForCompositor(mFrame->GetContent(), eCSSProperty_opacity)) { return nullptr; } nsRefPtr container = aManager->GetLayerBuilder()-> diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 1b445f62b8a..9f7792b3aea 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -251,9 +251,9 @@ TextAlignTrueEnabledPrefChangeCallback(const char* aPrefName, void* aClosure) template static AnimationsOrTransitions* -HasAnimationOrTransitionForCompositor(nsIContent* aContent, - nsIAtom* aAnimationProperty, - nsCSSProperty aProperty) +HasAnimationOrTransition(nsIContent* aContent, + nsIAtom* aAnimationProperty, + nsCSSProperty aProperty) { AnimationsOrTransitions* animations = static_cast(aContent->GetProperty(aAnimationProperty)); @@ -275,40 +275,12 @@ nsLayoutUtils::HasAnimationsForCompositor(nsIContent* aContent, { if (!aContent->MayHaveAnimations()) return false; - return HasAnimationOrTransitionForCompositor - (aContent, nsGkAtoms::animationsProperty, aProperty) || - HasAnimationOrTransitionForCompositor - (aContent, nsGkAtoms::transitionsProperty, aProperty); -} - -template -static AnimationsOrTransitions* -HasAnimationOrTransition(nsIContent* aContent, - nsIAtom* aAnimationProperty, - nsCSSProperty aProperty) -{ - AnimationsOrTransitions* animations = - static_cast(aContent->GetProperty(aAnimationProperty)); - if (animations) { - bool propertyMatches = animations->HasAnimationOfProperty(aProperty); - if (propertyMatches) { - return animations; - } + if (HasAnimationOrTransition + (aContent, nsGkAtoms::animationsProperty, aProperty)) { + return true; } - - return nullptr; -} - -bool -nsLayoutUtils::HasAnimations(nsIContent* aContent, - nsCSSProperty aProperty) -{ - if (!aContent->MayHaveAnimations()) - return false; - return HasAnimationOrTransition - (aContent, nsGkAtoms::animationsProperty, aProperty) || - HasAnimationOrTransition - (aContent, nsGkAtoms::transitionsProperty, aProperty); + return HasAnimationOrTransition + (aContent, nsGkAtoms::transitionsProperty, aProperty); } static gfxSize @@ -351,7 +323,7 @@ gfxSize nsLayoutUtils::GetMaximumAnimatedScale(nsIContent* aContent) { gfxSize result; - ElementAnimations* animations = HasAnimationOrTransitionForCompositor + ElementAnimations* animations = HasAnimationOrTransition (aContent, nsGkAtoms::animationsProperty, eCSSProperty_transform); if (animations) { for (uint32_t animIdx = animations->mAnimations.Length(); animIdx-- != 0; ) { @@ -374,7 +346,7 @@ nsLayoutUtils::GetMaximumAnimatedScale(nsIContent* aContent) } } } - ElementTransitions* transitions = HasAnimationOrTransitionForCompositor + ElementTransitions* transitions = HasAnimationOrTransition (aContent, nsGkAtoms::transitionsProperty, eCSSProperty_transform); if (transitions) { for (uint32_t i = 0, i_end = transitions->mPropertyTransitions.Length(); diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index dfcc3582d1d..080f3ece813 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -1632,12 +1632,6 @@ public: static bool HasAnimationsForCompositor(nsIContent* aContent, nsCSSProperty aProperty); - /** - * Returns true if the content node has animations or transitions for the - * property. - */ - static bool HasAnimations(nsIContent* aContent, nsCSSProperty aProperty); - /** * Checks if off-main-thread animations are enabled. */ diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 6be7ec0f1d1..8e271491712 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1794,7 +1794,8 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, // need to have display items built for them. if (disp->mOpacity == 0.0 && aBuilder->IsForPainting() && !aBuilder->WillComputePluginGeometry() && - !nsLayoutUtils::HasAnimations(mContent, eCSSProperty_opacity)) { + !nsLayoutUtils::HasAnimationsForCompositor(mContent, + eCSSProperty_opacity)) { return; }