Bug 1205475 - Early return in nsLayoutUtils::HasAnimationOfProperty if there is no animation on the target frame.
Early return in nsLayoutUtils::HasAnimationOfProperty to save execution time of
the callers, which includes nsIFrame::HasAnimationOfTransform,
nsIFrame::HasOpacityInternal and nsIFrame::BuildDisplayListForStackingContext.
MozReview-Commit-ID: DN364gphpUq
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -505,16 +505,22 @@ nsLayoutUtils::HasCurrentTransitions(con
}
);
}
bool
nsLayoutUtils::HasAnimationOfProperty(const nsIFrame* aFrame,
nsCSSPropertyID aProperty)
{
+ if (aFrame->GetContent() && aFrame->GetContent()->MayHaveAnimations()) {
+ return false; // Early return if there is no possibility to have any
+ // animation on this frame to prevent hash table searching in
+ // aEffect.HasAnimationOfProperty.
+ }
+
return HasMatchingAnimations(aFrame,
[&aProperty](KeyframeEffectReadOnly& aEffect)
{
return (aEffect.IsInEffect() || aEffect.IsCurrent()) &&
aEffect.HasAnimationOfProperty(aProperty);
}
);
}