Bug 1453795 - SVG - Initialize member fields in classes/ structures. r=jwatt

--HG--
extra : rebase_source : 244f0513af145c53fbc0177d2652cf68e20b64af
This commit is contained in:
Andi-Bogdan Postelnicu 2018-06-16 13:54:44 +03:00
parent 666c5857d7
commit 09ec36a025
11 changed files with 48 additions and 12 deletions

View File

@ -16,7 +16,14 @@
class nsSMILKeySpline
{
public:
nsSMILKeySpline() { /* caller must call Init later */ }
nsSMILKeySpline()
: mX1(0)
, mY1(0)
, mX2(0)
, mY2(0)
{
/* caller must call Init later */\
}
/**
* Creates a new key spline control point description.
@ -26,6 +33,10 @@ public:
*/
nsSMILKeySpline(double aX1, double aY1,
double aX2, double aY2)
: mX1(0)
, mY1(0)
, mX2(0)
, mY2(0)
{
Init(aX1, aY1, aX2, aY2);
}

View File

@ -14,6 +14,7 @@
nsSMILValue::nsSMILValue(const nsISMILType* aType)
: mType(nsSMILNullType::Singleton())
{
mU.mBool = false;
if (!aType) {
NS_ERROR("Trying to construct nsSMILValue with null mType pointer");
return;

View File

@ -230,7 +230,10 @@ private:
* want to create the DOMSVGPathSeg items lazily on demand.
*/
struct ItemProxy {
ItemProxy(){}
ItemProxy()
: mItem(nullptr)
, mInternalDataIndex(0)
{}
ItemProxy(DOMSVGPathSeg *aItem, uint32_t aInternalDataIndex)
: mItem(aItem)
, mInternalDataIndex(aInternalDataIndex)

View File

@ -43,7 +43,9 @@ class SVGAnimatedNumberList
friend class DOMSVGNumberList;
public:
SVGAnimatedNumberList() {}
SVGAnimatedNumberList()
: mIsBaseSet(false)
{}
/**
* Because it's so important that mBaseVal and its DOMSVGNumberList wrapper

View File

@ -112,7 +112,11 @@ public:
{
public:
SimplePath()
: mType(NONE)
: mX(0.0)
, mY(0.0)
, mWidthOrX2(0.0)
, mHeightOrY2(0.0)
, mType(NONE)
{}
bool IsPath() const {
return mType != NONE;

View File

@ -33,10 +33,8 @@ class SVGLength
public:
SVGLength()
#ifdef DEBUG
: mValue(0.0f)
, mUnit(dom::SVGLengthBinding::SVG_LENGTHTYPE_UNKNOWN) // caught by IsValid()
#endif
{}
SVGLength(float aValue, uint8_t aUnit)

View File

@ -311,6 +311,8 @@ public:
SVGUserUnitList()
: mList(nullptr)
, mElement(nullptr)
, mAxis(0)
{}
void Init(const SVGLengthList *aList, nsSVGElement *aElement, uint8_t aAxis) {

View File

@ -64,7 +64,10 @@ struct MotionSegment
// Default constructor just locks us into being a Translation, and leaves
// other fields uninitialized (since client is presumably about to set them)
MotionSegment()
: mSegmentType(eSegmentType_Translation)
: mRotateType(eRotateType_Auto),
mRotateAngle(0.0),
mSegmentType(eSegmentType_Translation),
mU{}
{ }
// Constructor for a translation

View File

@ -32,7 +32,13 @@ struct nsSVGViewBoxRect
float width, height;
bool none;
nsSVGViewBoxRect() : none(true) {}
nsSVGViewBoxRect()
: x(0.0)
, y(0.0)
, width(0.0)
, height(0.0)
, none(true)
{}
nsSVGViewBoxRect(float aX, float aY, float aWidth, float aHeight) :
x(aX), y(aY), width(aWidth), height(aHeight), none(false) {}
nsSVGViewBoxRect(const nsSVGViewBoxRect& rhs) :

View File

@ -190,7 +190,10 @@ public:
float GetStrokeOpacity() const override { return mStrokeOpacity; }
struct Paint {
Paint() : mPaintType(eStyleSVGPaintType_None) {}
Paint()
: mPaintDefinition{}
, mPaintType(eStyleSVGPaintType_None)
{}
void SetPaintServer(nsIFrame* aFrame,
const gfxMatrix& aContextMatrix,

View File

@ -2439,10 +2439,12 @@ CharIterator::CharIterator(SVGTextFrame* aSVGTextFrame,
mFrameForTrimCheck(nullptr),
mTrimmedOffset(0),
mTrimmedLength(0),
mTextRun(nullptr),
mTextElementCharIndex(0),
mGlyphStartTextElementCharIndex(0),
mLengthAdjustScaleFactor(aSVGTextFrame->mLengthAdjustScaleFactor)
, mPostReflow(aPostReflow)
mGlyphUndisplayedCharacters(0),
mLengthAdjustScaleFactor(aSVGTextFrame->mLengthAdjustScaleFactor),
mPostReflow(aPostReflow)
{
if (!AtEnd()) {
mSkipCharsIterator = TextFrame()->EnsureTextRun(nsTextFrame::eInflated);
@ -2772,7 +2774,8 @@ public:
mContext(aContext),
mFrame(aFrame),
mCanvasTM(aCanvasTM),
mImgParams(aImgParams)
mImgParams(aImgParams),
mColor(0)
{
}