Bug 1419508 - Return early from CreateMaskLayer if there is no visible data - r=mattwoodrow a=lizzard
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 25 Jan 2018 16:21:23 +1100
changeset 454803 286bf1028f5bcfee5b018338c32513ef6f34c4a4
parent 454802 fc80116ddfa63a8300df745b0078fda6897dd90b
child 454804 7c3d1a48781b90db6ab70a9abeaa4fcd612e581a
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, lizzard
bugs1419508
milestone59.0
Bug 1419508 - Return early from CreateMaskLayer if there is no visible data - r=mattwoodrow a=lizzard MozReview-Commit-ID: 9jWGXA2eGvv
layout/painting/FrameLayerBuilder.cpp
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -6353,16 +6353,20 @@ ContainerState::CreateMaskLayer(Layer *a
   MaskLayerUserData newData(aClip, aRoundedRectClipCount, A2D, mParameters);
   if (*userData == newData) {
     return maskLayer.forget();
   }
 
   gfx::Rect boundingRect = CalculateBounds(newData.mRoundedClipRects,
                                            newData.mAppUnitsPerDevPixel);
   boundingRect.Scale(mParameters.mXScale, mParameters.mYScale);
+  if (boundingRect.IsEmpty()) {
+    // Return early if we know that there is effectively no visible data.
+    return nullptr;
+  }
 
   uint32_t maxSize = mManager->GetMaxTextureSize();
   NS_ASSERTION(maxSize > 0, "Invalid max texture size");
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
   // Make mask image width aligned to 4. See Bug 1245552.
   gfx::Size surfaceSize(std::min<gfx::Float>(GetAlignedStride<4>(NSToIntCeil(boundingRect.Width()), 1), maxSize),
                         std::min<gfx::Float>(boundingRect.Height(), maxSize));
 #else