From ae595ed94c045825d9d371ce836e41e76b515946 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Sun, 5 Feb 2012 08:34:10 -0800 Subject: [PATCH] Bug 724189: Add a little fuzz factor to the max pre-render size for transformed frames, in case the frame has borders or shadows. r=roc --- layout/base/nsDisplayList.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index b6259d7f0a7..dd85ac58700 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -2574,9 +2574,15 @@ bool nsDisplayTransform::ShouldPrerenderTransformedContent(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame) { - return aFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer) && - aFrame->GetVisualOverflowRectRelativeToSelf().Size() <= - aBuilder->ReferenceFrame()->GetSize(); + if (aFrame->AreLayersMarkedActive(nsChangeHint_UpdateTransformLayer)) { + nsSize refSize = aBuilder->ReferenceFrame()->GetSize(); + // Only prerender if the transformed frame's size is <= the + // reference frame size (~viewport), allowing a 1/8th fuzz factor + // for shadows, borders, etc. + refSize += nsSize(refSize.width / 8, refSize.height / 8); + return aFrame->GetVisualOverflowRectRelativeToSelf().Size() <= refSize; + } + return false; } /* If the matrix is singular, or a hidden backface is shown, the frame won't be visible or hit. */