Bug 1508811 - Guard against trying to create an oversized DrawTargetRecording with WebRender. r=mstange
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 23 Nov 2018 16:43:48 +0000
changeset 507085 d4a83923369d779276c50b88fa2746b2e1a4f153
parent 507084 5283c43535adea04ee57afa232f0df4a876534ab
child 507086 3f6e77ccc5a4ed8cbdd2f08c9cf7444dce072ada
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
bugs1508811
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 1508811 - Guard against trying to create an oversized DrawTargetRecording with WebRender. r=mstange Differential Revision: https://phabricator.services.mozilla.com/D12677
gfx/tests/crashtests/1508811.html
gfx/tests/crashtests/crashtests.list
layout/painting/nsDisplayList.cpp
new file mode 100644
--- /dev/null
+++ b/gfx/tests/crashtests/1508811.html
@@ -0,0 +1,10 @@
+<style>
+* {
+  -webkit-background-clip: text;
+  column-count: 7;
+}
+</style>
+<dialog open="true">
+<dl>
+<dd>
+<menu>
--- a/gfx/tests/crashtests/crashtests.list
+++ b/gfx/tests/crashtests/crashtests.list
@@ -169,8 +169,9 @@ load 1467847-1.html
 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
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -813,16 +813,19 @@ GenerateAndPushTextMask(nsIFrame* aFrame
 
   Matrix currentMatrix = sourceCtx->CurrentMatrix();
   Matrix maskTransform =
     currentMatrix * Matrix::Translation(-drawRect.x, -drawRect.y);
   maskTransform.Invert();
 
   // Create a mask surface.
   RefPtr<DrawTarget> sourceTarget = sourceCtx->GetDrawTarget();
+  if (!sourceTarget->CanCreateSimilarDrawTarget(drawRect.Size(), SurfaceFormat::A8)) {
+    return false;
+  }
   RefPtr<DrawTarget> maskDT = sourceTarget->CreateClippedDrawTarget(
     drawRect.Size(), maskTransform * currentMatrix, SurfaceFormat::A8);
   if (!maskDT || !maskDT->IsValid()) {
     return false;
   }
   RefPtr<gfxContext> maskCtx =
     gfxContext::CreatePreservingTransformOrNull(maskDT);
   MOZ_ASSERT(maskCtx);