Bug 1508822 - Guard against trying to create an oversized DrawTargetRecording with WebRender. r=mstange
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 26 Nov 2018 18:14:59 +0000
changeset 507297 49a2721bf1d805bba91fdf5c18b638925395d85d
parent 507296 5c990a7c358c28af90cd8eaa6bfaf1b8bda061e5
child 507298 2d4d18da8dc3114f66eb405d7f1aa937464128a7
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1508822
milestone65.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 1508822 - Guard against trying to create an oversized DrawTargetRecording with WebRender. r=mstange Differential Revision: https://phabricator.services.mozilla.com/D12950
gfx/tests/crashtests/1508822.html
gfx/tests/crashtests/crashtests.list
layout/svg/nsSVGIntegrationUtils.cpp
new file mode 100644
--- /dev/null
+++ b/gfx/tests/crashtests/1508822.html
@@ -0,0 +1,5 @@
+<style>
+* { scale: 0.55749 10 1 }
+</style>
+<svg>
+<circle r="49%" mask="url()">
--- a/gfx/tests/crashtests/crashtests.list
+++ b/gfx/tests/crashtests/crashtests.list
@@ -170,8 +170,9 @@ load 1468020.html
 load 1470437.html
 load 1470440.html
 load 1478035.html
 load 1490704-1.html
 load 1501518.html
 load 1503986-1.html
 load 1505426-1.html
 load 1508811.html
+load 1508822.html
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -577,16 +577,20 @@ CreateAndPaintMaskSurface(const PaintFra
   }
 
   const IntRect& maskSurfaceRect = aParams.maskRect;
   if (maskSurfaceRect.IsEmpty()) {
     paintResult.transparentBlackMask = true;
     return paintResult;
   }
 
+  if (!ctx.GetDrawTarget()->CanCreateSimilarDrawTarget(maskSurfaceRect.Size(),
+                                                       SurfaceFormat::A8)) {
+    return paintResult;
+  }
   RefPtr<DrawTarget> maskDT =
       ctx.GetDrawTarget()->CreateSimilarDrawTarget(maskSurfaceRect.Size(),
                                                    SurfaceFormat::A8);
   if (!maskDT || !maskDT->IsValid()) {
     return paintResult;
   }
 
   // We can paint mask along with opacity only if