Commit 88d1a640 authored by Daniel Holbert's avatar Daniel Holbert
Browse files

Bug 1896711 part 2: Use MakeRefPtr to reduce boilerplate, in layout/svg. r=TYLin

Also remove one unnecessary null-check for an object that we're allocating
infallibly.

Differential Revision: https://phabricator.services.mozilla.com/D210388
parent 65bdc0fc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ void SVGMarkerFrame::PaintMark(gfxContext& aContext,
  ISVGDisplayableFrame* SVGFrame = do_QueryFrame(kid);
  // The CTM of each frame referencing us may be different.
  SVGFrame->NotifySVGChanged(ISVGDisplayableFrame::TRANSFORM_CHANGED);
  RefPtr<SVGContextPaintImpl> contextPaint = new SVGContextPaintImpl();
  auto contextPaint = MakeRefPtr<SVGContextPaintImpl>();
  contextPaint->Init(aContext.GetDrawTarget(), aContext.CurrentMatrixDouble(),
                     aMarkedFrame, SVGContextPaint::GetContextPaint(marker),
                     aImgParams);
+1 −2
Original line number Diff line number Diff line
@@ -1676,8 +1676,7 @@ Element* SVGObserverUtils::GetAndObserveBackgroundImage(nsIFrame* aFrame,
      aFrame->GetContent()
          ->OwnerDoc()
          ->ReferrerInfoForInternalCSSAndSVGResources();
  RefPtr<URLAndReferrerInfo> url =
      new URLAndReferrerInfo(targetURI, referrerInfo);
  auto url = MakeRefPtr<URLAndReferrerInfo>(targetURI, referrerInfo);

  return static_cast<SVGMozElementObserver*>(
             hashtable
+2 −6
Original line number Diff line number Diff line
@@ -688,13 +688,9 @@ already_AddRefed<gfxPattern> SVGPatternFrame::GetPaintServerPattern(
    return nullptr;
  }

  RefPtr<gfxPattern> pattern = new gfxPattern(surface, pMatrix);

  if (!pattern) {
    return nullptr;
  }

  auto pattern = MakeRefPtr<gfxPattern>(surface, pMatrix);
  pattern->SetExtend(ExtendMode::REPEAT);

  return pattern.forget();
}

+1 −1
Original line number Diff line number Diff line
@@ -3142,7 +3142,7 @@ void SVGTextFrame::PaintSVG(gfxContext& aContext, const gfxMatrix& aTransform,
  while (run.mFrame) {
    nsTextFrame* frame = run.mFrame;

    RefPtr<SVGContextPaintImpl> contextPaint = new SVGContextPaintImpl();
    auto contextPaint = MakeRefPtr<SVGContextPaintImpl>();
    DrawMode drawMode = contextPaint->Init(&aDrawTarget, initialMatrix, frame,
                                           outerContextPaint, aImgParams);
    if (drawMode & DrawMode::GLYPH_STROKE) {
+1 −1
Original line number Diff line number Diff line
@@ -513,7 +513,7 @@ class MixModeBlender {

    gfxContextAutoSaveRestore save(mSourceCtx);
    mSourceCtx->SetMatrix(Matrix());  // This will be restored right after.
    RefPtr<gfxPattern> pattern = new gfxPattern(
    auto pattern = MakeRefPtr<gfxPattern>(
        targetSurf, Matrix::Translation(mTargetOffset.x, mTargetOffset.y));
    mSourceCtx->SetPattern(pattern);
    mSourceCtx->Paint();