Bug 812107 - Don't attempt to do scroll compensation in FrameLayerBuilder for transformed containers. r=roc
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -2663,30 +2663,40 @@ ChooseScaleAndSetTransform(FrameLayerBui
gfx3DMatrix::ScalingMatrix(aIncomingScale.mXScale, aIncomingScale.mYScale, 1.0);
if (aTransform) {
// aTransform is applied first, then the scale is applied to the result
transform = (*aTransform)*transform;
// Set any matrix entries close to integers to be those exact integers.
// This protects against floating-point inaccuracies causing problems
// in the checks below.
transform.NudgeToIntegers();
- }
- if (aContainerFrame && aState == LAYER_INACTIVE) {
+ }
+ gfxMatrix transform2d;
+ if (aContainerFrame &&
+ aState == LAYER_INACTIVE &&
+ (!aTransform || (aTransform->Is2D(&transform2d) &&
+ !transform2d.HasNonTranslation()))) {
// When we have an inactive ContainerLayer, translate the container by the offset to the
// reference frame (and offset all child layers by the reverse) so that the coordinate
// space of the child layers isn't affected by scrolling.
+ // This gets confusing for complicated transform (since we'd have to compute the scale
+ // factors for the matrix), so we don't bother. Any frames that are building an nsDisplayTransform
+ // for a css transform would have 0,0 as their offset to the reference frame, so this doesn't
+ // matter.
nsPoint appUnitOffset = aDisplayListBuilder->ToReferenceFrame(aContainerFrame);
nscoord appUnitsPerDevPixel = aContainerFrame->PresContext()->AppUnitsPerDevPixel();
offset = nsIntPoint(
int32_t(NSAppUnitsToDoublePixels(appUnitOffset.x, appUnitsPerDevPixel)*aIncomingScale.mXScale),
int32_t(NSAppUnitsToDoublePixels(appUnitOffset.y, appUnitsPerDevPixel)*aIncomingScale.mYScale));
}
- transform = transform * gfx3DMatrix::Translation(offset.x + aIncomingScale.mOffset.x, offset.y + aIncomingScale.mOffset.y, 0);
-
- gfxMatrix transform2d;
+ transform = gfx3DMatrix::Translation(aIncomingScale.mOffset.x, aIncomingScale.mOffset.y, 0) *
+ transform *
+ gfx3DMatrix::Translation(offset.x, offset.y, 0);
+
+
bool canDraw2D = transform.CanDraw2D(&transform2d);
gfxSize scale;
bool isRetained = aLayer->Manager()->IsWidgetLayerManager();
// Only fiddle with scale factors for the retaining layer manager, since
// it only matters for retained layers
// XXX Should we do something for 3D transforms?
if (canDraw2D && isRetained) {
//Scale factors are normalized to a power of 2 to reduce the number of resolution changes