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 95139 9cc3b4fc60c545be2f7060cbcc192eff26727cbd
parent 95138 f0c3e8edc333d54052d87df47d4035519cc81bfc
child 95140 ee5b6efa9bda22a2c96e46eff2bd57a90aad0765
push id22783
push useremorley@mozilla.com
push dateTue, 29 May 2012 11:53:52 +0000
treeherdermozilla-central@78852a6d11ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs758561
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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 &&