Bug 1321412 - If the animated content is already fully rendered, enable async animation regardless of size. r=mattwoodrow
MozReview-Commit-ID: OePAkUqp2Q
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -6183,31 +6183,37 @@ nsDisplayTransform::ShouldPrerenderTrans
EffectCompositor::SetPerformanceWarning(
aFrame, eCSSProperty_transform,
AnimationPerformanceWarning(
AnimationPerformanceWarning::Type::TransformFrameInactive));
return NoPrerender;
}
+ // If the incoming dirty rect already contains the entire overflow area,
+ // we are already rendering the entire content.
+ nsRect overflow = aFrame->GetVisualOverflowRectRelativeToSelf();
+ if (aDirtyRect->Contains(overflow)) {
+ return FullPrerender;
+ }
+
float viewportRatioX = gfxPrefs::AnimationPrerenderViewportRatioLimitX();
float viewportRatioY = gfxPrefs::AnimationPrerenderViewportRatioLimitY();
uint32_t absoluteLimitX = gfxPrefs::AnimationPrerenderAbsoluteLimitX();
uint32_t absoluteLimitY = gfxPrefs::AnimationPrerenderAbsoluteLimitY();
nsSize refSize = aBuilder->RootReferenceFrame()->GetSize();
// Only prerender if the transformed frame's size is <= a multiple of the
// reference frame size (~viewport), and less than an absolute limit.
// Both the ratio and the absolute limit are configurable.
nsSize relativeLimit(nscoord(refSize.width * viewportRatioX),
nscoord(refSize.height * viewportRatioY));
nsSize absoluteLimit(aFrame->PresContext()->DevPixelsToAppUnits(absoluteLimitX),
aFrame->PresContext()->DevPixelsToAppUnits(absoluteLimitY));
nsSize maxSize = Min(relativeLimit, absoluteLimit);
gfxSize scale = nsLayoutUtils::GetTransformToAncestorScale(aFrame);
- nsRect overflow = aFrame->GetVisualOverflowRectRelativeToSelf();
nsSize frameSize = nsSize(overflow.Size().width * scale.width,
overflow.Size().height * scale.height);
if (frameSize <= maxSize) {
*aDirtyRect = overflow;
return FullPrerender;
} else if (gfxPrefs::PartiallyPrerenderAnimatedContent()) {
*aDirtyRect = ComputePartialPrerenderArea(*aDirtyRect, overflow, maxSize);
return PartialPrerender;