From 79a23d7ed33f2a0e241429671a8e4709244ef407 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Thu, 5 Jan 2023 14:42:49 +0000 Subject: [PATCH] Bug 1804958 - Avoid unnecessary save/restore in ComputeClipExtsInDeviceSpace. r=gfx-reviewers,tnikkel,jrmuizel I don't expect this to matter for a lot of content, however it avoids an assertion that causes a crashtest to fail. Differential Revision: https://phabricator.services.mozilla.com/D165291 --- layout/svg/SVGUtils.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layout/svg/SVGUtils.cpp b/layout/svg/SVGUtils.cpp index 37f26531a3eb..2e0358219e08 100644 --- a/layout/svg/SVGUtils.cpp +++ b/layout/svg/SVGUtils.cpp @@ -506,9 +506,10 @@ class MixModeBlender { // mode. Clip the source context first, so that we can generate a smaller // temporary surface. (Since we will clip this context in // SetupContextMatrix, a pair of save/restore is needed.) - gfxContextAutoSaveRestore saver(mSourceCtx); + gfxContextAutoSaveRestore saver; if (!mFrame->HasAnyStateBits(NS_FRAME_IS_NONDISPLAY)) { + saver.SetContext(mSourceCtx); // aFrame has a valid ink overflow rect, so clip to it before calling // PushGroup() to minimize the size of the surfaces we'll composite: gfxContextMatrixAutoSaveRestore matrixAutoSaveRestore(mSourceCtx);