diff --git a/gfx/layers/basic/BasicLayers.cpp b/gfx/layers/basic/BasicLayers.cpp index 86bfa762e677..6f4bc09c92ca 100644 --- a/gfx/layers/basic/BasicLayers.cpp +++ b/gfx/layers/basic/BasicLayers.cpp @@ -1259,6 +1259,7 @@ TransformIntRect(nsIntRect& aRect, const gfxMatrix& aMatrix, // This implementation assumes that GetEffectiveTransform transforms // all layers to the same coordinate system. It can't be used as is // by accelerated layers because of intermediate surfaces. +// aClipRect and aRegion are in that global coordinate system. static void MarkLeafLayersCoveredByOpaque(Layer* aLayer, const nsIntRect& aClipRect, nsIntRegion& aRegion) @@ -1267,7 +1268,6 @@ MarkLeafLayersCoveredByOpaque(Layer* aLayer, const nsIntRect& aClipRect, BasicImplData* data = ToData(aLayer); data->SetCoveredByOpaque(PR_FALSE); - const nsIntRect* clipRect = aLayer->GetEffectiveClipRect(); nsIntRect newClipRect(aClipRect); // Allow aLayer or aLayer's descendants to cover underlying layers @@ -1277,14 +1277,21 @@ MarkLeafLayersCoveredByOpaque(Layer* aLayer, const nsIntRect& aClipRect, newClipRect.SetRect(0, 0, 0, 0); } - if (clipRect) { - nsIntRect cr = *clipRect; - gfxMatrix tr; - if (aLayer->GetEffectiveTransform().Is2D(&tr)) { - TransformIntRect(cr, tr, ToInsideIntRect); + { + const nsIntRect* clipRect = aLayer->GetEffectiveClipRect(); + if (clipRect) { + nsIntRect cr = *clipRect; + // clipRect is in the container's coordinate system. Get it into the + // global coordinate system. + if (aLayer->GetParent()) { + gfxMatrix tr; + if (aLayer->GetParent()->GetEffectiveTransform().Is2D(&tr)) { + TransformIntRect(cr, tr, ToInsideIntRect); + } else { + cr.SetRect(0, 0, 0, 0); + } + } newClipRect.IntersectRect(newClipRect, cr); - } else { - newClipRect.SetRect(0, 0, 0, 0); } }