diff --git a/content/base/src/nsStyleContext.cpp b/content/base/src/nsStyleContext.cpp index 232b737192d2..0b6a28371954 100644 --- a/content/base/src/nsStyleContext.cpp +++ b/content/base/src/nsStyleContext.cpp @@ -30,6 +30,17 @@ static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID); +// Default border widths for enumerated values +// +// NOTE: don't use NSIntPointsToTwips here because that results in a +// global constructor been created to do the *runtime* initializing +// because some compilers don't know how to expand inline methods in +// this situation. +static nscoord kBorderWidths[3] = { + nscoord(1 * TWIPS_PER_POINT_INT), + nscoord(3 * TWIPS_PER_POINT_INT), + nscoord(5 * TWIPS_PER_POINT_INT) +}; // -------------------- // nsStyleFont @@ -249,11 +260,6 @@ void nsStyleSpacing::CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding) } } -static const nscoord kBorderWidths[3] = - { NSIntPointsToTwips(1), - NSIntPointsToTwips(3), - NSIntPointsToTwips(5) }; - void nsStyleSpacing::CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const { if (mHasCachedBorder) { @@ -685,12 +691,18 @@ public: nsIPresContext* aPresContext); virtual ~StyleContextImpl(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); + void* operator new(size_t size) { + void* rv = ::operator new(size); + if (rv) { + nsCRT::zero(rv, size); + } return rv; } + void operator delete(void* ptr, size_t size) { + ::operator delete(ptr); + } + NS_DECL_ISUPPORTS virtual nsIStyleContext* GetParent(void) const; diff --git a/layout/base/src/nsStyleContext.cpp b/layout/base/src/nsStyleContext.cpp index 232b737192d2..0b6a28371954 100644 --- a/layout/base/src/nsStyleContext.cpp +++ b/layout/base/src/nsStyleContext.cpp @@ -30,6 +30,17 @@ static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID); +// Default border widths for enumerated values +// +// NOTE: don't use NSIntPointsToTwips here because that results in a +// global constructor been created to do the *runtime* initializing +// because some compilers don't know how to expand inline methods in +// this situation. +static nscoord kBorderWidths[3] = { + nscoord(1 * TWIPS_PER_POINT_INT), + nscoord(3 * TWIPS_PER_POINT_INT), + nscoord(5 * TWIPS_PER_POINT_INT) +}; // -------------------- // nsStyleFont @@ -249,11 +260,6 @@ void nsStyleSpacing::CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding) } } -static const nscoord kBorderWidths[3] = - { NSIntPointsToTwips(1), - NSIntPointsToTwips(3), - NSIntPointsToTwips(5) }; - void nsStyleSpacing::CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const { if (mHasCachedBorder) { @@ -685,12 +691,18 @@ public: nsIPresContext* aPresContext); virtual ~StyleContextImpl(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); + void* operator new(size_t size) { + void* rv = ::operator new(size); + if (rv) { + nsCRT::zero(rv, size); + } return rv; } + void operator delete(void* ptr, size_t size) { + ::operator delete(ptr); + } + NS_DECL_ISUPPORTS virtual nsIStyleContext* GetParent(void) const; diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index 232b737192d2..0b6a28371954 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -30,6 +30,17 @@ static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID); +// Default border widths for enumerated values +// +// NOTE: don't use NSIntPointsToTwips here because that results in a +// global constructor been created to do the *runtime* initializing +// because some compilers don't know how to expand inline methods in +// this situation. +static nscoord kBorderWidths[3] = { + nscoord(1 * TWIPS_PER_POINT_INT), + nscoord(3 * TWIPS_PER_POINT_INT), + nscoord(5 * TWIPS_PER_POINT_INT) +}; // -------------------- // nsStyleFont @@ -249,11 +260,6 @@ void nsStyleSpacing::CalcPaddingFor(const nsIFrame* aFrame, nsMargin& aPadding) } } -static const nscoord kBorderWidths[3] = - { NSIntPointsToTwips(1), - NSIntPointsToTwips(3), - NSIntPointsToTwips(5) }; - void nsStyleSpacing::CalcBorderFor(const nsIFrame* aFrame, nsMargin& aBorder) const { if (mHasCachedBorder) { @@ -685,12 +691,18 @@ public: nsIPresContext* aPresContext); virtual ~StyleContextImpl(); - void* operator new(size_t sz) { - void* rv = new char[sz]; - nsCRT::zero(rv, sz); + void* operator new(size_t size) { + void* rv = ::operator new(size); + if (rv) { + nsCRT::zero(rv, size); + } return rv; } + void operator delete(void* ptr, size_t size) { + ::operator delete(ptr); + } + NS_DECL_ISUPPORTS virtual nsIStyleContext* GetParent(void) const;