Bug 758561 - Don't build a mask for an empty layer. r=roc
authorNicholas Cameron <ncameron@mozilla.com>
Mon, 28 May 2012 21:10:08 -0400
changeset 99193 9cc3b4fc60c545be2f7060cbcc192eff26727cbd
parent 99192 f0c3e8edc333d54052d87df47d4035519cc81bfc
child 99194 ee5b6efa9bda22a2c96e46eff2bd57a90aad0765
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs758561
milestone15.0a1
Bug 758561 - Don't build a mask for an empty layer. r=roc
layout/base/FrameLayerBuilder.cpp
--- 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 &&