Bug 1347646 Part 2: Use CreateRenderingContext in nsSimplePageSequenceFrame::PrePrintNextPage to ensure recorder is used for canvases. r=jwatt
authorBob Owen <bobowencode@gmail.com>
Sat, 08 Apr 2017 22:47:51 +0100
changeset 559353 42dc50db2cdbc53d51be85702037fa26f938cfb5
parent 559352 73cf1505d8139f94608658df48530cdd45019d55
child 559354 11d850f7f23f05dfdebd8f41c15e8478a0419e94
push id53058
push userarchaeopteryx@coole-files.de
push dateSun, 09 Apr 2017 21:36:26 +0000
reviewersjwatt
bugs1347646, 1354624
milestone55.0a1
Bug 1347646 Part 2: Use CreateRenderingContext in nsSimplePageSequenceFrame::PrePrintNextPage to ensure recorder is used for canvases. r=jwatt Calling CreateReferenceRenderingContext currently returns a non-recording DrawTarget even when the nsIDeviceContextSpec within the nsDeviceContext has a DrawEventRecorder, due to bug 1354624. Since we've already called BeginPage we can call CreateRenderingContext instead though and that will give us a recording DrawTarget as we require to record the canvas drawing.
layout/generic/nsSimplePageSequenceFrame.cpp
--- a/layout/generic/nsSimplePageSequenceFrame.cpp
+++ b/layout/generic/nsSimplePageSequenceFrame.cpp
@@ -624,17 +624,17 @@ nsSimplePageSequenceFrame::PrePrintNextP
       nsDeviceContext *dc = PresContext()->DeviceContext();
       PR_PL(("\n"));
       PR_PL(("***************** BeginPage *****************\n"));
       rv = dc->BeginPage();
       NS_ENSURE_SUCCESS(rv, rv);
 
       mCalledBeginPage = true;
       
-      RefPtr<gfxContext> renderingContext = dc->CreateReferenceRenderingContext();
+      RefPtr<gfxContext> renderingContext = dc->CreateRenderingContext();
       NS_ENSURE_TRUE(renderingContext, NS_ERROR_OUT_OF_MEMORY);
 
       DrawTarget* drawTarget = renderingContext->GetDrawTarget();
       if (NS_WARN_IF(!drawTarget)) {
         return NS_ERROR_FAILURE;
       }
 
       for (int32_t i = mCurrentCanvasList.Length() - 1; i >= 0 ; i--) {