Bug 758561 - Don't build a mask for an empty layer. r=roc
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -2810,26 +2810,27 @@ ArrayRangeEquals(const nsTArray<T>& a1,
return true;
}
void
ContainerState::SetupMaskLayer(Layer *aLayer, const FrameLayerBuilder::Clip& aClip,
PRUint32 aRoundedRectClipCount)
{
#ifdef MOZ_ENABLE_MASK_LAYERS
+ nsIntRect boundingRect = aLayer->GetEffectiveVisibleRegion().GetBounds();
// don't build an unnecessary mask
if (aClip.mRoundedClipRects.IsEmpty() ||
- aRoundedRectClipCount <= 0) {
+ aRoundedRectClipCount <= 0 ||
+ boundingRect.IsEmpty()) {
return;
}
const gfx3DMatrix& layerTransform = aLayer->GetTransform();
NS_ASSERTION(layerTransform.CanDraw2D() || aLayer->AsContainerLayer(),
"Only container layers may have 3D transforms.");
- nsIntRect boundingRect = aLayer->GetEffectiveVisibleRegion().GetBounds();
// check if we can re-use the mask layer
nsRefPtr<ImageLayer> maskLayer = CreateOrRecycleMaskImageLayerFor(aLayer);
MaskLayerUserData* userData = GetMaskLayerUserData(maskLayer);
if (ArrayRangeEquals(userData->mRoundedClipRects,
aClip.mRoundedClipRects,
aRoundedRectClipCount) &&
userData->mRoundedClipRects.Length() <= aRoundedRectClipCount &&