Bug 1453795 - Layout/Style - Initialize member fields in classes/ structures. r=heycam
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Thu, 14 Jun 2018 12:54:03 +0300
changeset 422542 ebe097110cd2
parent 422541 3c88a15bdd51
child 422543 66ad37417e47
push id34138
push userdluca@mozilla.com
push date2018-06-15 02:39 +0000
treeherdermozilla-central@e51f8dbf0397 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1453795
milestone62.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 1453795 - Layout/Style - Initialize member fields in classes/ structures. r=heycam
layout/style/nsCSSScanner.h
layout/style/nsComputedDOMStyle.cpp
layout/style/nsFontFaceLoader.cpp
layout/style/nsStyleStruct.cpp
layout/style/nsStyleStruct.h
layout/style/nsStyleTransformMatrix.h
layout/style/nsTimingFunction.h
--- a/layout/style/nsCSSScanner.h
+++ b/layout/style/nsCSSScanner.h
@@ -158,17 +158,26 @@ struct nsCSSToken {
 
   void AppendToString(nsString& aBuffer) const;
 };
 
 // Represents an nsCSSScanner's saved position in the input buffer.
 class nsCSSScannerPosition {
   friend class nsCSSScanner;
 public:
-  nsCSSScannerPosition() : mInitialized(false) { }
+  nsCSSScannerPosition()
+    : mOffset(0)
+    , mLineNumber(0)
+    , mLineOffset(0)
+    , mTokenLineNumber(0)
+    , mTokenLineOffset(0)
+    , mTokenOffset(0)
+    , mInitialized(false)
+  {
+  }
 
   uint32_t LineNumber() {
     MOZ_ASSERT(mInitialized);
     return mLineNumber;
   }
 
   uint32_t LineOffset() {
     MOZ_ASSERT(mInitialized);
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -317,16 +317,19 @@ nsComputedDOMStyle::nsComputedDOMStyle(d
   : mDocumentWeak(nullptr)
   , mOuterFrame(nullptr)
   , mInnerFrame(nullptr)
   , mPresShell(nullptr)
   , mStyleType(aStyleType)
   , mComputedStyleGeneration(0)
   , mExposeVisitedStyle(false)
   , mResolvedComputedStyle(false)
+#ifdef DEBUG
+  , mFlushedPendingReflows(false)
+#endif
 {
   MOZ_ASSERT(aElement && aPresShell);
   MOZ_ASSERT(aPresShell->GetPresContext());
 
   mDocumentWeak = do_GetWeakReference(aPresShell->GetDocument());
   mContent = aElement;
   mPseudo = nsCSSPseudoElements::GetPseudoAtom(aPseudoElt);
 }
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -47,20 +47,21 @@ GetShortFallbackDelay()
 {
   return Preferences::GetInt("gfx.downloadable_fonts.fallback_delay_short", 100);
 }
 
 nsFontFaceLoader::nsFontFaceLoader(gfxUserFontEntry* aUserFontEntry,
                                    nsIURI* aFontURI,
                                    FontFaceSet* aFontFaceSet,
                                    nsIChannel* aChannel)
-  : mUserFontEntry(aUserFontEntry),
-    mFontURI(aFontURI),
-    mFontFaceSet(aFontFaceSet),
-    mChannel(aChannel)
+  : mUserFontEntry(aUserFontEntry)
+  , mFontURI(aFontURI)
+  , mFontFaceSet(aFontFaceSet)
+  , mChannel(aChannel)
+  , mStreamLoader(nullptr)
 {
   MOZ_ASSERT(mFontFaceSet,
              "We should get a valid FontFaceSet from the caller!");
   mStartTime = TimeStamp::Now();
 }
 
 nsFontFaceLoader::~nsFontFaceLoader()
 {
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -2284,16 +2284,17 @@ CachedBorderImageData::GetSubImage(uint8
 }
 
 // --------------------
 // nsStyleImage
 //
 
 nsStyleImage::nsStyleImage()
   : mType(eStyleImageType_Null)
+  , mImage(nullptr)
   , mCropRect(nullptr)
 {
   MOZ_COUNT_CTOR(nsStyleImage);
 }
 
 nsStyleImage::~nsStyleImage()
 {
   MOZ_COUNT_DTOR(nsStyleImage);
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -867,17 +867,25 @@ struct nsCSSShadowItem
   nscoord mYOffset;
   nscoord mRadius;
   nscoord mSpread;
 
   nscolor      mColor;
   bool mHasColor; // Whether mColor should be used
   bool mInset;
 
-  nsCSSShadowItem() : mHasColor(false) {
+  nsCSSShadowItem()
+    : mXOffset(0)
+    , mYOffset(0)
+    , mRadius(0)
+    , mSpread(0)
+    , mColor(NS_RGB(0, 0, 0))
+    , mHasColor(false)
+    , mInset(false)
+  {
     MOZ_COUNT_CTOR(nsCSSShadowItem);
   }
   ~nsCSSShadowItem() {
     MOZ_COUNT_DTOR(nsCSSShadowItem);
   }
 
   bool operator==(const nsCSSShadowItem& aOther) const {
     return (mXOffset == aOther.mXOffset &&
--- a/layout/style/nsStyleTransformMatrix.h
+++ b/layout/style/nsStyleTransformMatrix.h
@@ -69,28 +69,40 @@ namespace nsStyleTransformMatrix {
    * those continuations. (This behavior is not currently in a spec.)
    */
   class MOZ_STACK_CLASS TransformReferenceBox final {
   public:
     typedef nscoord (TransformReferenceBox::*DimensionGetter)();
 
     explicit TransformReferenceBox()
       : mFrame(nullptr)
+      , mX(0)
+      , mY(0)
+      , mWidth(0)
+      , mHeight(0)
       , mIsCached(false)
     {}
 
     explicit TransformReferenceBox(const nsIFrame* aFrame)
       : mFrame(aFrame)
+      , mX(0)
+      , mY(0)
+      , mWidth(0)
+      , mHeight(0)
       , mIsCached(false)
     {
       MOZ_ASSERT(mFrame);
     }
 
     explicit TransformReferenceBox(const nsIFrame* aFrame,
                                    const nsSize& aFallbackDimensions)
+      : mX(0)
+      , mY(0)
+      , mWidth(0)
+      , mHeight(0)
     {
       mFrame = aFrame;
       mIsCached = false;
       if (!mFrame) {
         Init(aFallbackDimensions);
       }
     }
 
--- a/layout/style/nsTimingFunction.h
+++ b/layout/style/nsTimingFunction.h
@@ -27,18 +27,20 @@ struct nsTimingFunction
   // and thus will have mFunc filled in.
   static bool IsSplineType(Type aType)
   {
     return aType != Type::StepStart &&
            aType != Type::StepEnd &&
            aType != Type::Frames;
   }
 
-  explicit nsTimingFunction(int32_t aTimingFunctionType
-                              = NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE)
+  explicit nsTimingFunction(
+    int32_t aTimingFunctionType = NS_STYLE_TRANSITION_TIMING_FUNCTION_EASE)
+    : mType(Type::Ease)
+    , mFunc{}
   {
     AssignFromKeyword(aTimingFunctionType);
   }
 
   nsTimingFunction(float x1, float y1, float x2, float y2)
     : mType(Type::CubicBezier)
   {
     mFunc.mX1 = x1;