Bug 1542646 Part 9 - Fix else after return r=dholbert
authorlongsonr <longsonr@gmail.com>
Sat, 20 Apr 2019 11:26:19 +0100
changeset 470296 9bb46f41277cf0beec92dd551c86c500dad5c3cf
parent 470293 a092972b53f0e566a36770e7b03363036ff820ec
child 470297 8f243d93742049295c734a5bd6e252d5a7d67c99
push id35894
push userdvarga@mozilla.com
push dateSat, 20 Apr 2019 21:47:58 +0000
treeherdermozilla-central@72be82c6809e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1542646
milestone68.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 1542646 Part 9 - Fix else after return r=dholbert
dom/svg/DOMSVGAngle.cpp
dom/svg/DOMSVGLength.cpp
dom/svg/SVGSVGElement.cpp
dom/svg/SVGTransformableElement.cpp
layout/svg/nsCSSFilterInstance.cpp
layout/svg/nsSVGImageFrame.cpp
--- a/dom/svg/DOMSVGAngle.cpp
+++ b/dom/svg/DOMSVGAngle.cpp
@@ -60,17 +60,18 @@ float DOMSVGAngle::ValueInSpecifiedUnits
   }
   return mVal->mBaseVal;
 }
 
 void DOMSVGAngle::SetValueInSpecifiedUnits(float aValue, ErrorResult& rv) {
   if (mType == AnimValue) {
     rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
     return;
-  } else if (mType == BaseValue) {
+  }
+  if (mType == BaseValue) {
     mVal->SetBaseValueInSpecifiedUnits(aValue, mSVGElement);
   } else {
     mVal->mBaseVal = aValue;
   }
 }
 
 void DOMSVGAngle::NewValueSpecifiedUnits(uint16_t unitType,
                                          float valueInSpecifiedUnits,
--- a/dom/svg/DOMSVGLength.cpp
+++ b/dom/svg/DOMSVGLength.cpp
@@ -207,18 +207,19 @@ float DOMSVGLength::GetValue(ErrorResult
     Element()->FlushAnimations();  // May make HasOwner() == false
   }
   if (HasOwner()) {
     float value = InternalItem().GetValueInUserUnits(Element(), Axis());
     if (!IsFinite(value)) {
       aRv.Throw(NS_ERROR_FAILURE);
     }
     return value;
-  } else if (mUnit == SVGLength_Binding::SVG_LENGTHTYPE_NUMBER ||
-             mUnit == SVGLength_Binding::SVG_LENGTHTYPE_PX) {
+  }
+  if (mUnit == SVGLength_Binding::SVG_LENGTHTYPE_NUMBER ||
+      mUnit == SVGLength_Binding::SVG_LENGTHTYPE_PX) {
     return mValue;
   }
   // else [SVGWG issue] Can't convert this length's value to user units
   // ReportToConsole
   aRv.Throw(NS_ERROR_FAILURE);
   return 0.0f;
 }
 
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -212,19 +212,18 @@ bool SVGSVGElement::AnimationsPaused() {
   return root && root->IsPausedByType(SMILTimeContainer::PAUSE_SCRIPT);
 }
 
 float SVGSVGElement::GetCurrentTimeAsFloat() {
   SMILTimeContainer* root = GetTimedDocumentRoot();
   if (root) {
     double fCurrentTimeMs = double(root->GetCurrentTimeAsSMILTime());
     return (float)(fCurrentTimeMs / PR_MSEC_PER_SEC);
-  } else {
-    return 0.f;
   }
+  return 0.f;
 }
 
 void SVGSVGElement::SetCurrentTime(float seconds) {
   if (mTimedDocumentRoot) {
     // Make sure the timegraph is up-to-date
     FlushAnimations();
     double fMilliseconds = double(seconds) * PR_MSEC_PER_SEC;
     // Round to nearest whole number before converting, to avoid precision
@@ -636,17 +635,18 @@ SVGViewElement* SVGSVGElement::GetCurren
   return nullptr;
 }
 
 const SVGAnimatedViewBox& SVGSVGElement::GetViewBoxInternal() const {
   SVGViewElement* viewElement = GetCurrentViewElement();
 
   if (viewElement && viewElement->mViewBox.HasRect()) {
     return viewElement->mViewBox;
-  } else if (mSVGView && mSVGView->mViewBox.HasRect()) {
+  }
+  if (mSVGView && mSVGView->mViewBox.HasRect()) {
     return mSVGView->mViewBox;
   }
 
   return mViewBox;
 }
 
 SVGAnimatedTransformList* SVGSVGElement::GetTransformInternal() const {
   return (mSVGView && mSVGView->mTransforms) ? mSVGView->mTransforms
--- a/dom/svg/SVGTransformableElement.cpp
+++ b/dom/svg/SVGTransformableElement.cpp
@@ -202,40 +202,39 @@ already_AddRefed<SVGIRect> SVGTransforma
     return NS_NewSVGRect(this, ToRect(rec));
   }
 
   if (!NS_SVGNewGetBBoxEnabled()) {
     return NS_NewSVGRect(
         this, ToRect(nsSVGUtils::GetBBox(
                   frame, nsSVGUtils::eBBoxIncludeFillGeometry |
                              nsSVGUtils::eUseUserSpaceOfUseElement)));
-  } else {
-    uint32_t flags = 0;
-    if (aOptions.mFill) {
-      flags |= nsSVGUtils::eBBoxIncludeFill;
-    }
-    if (aOptions.mStroke) {
-      flags |= nsSVGUtils::eBBoxIncludeStroke;
-    }
-    if (aOptions.mMarkers) {
-      flags |= nsSVGUtils::eBBoxIncludeMarkers;
-    }
-    if (aOptions.mClipped) {
-      flags |= nsSVGUtils::eBBoxIncludeClipped;
-    }
-    if (flags == 0) {
-      return NS_NewSVGRect(this, 0, 0, 0, 0);
-    }
-    if (flags == nsSVGUtils::eBBoxIncludeMarkers ||
-        flags == nsSVGUtils::eBBoxIncludeClipped) {
-      flags |= nsSVGUtils::eBBoxIncludeFill;
-    }
-    flags |= nsSVGUtils::eUseUserSpaceOfUseElement;
-    return NS_NewSVGRect(this, ToRect(nsSVGUtils::GetBBox(frame, flags)));
+  }
+  uint32_t flags = 0;
+  if (aOptions.mFill) {
+    flags |= nsSVGUtils::eBBoxIncludeFill;
+  }
+  if (aOptions.mStroke) {
+    flags |= nsSVGUtils::eBBoxIncludeStroke;
+  }
+  if (aOptions.mMarkers) {
+    flags |= nsSVGUtils::eBBoxIncludeMarkers;
   }
+  if (aOptions.mClipped) {
+    flags |= nsSVGUtils::eBBoxIncludeClipped;
+  }
+  if (flags == 0) {
+    return NS_NewSVGRect(this, 0, 0, 0, 0);
+  }
+  if (flags == nsSVGUtils::eBBoxIncludeMarkers ||
+      flags == nsSVGUtils::eBBoxIncludeClipped) {
+    flags |= nsSVGUtils::eBBoxIncludeFill;
+  }
+  flags |= nsSVGUtils::eUseUserSpaceOfUseElement;
+  return NS_NewSVGRect(this, ToRect(nsSVGUtils::GetBBox(frame, flags)));
 }
 
 already_AddRefed<SVGMatrix> SVGTransformableElement::GetCTM() {
   Document* currentDoc = GetComposedDoc();
   if (currentDoc) {
     // Flush all pending notifications so that our frames are up to date
     currentDoc->FlushPendingNotifications(FlushType::Layout);
   }
--- a/layout/svg/nsCSSFilterInstance.cpp
+++ b/layout/svg/nsCSSFilterInstance.cpp
@@ -15,17 +15,18 @@
 #include "nsTArray.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
 static float ClampFactor(float aFactor) {
   if (aFactor > 1) {
     return 1;
-  } else if (aFactor < 0) {
+  }
+  if (aFactor < 0) {
     MOZ_ASSERT_UNREACHABLE("A negative value should not have been parsed.");
     return 0;
   }
 
   return aFactor;
 }
 
 nsCSSFilterInstance::nsCSSFilterInstance(
--- a/layout/svg/nsSVGImageFrame.cpp
+++ b/layout/svg/nsSVGImageFrame.cpp
@@ -120,17 +120,18 @@ nsresult nsSVGImageFrame::AttributeChang
   if (aNameSpaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::x || aAttribute == nsGkAtoms::y ||
         aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) {
       nsLayoutUtils::PostRestyleEvent(
           mContent->AsElement(), RestyleHint{0},
           nsChangeHint_InvalidateRenderingObservers);
       nsSVGUtils::ScheduleReflowSVG(this);
       return NS_OK;
-    } else if (aAttribute == nsGkAtoms::preserveAspectRatio) {
+    }
+    if (aAttribute == nsGkAtoms::preserveAspectRatio) {
       // We don't paint the content of the image using display lists, therefore
       // we have to invalidate for this children-only transform changes since
       // there is no layer tree to notice that the transform changed and
       // recomposite.
       InvalidateFrame();
       return NS_OK;
     }
   }