Bug 1385861 - Part 1. Remove redundant gfxContext::Save/Restore in nsDisplaySVGText::Paint. draft
authorcku <cku@mozilla.com>
Mon, 31 Jul 2017 17:36:06 +0800
changeset 619043 e0018d66e1b34a5e8ff864abbed6fe2400f06f9b
parent 618757 44121dbcac6a9d3ff18ed087a09b3205e5a04db1
child 619044 04ed3483cbb2a42a2774118d492ff2e75508a634
push id71556
push userbmo:cku@mozilla.com
push dateTue, 01 Aug 2017 13:55:40 +0000
bugs1385861, 1385929
milestone56.0a1
Bug 1385861 - Part 1. Remove redundant gfxContext::Save/Restore in nsDisplaySVGText::Paint. nsDisplaySVGText::Paint calls SVGTextFrame::PaintSVG, and we already save/restore context state in SVGTextFrame::PaintSVG. I also filed Bug 1385929 to find a solution to prevent duplicated gfxContext::Save/Restore. MozReview-Commit-ID: 4WxdFZzvmvF
layout/svg/SVGTextFrame.cpp
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -3127,23 +3127,21 @@ nsDisplaySVGText::Paint(nsDisplayListBui
 
   gfxPoint devPixelOffset =
     nsLayoutUtils::PointToGfxPoint(offset, appUnitsPerDevPixel);
 
   gfxMatrix tm = nsSVGUtils::GetCSSPxToDevPxMatrix(mFrame) *
                    gfxMatrix::Translation(devPixelOffset);
 
   gfxContext* ctx = aCtx;
-  ctx->Save();
   imgDrawingParams imgParams(aBuilder->ShouldSyncDecodeImages()
                              ? imgIContainer::FLAG_SYNC_DECODE
                              : imgIContainer::FLAG_SYNC_DECODE_IF_FAST);
   static_cast<SVGTextFrame*>(mFrame)->PaintSVG(*ctx, tm, imgParams);
   nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, imgParams.result);
-  ctx->Restore();
 }
 
 // ---------------------------------------------------------------------
 // nsQueryFrame methods
 
 NS_QUERYFRAME_HEAD(SVGTextFrame)
   NS_QUERYFRAME_ENTRY(SVGTextFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsSVGDisplayContainerFrame)