Bug 1513387: Add braces & newlines to re-wrap some return statements that clang-format unwrapped, in layout/svg. r=heycam
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 12 Dec 2018 06:32:44 +0000
changeset 450246 8bf181f9b1c3daa66390ab03b6bc9f27c049f770
parent 450245 c322f02577d386a90b72d29bf98d99256de13563
child 450247 ddb7c9f71ce2883ab9d1912fc09bee67b9f83f09
push id110462
push userrmaries@mozilla.com
push dateWed, 12 Dec 2018 16:38:27 +0000
treeherdermozilla-inbound@c9a1a821b318 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1513387
milestone66.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 1513387: Add braces & newlines to re-wrap some return statements that clang-format unwrapped, in layout/svg. r=heycam This patch shouldn't affect behavior; it's just making the existing control flow clearer and more debuggable. Differential Revision: https://phabricator.services.mozilla.com/D14216
layout/svg/SVGGeometryFrame.cpp
layout/svg/SVGObserverUtils.cpp
layout/svg/SVGTextFrame.cpp
layout/svg/nsFilterInstance.cpp
layout/svg/nsSVGClipPathFrame.cpp
layout/svg/nsSVGFilterFrame.cpp
layout/svg/nsSVGFilterInstance.cpp
layout/svg/nsSVGForeignObjectFrame.cpp
layout/svg/nsSVGGradientFrame.cpp
layout/svg/nsSVGImageFrame.cpp
layout/svg/nsSVGIntegrationUtils.cpp
layout/svg/nsSVGMarkerFrame.cpp
layout/svg/nsSVGPatternFrame.cpp
layout/svg/nsSVGUtils.cpp
--- a/layout/svg/SVGGeometryFrame.cpp
+++ b/layout/svg/SVGGeometryFrame.cpp
@@ -241,17 +241,19 @@ void SVGGeometryFrame::BuildDisplayList(
 
 //----------------------------------------------------------------------
 // nsSVGDisplayableFrame methods
 
 void SVGGeometryFrame::PaintSVG(gfxContext& aContext,
                                 const gfxMatrix& aTransform,
                                 imgDrawingParams& aImgParams,
                                 const nsIntRect* aDirtyRect) {
-  if (!StyleVisibility()->IsVisible()) return;
+  if (!StyleVisibility()->IsVisible()) {
+    return;
+  }
 
   // Matrix to the geometry's user space:
   gfxMatrix newMatrix =
       aContext.CurrentMatrixDouble().PreMultiply(aTransform).NudgeToIntegers();
   if (newMatrix.IsSingular()) {
     return;
   }
 
@@ -330,17 +332,19 @@ nsIFrame* SVGGeometryFrame::GetFrameForP
       point = ToMatrix(userToOuterSVG).TransformPoint(point);
       RefPtr<PathBuilder> builder =
           path->TransformedCopyToBuilder(ToMatrix(userToOuterSVG), fillRule);
       path = builder->Finish();
     }
     isHit = path->StrokeContainsPoint(stroke, point, Matrix());
   }
 
-  if (isHit && nsSVGUtils::HitTestClip(this, aPoint)) return this;
+  if (isHit && nsSVGUtils::HitTestClip(this, aPoint)) {
+    return this;
+  }
 
   return nullptr;
 }
 
 void SVGGeometryFrame::ReflowSVG() {
   NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
                "This call is probably a wasteful mistake");
 
--- a/layout/svg/SVGObserverUtils.cpp
+++ b/layout/svg/SVGObserverUtils.cpp
@@ -131,17 +131,19 @@ nsIFrame* SVGRenderingObserver::GetAndOb
   Element* referencedElement = GetAndObserveReferencedElement();
   return referencedElement ? referencedElement->GetPrimaryFrame() : nullptr;
 }
 
 nsIFrame* SVGRenderingObserver::GetAndObserveReferencedFrame(
     LayoutFrameType aFrameType, bool* aOK) {
   nsIFrame* frame = GetAndObserveReferencedFrame();
   if (frame) {
-    if (frame->Type() == aFrameType) return frame;
+    if (frame->Type() == aFrameType) {
+      return frame;
+    }
     if (aOK) {
       *aOK = false;
     }
   }
   return nullptr;
 }
 
 void SVGRenderingObserver::OnNonDOMMutationRenderingChange() {
@@ -648,17 +650,19 @@ class SVGFilterObserverListForCSSProp fi
  protected:
   void OnRenderingChange() override;
 
   nsSVGFrameReferenceFromProperty mFrameReference;
 };
 
 void SVGFilterObserverListForCSSProp::OnRenderingChange() {
   nsIFrame* frame = mFrameReference.Get();
-  if (!frame) return;
+  if (!frame) {
+    return;
+  }
 
   // Repaint asynchronously in case the filter frame is being torn down
   nsChangeHint changeHint = nsChangeHint(nsChangeHint_RepaintFrame);
 
   // Since we don't call nsSVGRenderingObserverProperty::
   // OnRenderingChange, we have to add this bit ourselves.
   if (frame->HasAllStateBits(NS_FRAME_SVG_LAYOUT)) {
     // Changes should propagate out to things that might be observing
@@ -987,20 +991,24 @@ NS_DECLARE_FRAME_PROPERTY_RELEASABLE(Hre
                                      SVGTextPathObserver)
 NS_DECLARE_FRAME_PROPERTY_DELETABLE(BackgroundImageProperty,
                                     URIObserverHashtable)
 
 template <class T>
 static T* GetEffectProperty(
     URLAndReferrerInfo* aURI, nsIFrame* aFrame,
     const mozilla::FramePropertyDescriptor<T>* aProperty) {
-  if (!aURI) return nullptr;
+  if (!aURI) {
+    return nullptr;
+  }
 
   T* prop = aFrame->GetProperty(aProperty);
-  if (prop) return prop;
+  if (prop) {
+    return prop;
+  }
   prop = new T(aURI, aFrame, false);
   NS_ADDREF(prop);
   aFrame->SetProperty(aProperty, prop);
   return prop;
 }
 
 static nsSVGPaintingProperty* GetPaintingProperty(
     URLAndReferrerInfo* aURI, nsIFrame* aFrame,
@@ -1348,35 +1356,42 @@ nsSVGPaintServerFrame* SVGObserverUtils:
     frame = frame->GetParent();
     nsIFrame* grandparent = frame->GetParent();
     if (grandparent && grandparent->IsSVGTextFrame()) {
       frame = grandparent;
     }
   }
 
   const nsStyleSVG* svgStyle = frame->StyleSVG();
-  if ((svgStyle->*aPaint).Type() != eStyleSVGPaintType_Server) return nullptr;
+  if ((svgStyle->*aPaint).Type() != eStyleSVGPaintType_Server) {
+    return nullptr;
+  }
 
   RefPtr<URLAndReferrerInfo> paintServerURL =
       ResolveURLUsingLocalRef(frame, (svgStyle->*aPaint).GetPaintServer());
 
   MOZ_ASSERT(aPaint == &nsStyleSVG::mFill || aPaint == &nsStyleSVG::mStroke);
   PaintingPropertyDescriptor propDesc =
       (aPaint == &nsStyleSVG::mFill) ? FillProperty() : StrokeProperty();
   nsSVGPaintingProperty* property =
       GetPaintingProperty(paintServerURL, frame, propDesc);
-  if (!property) return nullptr;
+  if (!property) {
+    return nullptr;
+  }
   nsIFrame* result = property->GetAndObserveReferencedFrame();
-  if (!result) return nullptr;
+  if (!result) {
+    return nullptr;
+  }
 
   LayoutFrameType type = result->Type();
   if (type != LayoutFrameType::SVGLinearGradient &&
       type != LayoutFrameType::SVGRadialGradient &&
-      type != LayoutFrameType::SVGPattern)
+      type != LayoutFrameType::SVGPattern) {
     return nullptr;
+  }
 
   return static_cast<nsSVGPaintServerFrame*>(result);
 }
 
 void SVGObserverUtils::UpdateEffects(nsIFrame* aFrame) {
   NS_ASSERTION(aFrame->GetContent()->IsElement(),
                "aFrame's content should be an element");
 
@@ -1444,17 +1459,19 @@ void SVGObserverUtils::RemoveAllRenderin
   }
 }
 
 void SVGObserverUtils::InvalidateRenderingObservers(nsIFrame* aFrame) {
   NS_ASSERTION(!aFrame->GetPrevContinuation(),
                "aFrame must be first continuation");
 
   nsIContent* content = aFrame->GetContent();
-  if (!content || !content->IsElement()) return;
+  if (!content || !content->IsElement()) {
+    return;
+  }
 
   // If the rendering has changed, the bounds may well have changed too:
   aFrame->DeleteProperty(nsSVGUtils::ObjectBoundingBoxProperty());
 
   SVGRenderingObserverSet* observers = GetObserverSet(content->AsElement());
   if (observers) {
     observers->InvalidateAll();
     return;
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -2944,17 +2944,19 @@ void SVGTextFrame::BuildDisplayList(nsDi
   }
   DisplayOutline(aBuilder, aLists);
   aLists.Content()->AppendToTop(
       MakeDisplayItem<nsDisplaySVGText>(aBuilder, this));
 }
 
 nsresult SVGTextFrame::AttributeChanged(int32_t aNameSpaceID,
                                         nsAtom* aAttribute, int32_t aModType) {
-  if (aNameSpaceID != kNameSpaceID_None) return NS_OK;
+  if (aNameSpaceID != kNameSpaceID_None) {
+    return NS_OK;
+  }
 
   if (aAttribute == nsGkAtoms::transform) {
     // We don't invalidate for transform changes (the layers code does that).
     // Also note that SVGTransformableElement::GetAttributeChangeHint will
     // return nsChangeHint_UpdateOverflow for "transform" attribute changes
     // and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
 
     if (!(mState & NS_FRAME_FIRST_REFLOW) && mCanvasTM &&
@@ -4481,17 +4483,19 @@ enum TextAnchorSide { eAnchorLeft, eAnch
 
 /**
  * Converts a logical text-anchor value to its physical value, based on whether
  * it is for an RTL frame.
  */
 static TextAnchorSide ConvertLogicalTextAnchorToPhysical(uint8_t aTextAnchor,
                                                          bool aIsRightToLeft) {
   NS_ASSERTION(aTextAnchor <= 3, "unexpected value for aTextAnchor");
-  if (!aIsRightToLeft) return TextAnchorSide(aTextAnchor);
+  if (!aIsRightToLeft) {
+    return TextAnchorSide(aTextAnchor);
+  }
   return TextAnchorSide(2 - aTextAnchor);
 }
 
 /**
  * Shifts the recorded character positions for an anchored chunk.
  *
  * @param aCharPositions The recorded character positions.
  * @param aChunkStart The character index the starts the anchored chunk.  This
@@ -5048,17 +5052,19 @@ void SVGTextFrame::MaybeResolveBidiForAn
     MOZ_ASSERT(static_cast<nsBlockFrame*>(do_QueryFrame(kid)),
                "Expect anonymous child to be an nsBlockFrame");
     nsBidiPresUtils::Resolve(static_cast<nsBlockFrame*>(kid));
   }
 }
 
 void SVGTextFrame::MaybeReflowAnonymousBlockChild() {
   nsIFrame* kid = PrincipalChildList().FirstChild();
-  if (!kid) return;
+  if (!kid) {
+    return;
+  }
 
   NS_ASSERTION(!(kid->GetStateBits() & NS_FRAME_IN_REFLOW),
                "should not be in reflow when about to reflow again");
 
   if (NS_SUBTREE_DIRTY(this)) {
     if (mState & NS_FRAME_IS_DIRTY) {
       // If we require a full reflow, ensure our kid is marked fully dirty.
       // (Note that our anonymous nsBlockFrame is not an nsSVGDisplayableFrame,
@@ -5096,17 +5102,19 @@ void SVGTextFrame::DoReflow() {
     // observers, which reschedules the frame that is currently painting by
     // referencing us to paint again. See bug 839958 comment 7. Hopefully we
     // will break that loop more convincingly at some point.
     RemoveStateBits(NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN);
   }
 
   nsPresContext* presContext = PresContext();
   nsIFrame* kid = PrincipalChildList().FirstChild();
-  if (!kid) return;
+  if (!kid) {
+    return;
+  }
 
   RefPtr<gfxContext> renderingContext =
       presContext->PresShell()->CreateReferenceRenderingContext();
 
   if (UpdateFontSizeScaleFactor()) {
     // If the font size scale factor changed, we need the block to report
     // an updated preferred width.
     kid->MarkIntrinsicISizesDirty();
--- a/layout/svg/nsFilterInstance.cpp
+++ b/layout/svg/nsFilterInstance.cpp
@@ -718,17 +718,19 @@ nsRect nsFilterInstance::ComputePostFilt
 
 nsRect nsFilterInstance::ComputeSourceNeededRect() {
   ComputeNeededBoxes();
   return FilterSpaceToFrameSpace(mSourceGraphic.mNeededBounds);
 }
 
 nsIntRect nsFilterInstance::OutputFilterSpaceBounds() const {
   uint32_t numPrimitives = mFilterDescription.mPrimitives.Length();
-  if (numPrimitives <= 0) return nsIntRect();
+  if (numPrimitives <= 0) {
+    return nsIntRect();
+  }
 
   return mFilterDescription.mPrimitives[numPrimitives - 1].PrimitiveSubregion();
 }
 
 nsIntRect nsFilterInstance::FrameSpaceToFilterSpace(const nsRect* aRect) const {
   nsIntRect rect = OutputFilterSpaceBounds();
   if (aRect) {
     if (aRect->IsEmpty()) {
--- a/layout/svg/nsSVGClipPathFrame.cpp
+++ b/layout/svg/nsSVGClipPathFrame.cpp
@@ -328,17 +328,19 @@ bool nsSVGClipPathFrame::IsTrivial(nsSVG
 
   nsSVGDisplayableFrame* foundChild = nullptr;
 
   for (nsIFrame* kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) {
     nsSVGDisplayableFrame* svgChild = do_QueryFrame(kid);
     if (svgChild) {
       // We consider a non-trivial clipPath to be one containing
       // either more than one svg child and/or a svg container
-      if (foundChild || svgChild->IsDisplayContainer()) return false;
+      if (foundChild || svgChild->IsDisplayContainer()) {
+        return false;
+      }
 
       // or where the child is itself clipped
       if (SVGObserverUtils::GetAndObserveClipPath(kid, nullptr) ==
           SVGObserverUtils::eHasRefsAllValid) {
         return false;
       }
 
       foundChild = svgChild;
--- a/layout/svg/nsSVGFilterFrame.cpp
+++ b/layout/svg/nsSVGFilterFrame.cpp
@@ -28,17 +28,19 @@ nsIFrame* NS_NewSVGFilterFrame(nsIPresSh
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsSVGFilterFrame)
 
 uint16_t nsSVGFilterFrame::GetEnumValue(uint32_t aIndex, nsIContent* aDefault) {
   nsSVGEnum& thisEnum =
       static_cast<SVGFilterElement*>(GetContent())->mEnumAttributes[aIndex];
 
-  if (thisEnum.IsExplicitlySet()) return thisEnum.GetAnimValue();
+  if (thisEnum.IsExplicitlySet()) {
+    return thisEnum.GetAnimValue();
+  }
 
   // Before we recurse, make sure we'll break reference loops and over long
   // reference chains:
   static int16_t sRefChainLengthCounter = AutoReferenceChainGuard::noChain;
   AutoReferenceChainGuard refChainGuard(this, &mLoopFlag,
                                         &sRefChainLengthCounter);
   if (MOZ_UNLIKELY(!refChainGuard.Reference())) {
     // Break reference chain
@@ -55,17 +57,19 @@ uint16_t nsSVGFilterFrame::GetEnumValue(
                     .GetAnimValue();
 }
 
 const nsSVGLength2* nsSVGFilterFrame::GetLengthValue(uint32_t aIndex,
                                                      nsIContent* aDefault) {
   const nsSVGLength2* thisLength =
       &static_cast<SVGFilterElement*>(GetContent())->mLengthAttributes[aIndex];
 
-  if (thisLength->IsExplicitlySet()) return thisLength;
+  if (thisLength->IsExplicitlySet()) {
+    return thisLength;
+  }
 
   // Before we recurse, make sure we'll break reference loops and over long
   // reference chains:
   static int16_t sRefChainLengthCounter = AutoReferenceChainGuard::noChain;
   AutoReferenceChainGuard refChainGuard(this, &mLoopFlag,
                                         &sRefChainLengthCounter);
   if (MOZ_UNLIKELY(!refChainGuard.Reference())) {
     // Break reference chain
--- a/layout/svg/nsSVGFilterInstance.cpp
+++ b/layout/svg/nsSVGFilterInstance.cpp
@@ -276,17 +276,19 @@ static int32_t GetLastResultIndex(
              ? FilterPrimitiveDescription::kPrimitiveIndexSourceGraphic
              : numPrimitiveDescrs - 1;
 }
 
 int32_t nsSVGFilterInstance::GetOrCreateSourceAlphaIndex(
     nsTArray<FilterPrimitiveDescription>& aPrimitiveDescrs) {
   // If the SourceAlpha index has already been determined or created for this
   // SVG filter, just return it.
-  if (mSourceAlphaAvailable) return mSourceAlphaIndex;
+  if (mSourceAlphaAvailable) {
+    return mSourceAlphaIndex;
+  }
 
   // If this is the first filter in the chain, we can just use the
   // kPrimitiveIndexSourceAlpha keyword to refer to the SourceAlpha of the
   // original image.
   if (mSourceGraphicIndex < 0) {
     mSourceAlphaIndex = FilterPrimitiveDescription::kPrimitiveIndexSourceAlpha;
     mSourceAlphaAvailable = true;
     return mSourceAlphaIndex;
--- a/layout/svg/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/nsSVGForeignObjectFrame.cpp
@@ -226,17 +226,19 @@ void nsSVGForeignObjectFrame::PaintSVG(g
     kidDirtyRect.IntersectRect(kidDirtyRect,
                                nsLayoutUtils::RoundGfxRectToAppRect(
                                    transDirtyRect, AppUnitsPerCSSPixel()));
 
     // XXX after bug 614732 is fixed, we will compare mRect with aDirtyRect,
     // not with kidDirtyRect. I.e.
     // int32_t appUnitsPerDevPx = PresContext()->AppUnitsPerDevPixel();
     // mRect.ToOutsidePixels(appUnitsPerDevPx).Intersects(*aDirtyRect)
-    if (kidDirtyRect.IsEmpty()) return;
+    if (kidDirtyRect.IsEmpty()) {
+      return;
+    }
   }
 
   aContext.Save();
 
   if (StyleDisplay()->IsScrollableOverflow()) {
     float x, y, width, height;
     static_cast<nsSVGElement*>(GetContent())
         ->GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
@@ -272,20 +274,24 @@ void nsSVGForeignObjectFrame::PaintSVG(g
 }
 
 nsIFrame* nsSVGForeignObjectFrame::GetFrameForPoint(const gfxPoint& aPoint) {
   NS_ASSERTION(!NS_SVGDisplayListHitTestingEnabled() ||
                    (mState & NS_FRAME_IS_NONDISPLAY),
                "If display lists are enabled, only hit-testing of a "
                "clipPath's contents should take this code path");
 
-  if (IsDisabled() || (GetStateBits() & NS_FRAME_IS_NONDISPLAY)) return nullptr;
+  if (IsDisabled() || (GetStateBits() & NS_FRAME_IS_NONDISPLAY)) {
+    return nullptr;
+  }
 
   nsIFrame* kid = PrincipalChildList().FirstChild();
-  if (!kid) return nullptr;
+  if (!kid) {
+    return nullptr;
+  }
 
   float x, y, width, height;
   static_cast<nsSVGElement*>(GetContent())
       ->GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
 
   if (!gfxRect(x, y, width, height).Contains(aPoint) ||
       !nsSVGUtils::HitTestClip(this, aPoint)) {
     return nullptr;
@@ -470,29 +476,35 @@ gfxMatrix nsSVGForeignObjectFrame::GetCa
 
 void nsSVGForeignObjectFrame::RequestReflow(
     nsIPresShell::IntrinsicDirty aType) {
   if (GetStateBits() & NS_FRAME_FIRST_REFLOW)
     // If we haven't had a ReflowSVG() yet, nothing to do.
     return;
 
   nsIFrame* kid = PrincipalChildList().FirstChild();
-  if (!kid) return;
+  if (!kid) {
+    return;
+  }
 
   PresShell()->FrameNeedsReflow(kid, aType, NS_FRAME_IS_DIRTY);
 }
 
 void nsSVGForeignObjectFrame::DoReflow() {
   MarkInReflow();
   // Skip reflow if we're zero-sized, unless this is our first reflow.
-  if (IsDisabled() && !(GetStateBits() & NS_FRAME_FIRST_REFLOW)) return;
+  if (IsDisabled() && !(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
+    return;
+  }
 
   nsPresContext* presContext = PresContext();
   nsIFrame* kid = PrincipalChildList().FirstChild();
-  if (!kid) return;
+  if (!kid) {
+    return;
+  }
 
   // initiate a synchronous reflow here and now:
   RefPtr<gfxContext> renderingContext =
       presContext->PresShell()->CreateReferenceRenderingContext();
 
   mInReflow = true;
 
   WritingMode wm = kid->GetWritingMode();
--- a/layout/svg/nsSVGGradientFrame.cpp
+++ b/layout/svg/nsSVGGradientFrame.cpp
@@ -64,17 +64,19 @@ nsresult nsSVGGradientFrame::AttributeCh
 //----------------------------------------------------------------------
 
 uint16_t nsSVGGradientFrame::GetEnumValue(uint32_t aIndex,
                                           nsIContent* aDefault) {
   const nsSVGEnum& thisEnum =
       static_cast<dom::SVGGradientElement*>(GetContent())
           ->mEnumAttributes[aIndex];
 
-  if (thisEnum.IsExplicitlySet()) return thisEnum.GetAnimValue();
+  if (thisEnum.IsExplicitlySet()) {
+    return thisEnum.GetAnimValue();
+  }
 
   // Before we recurse, make sure we'll break reference loops and over long
   // reference chains:
   static int16_t sRefChainLengthCounter = AutoReferenceChainGuard::noChain;
   AutoReferenceChainGuard refChainGuard(this, &mLoopFlag,
                                         &sRefChainLengthCounter);
   if (MOZ_UNLIKELY(!refChainGuard.Reference())) {
     // Break reference chain
@@ -143,17 +145,19 @@ gfxMatrix nsSVGGradientFrame::GetGradien
                              aSource, nsSVGUtils::eUseFrameBoundsForOuterSVG |
                                           nsSVGUtils::eBBoxIncludeFillGeometry);
     bboxMatrix =
         gfxMatrix(bbox.Width(), 0, 0, bbox.Height(), bbox.X(), bbox.Y());
   }
 
   const nsSVGAnimatedTransformList* animTransformList =
       GetGradientTransformList(GetContent());
-  if (!animTransformList) return bboxMatrix;
+  if (!animTransformList) {
+    return bboxMatrix;
+  }
 
   gfxMatrix gradientTransform =
       animTransformList->GetAnimValue().GetConsolidationMatrix();
   return bboxMatrix.PreMultiply(gradientTransform);
 }
 
 dom::SVGLinearGradientElement* nsSVGGradientFrame::GetLinearGradientWithLength(
     uint32_t aIndex, dom::SVGLinearGradientElement* aDefault) {
--- a/layout/svg/nsSVGImageFrame.cpp
+++ b/layout/svg/nsSVGImageFrame.cpp
@@ -500,17 +500,19 @@ uint16_t nsSVGImageFrame::GetHitTestFlag
 NS_IMPL_ISUPPORTS(nsSVGImageListener, imgINotificationObserver)
 
 nsSVGImageListener::nsSVGImageListener(nsSVGImageFrame* aFrame)
     : mFrame(aFrame) {}
 
 NS_IMETHODIMP
 nsSVGImageListener::Notify(imgIRequest* aRequest, int32_t aType,
                            const nsIntRect* aData) {
-  if (!mFrame) return NS_ERROR_FAILURE;
+  if (!mFrame) {
+    return NS_ERROR_FAILURE;
+  }
 
   if (aType == imgINotificationObserver::LOAD_COMPLETE) {
     mFrame->InvalidateFrame();
     nsLayoutUtils::PostRestyleEvent(mFrame->GetContent()->AsElement(),
                                     nsRestyleHint(0),
                                     nsChangeHint_InvalidateRenderingObservers);
     nsSVGUtils::ScheduleReflowSVG(mFrame);
   }
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -1120,17 +1120,19 @@ class PaintFrameCallback : public gfxDra
   IntSize mRenderSize;
   uint32_t mFlags;
 };
 
 bool PaintFrameCallback::operator()(gfxContext* aContext,
                                     const gfxRect& aFillRect,
                                     const SamplingFilter aSamplingFilter,
                                     const gfxMatrix& aTransform) {
-  if (mFrame->GetStateBits() & NS_FRAME_DRAWING_AS_PAINTSERVER) return false;
+  if (mFrame->GetStateBits() & NS_FRAME_DRAWING_AS_PAINTSERVER) {
+    return false;
+  }
 
   AutoSetRestorePaintServerState paintServer(mFrame);
 
   aContext->Save();
 
   // Clip to aFillRect so that we don't paint outside.
   aContext->NewPath();
   aContext->Rectangle(aFillRect);
@@ -1214,17 +1216,19 @@ nsSVGIntegrationUtils::DrawableFromPaint
     gfxRect overrideBounds(0, 0, aPaintServerSize.width,
                            aPaintServerSize.height);
     overrideBounds.Scale(1.0 / aFrame->PresContext()->AppUnitsPerDevPixel());
     imgDrawingParams imgParams(aFlags);
     RefPtr<gfxPattern> pattern = server->GetPaintServerPattern(
         aTarget, aDrawTarget, aContextMatrix, &nsStyleSVG::mFill, 1.0,
         imgParams, &overrideBounds);
 
-    if (!pattern) return nullptr;
+    if (!pattern) {
+      return nullptr;
+    }
 
     // pattern is now set up to fill aPaintServerSize. But we want it to
     // fill aRenderSize, so we need to add a scaling transform.
     // We couldn't just have set overrideBounds to aRenderSize - it would have
     // worked for gradients, but for patterns it would result in a different
     // pattern size.
     gfxFloat scaleX = overrideBounds.Width() / aRenderSize.width;
     gfxFloat scaleY = overrideBounds.Height() / aRenderSize.height;
--- a/layout/svg/nsSVGMarkerFrame.cpp
+++ b/layout/svg/nsSVGMarkerFrame.cpp
@@ -138,17 +138,19 @@ SVGBBox nsSVGMarkerFrame::GetMarkBBoxCon
     const Matrix& aToBBoxUserspace, uint32_t aFlags,
     SVGGeometryFrame* aMarkedFrame, const nsSVGMark& aMark,
     float aStrokeWidth) {
   SVGBBox bbox;
 
   // If the flag is set when we get here, it means this marker frame
   // has already been used in calculating the current mark bbox, and
   // the document has a marker reference loop.
-  if (mInUse) return bbox;
+  if (mInUse) {
+    return bbox;
+  }
 
   AutoMarkerReferencer markerRef(this, aMarkedFrame);
 
   SVGMarkerElement* content = static_cast<SVGMarkerElement*>(GetContent());
   if (!content->HasValidDimensions()) {
     return bbox;
   }
 
--- a/layout/svg/nsSVGPatternFrame.cpp
+++ b/layout/svg/nsSVGPatternFrame.cpp
@@ -379,42 +379,48 @@ already_AddRefed<SourceSurface> nsSVGPat
 }
 
 /* Will probably need something like this... */
 // How do we handle the insertion of a new frame?
 // We really don't want to rerender this every time,
 // do we?
 nsSVGPatternFrame *nsSVGPatternFrame::GetPatternWithChildren() {
   // Do we have any children ourselves?
-  if (!mFrames.IsEmpty()) return this;
+  if (!mFrames.IsEmpty()) {
+    return this;
+  }
 
   // No, see if we chain to someone who does
 
   // Before we recurse, make sure we'll break reference loops and over long
   // reference chains:
   static int16_t sRefChainLengthCounter = AutoReferenceChainGuard::noChain;
   AutoReferenceChainGuard refChainGuard(this, &mLoopFlag,
                                         &sRefChainLengthCounter);
   if (MOZ_UNLIKELY(!refChainGuard.Reference())) {
     // Break reference chain
     return nullptr;
   }
 
   nsSVGPatternFrame *next = GetReferencedPattern();
-  if (!next) return nullptr;
+  if (!next) {
+    return nullptr;
+  }
 
   return next->GetPatternWithChildren();
 }
 
 uint16_t nsSVGPatternFrame::GetEnumValue(uint32_t aIndex,
                                          nsIContent *aDefault) {
   nsSVGEnum &thisEnum =
       static_cast<SVGPatternElement *>(GetContent())->mEnumAttributes[aIndex];
 
-  if (thisEnum.IsExplicitlySet()) return thisEnum.GetAnimValue();
+  if (thisEnum.IsExplicitlySet()) {
+    return thisEnum.GetAnimValue();
+  }
 
   // Before we recurse, make sure we'll break reference loops and over long
   // reference chains:
   static int16_t sRefChainLengthCounter = AutoReferenceChainGuard::noChain;
   AutoReferenceChainGuard refChainGuard(this, &mLoopFlag,
                                         &sRefChainLengthCounter);
   if (MOZ_UNLIKELY(!refChainGuard.Reference())) {
     // Break reference chain
@@ -453,26 +459,30 @@ nsSVGAnimatedTransformList *nsSVGPattern
   return next ? next->GetPatternTransformList(aDefault)
               : static_cast<SVGPatternElement *>(aDefault)
                     ->mPatternTransform.get();
 }
 
 gfxMatrix nsSVGPatternFrame::GetPatternTransform() {
   nsSVGAnimatedTransformList *animTransformList =
       GetPatternTransformList(GetContent());
-  if (!animTransformList) return gfxMatrix();
+  if (!animTransformList) {
+    return gfxMatrix();
+  }
 
   return animTransformList->GetAnimValue().GetConsolidationMatrix();
 }
 
 const nsSVGViewBox &nsSVGPatternFrame::GetViewBox(nsIContent *aDefault) {
   const nsSVGViewBox &thisViewBox =
       static_cast<SVGPatternElement *>(GetContent())->mViewBox;
 
-  if (thisViewBox.IsExplicitlySet()) return thisViewBox;
+  if (thisViewBox.IsExplicitlySet()) {
+    return thisViewBox;
+  }
 
   // Before we recurse, make sure we'll break reference loops and over long
   // reference chains:
   static int16_t sRefChainLengthCounter = AutoReferenceChainGuard::noChain;
   AutoReferenceChainGuard refChainGuard(this, &mLoopFlag,
                                         &sRefChainLengthCounter);
   if (MOZ_UNLIKELY(!refChainGuard.Reference())) {
     // Break reference chain
@@ -484,17 +494,19 @@ const nsSVGViewBox &nsSVGPatternFrame::G
               : static_cast<SVGPatternElement *>(aDefault)->mViewBox;
 }
 
 const SVGAnimatedPreserveAspectRatio &nsSVGPatternFrame::GetPreserveAspectRatio(
     nsIContent *aDefault) {
   const SVGAnimatedPreserveAspectRatio &thisPar =
       static_cast<SVGPatternElement *>(GetContent())->mPreserveAspectRatio;
 
-  if (thisPar.IsExplicitlySet()) return thisPar;
+  if (thisPar.IsExplicitlySet()) {
+    return thisPar;
+  }
 
   // Before we recurse, make sure we'll break reference loops and over long
   // reference chains:
   static int16_t sRefChainLengthCounter = AutoReferenceChainGuard::noChain;
   AutoReferenceChainGuard refChainGuard(this, &mLoopFlag,
                                         &sRefChainLengthCounter);
   if (MOZ_UNLIKELY(!refChainGuard.Reference())) {
     // Break reference chain
@@ -508,17 +520,19 @@ const SVGAnimatedPreserveAspectRatio &ns
 }
 
 const nsSVGLength2 *nsSVGPatternFrame::GetLengthValue(uint32_t aIndex,
                                                       nsIContent *aDefault) {
   const nsSVGLength2 *thisLength =
       &static_cast<SVGPatternElement *>(GetContent())
            ->mLengthAttributes[aIndex];
 
-  if (thisLength->IsExplicitlySet()) return thisLength;
+  if (thisLength->IsExplicitlySet()) {
+    return thisLength;
+  }
 
   // Before we recurse, make sure we'll break reference loops and over long
   // reference chains:
   static int16_t sRefChainLengthCounter = AutoReferenceChainGuard::noChain;
   AutoReferenceChainGuard refChainGuard(this, &mLoopFlag,
                                         &sRefChainLengthCounter);
   if (MOZ_UNLIKELY(!refChainGuard.Reference())) {
     // Break reference chain
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -303,17 +303,19 @@ nsSVGOuterSVGFrame* nsSVGUtils::GetOuter
   }
 
   return nullptr;
 }
 
 nsIFrame* nsSVGUtils::GetOuterSVGFrameAndCoveredRegion(nsIFrame* aFrame,
                                                        nsRect* aRect) {
   nsSVGDisplayableFrame* svg = do_QueryFrame(aFrame);
-  if (!svg) return nullptr;
+  if (!svg) {
+    return nullptr;
+  }
   nsSVGOuterSVGFrame* outer = GetOuterSVGFrame(aFrame);
   if (outer == svg) {
     return nullptr;
   }
 
   if (aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY) {
     *aRect = nsRect(0, 0, 0, 0);
   } else {
@@ -580,17 +582,19 @@ void nsSVGUtils::PaintFrameWithEffects(n
                                        const nsIntRect* aDirtyRect) {
   NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() ||
                    (aFrame->GetStateBits() & NS_FRAME_IS_NONDISPLAY) ||
                    aFrame->PresContext()->Document()->IsSVGGlyphsDocument(),
                "If display lists are enabled, only painting of non-display "
                "SVG should take this code path");
 
   nsSVGDisplayableFrame* svgFrame = do_QueryFrame(aFrame);
-  if (!svgFrame) return;
+  if (!svgFrame) {
+    return;
+  }
 
   MaskUsage maskUsage;
   DetermineMaskUsage(aFrame, true, maskUsage);
   if (maskUsage.opacity == 0.0f) {
     return;
   }
 
   const nsIContent* content = aFrame->GetContent();
@@ -951,17 +955,19 @@ gfxRect nsSVGUtils::GetClipRectForFrame(
 
     return clipRect;
   }
   return gfxRect(aX, aY, aWidth, aHeight);
 }
 
 void nsSVGUtils::SetClipRect(gfxContext* aContext, const gfxMatrix& aCTM,
                              const gfxRect& aRect) {
-  if (aCTM.IsSingular()) return;
+  if (aCTM.IsSingular()) {
+    return;
+  }
 
   gfxContextMatrixAutoSaveRestore matrixAutoSaveRestore(aContext);
   aContext->Multiply(aCTM);
   aContext->Clip(aRect);
 }
 
 gfxRect nsSVGUtils::GetBBox(nsIFrame* aFrame, uint32_t aFlags,
                             const gfxMatrix* aToBoundsSpace) {