mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
don't rely on language features to construct/destruct instance of InlineBackgroundData. b=373305 r/sr=dbaron
This commit is contained in:
parent
5ab9bad426
commit
a0b3416362
@ -198,7 +198,7 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
static InlineBackgroundData gInlineBGData;
|
||||
static InlineBackgroundData* gInlineBGData = nsnull;
|
||||
|
||||
static void GetPath(nsFloatPoint aPoints[],nsPoint aPolyPath[],PRInt32 *aCurIndex,ePathTypes aPathType,PRInt32 &aC1Index,float aFrac=0);
|
||||
|
||||
@ -206,6 +206,24 @@ static void GetPath(nsFloatPoint aPoints[],nsPoint aPolyPath[],PRInt32 *aCurInde
|
||||
static void FillOrInvertRect(nsIRenderingContext& aRC,nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, PRBool aInvert);
|
||||
static void FillOrInvertRect(nsIRenderingContext& aRC,const nsRect& aRect, PRBool aInvert);
|
||||
|
||||
// Initialize any static variables used by nsCSSRendering.
|
||||
nsresult nsCSSRendering::Init()
|
||||
{
|
||||
NS_ASSERTION(!gInlineBGData, "Init called twice");
|
||||
gInlineBGData = new InlineBackgroundData();
|
||||
if (!gInlineBGData)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Clean up any global variables used by nsCSSRendering.
|
||||
void nsCSSRendering::Shutdown()
|
||||
{
|
||||
delete gInlineBGData;
|
||||
gInlineBGData = nsnull;
|
||||
}
|
||||
|
||||
// Draw a line, skipping that portion which crosses aGap. aGap defines a rectangle gap
|
||||
// This services fieldset legends and only works for coords defining horizontal lines.
|
||||
void nsCSSRendering::DrawLine (nsIRenderingContext& aContext,
|
||||
@ -2621,7 +2639,7 @@ nsCSSRendering::FindBackground(nsPresContext* aPresContext,
|
||||
void
|
||||
nsCSSRendering::DidPaint()
|
||||
{
|
||||
gInlineBGData.Reset();
|
||||
gInlineBGData->Reset();
|
||||
}
|
||||
|
||||
void
|
||||
@ -2851,14 +2869,14 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
||||
bgOriginArea = aBorderArea;
|
||||
break;
|
||||
case NS_STYLE_BG_INLINE_POLICY_BOUNDING_BOX:
|
||||
bgOriginArea = gInlineBGData.GetBoundingRect(aForFrame) +
|
||||
bgOriginArea = gInlineBGData->GetBoundingRect(aForFrame) +
|
||||
aBorderArea.TopLeft();
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Unknown background-inline-policy value! "
|
||||
"Please, teach me what to do.");
|
||||
case NS_STYLE_BG_INLINE_POLICY_CONTINUOUS:
|
||||
bgOriginArea = gInlineBGData.GetContinuousRect(aForFrame) +
|
||||
bgOriginArea = gInlineBGData->GetContinuousRect(aForFrame) +
|
||||
aBorderArea.TopLeft();
|
||||
break;
|
||||
}
|
||||
|
@ -47,6 +47,16 @@ class nsPresContext;
|
||||
|
||||
class nsCSSRendering {
|
||||
public:
|
||||
/**
|
||||
* Initialize any static variables used by nsCSSRendering.
|
||||
*/
|
||||
static nsresult Init();
|
||||
|
||||
/**
|
||||
* Clean up any static variables used by nsCSSRendering.
|
||||
*/
|
||||
static void Shutdown();
|
||||
|
||||
/**
|
||||
* Render the border for an element using css rendering rules
|
||||
* for borders. aSkipSides is a bitmask of the sides to skip
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "nsCSSProps.h"
|
||||
#include "nsCSSPseudoClasses.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsCSSScanner.h"
|
||||
#include "nsICSSStyleSheet.h"
|
||||
#include "nsDOMAttribute.h"
|
||||
@ -160,6 +161,12 @@ nsLayoutStatics::Initialize()
|
||||
nsColorNames::AddRefTable();
|
||||
nsGkAtoms::AddRefAtoms();
|
||||
|
||||
rv = nsCSSRendering::Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Could not initialize nsCSSRendering");
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifndef MOZ_NO_INSPECTOR_APIS
|
||||
inDOMView::InitAtoms();
|
||||
#endif
|
||||
@ -231,6 +238,7 @@ nsLayoutStatics::Shutdown()
|
||||
nsContentList::Shutdown();
|
||||
nsComputedDOMStyle::Shutdown();
|
||||
CSSLoaderImpl::Shutdown();
|
||||
nsCSSRendering::Shutdown();
|
||||
#ifdef DEBUG
|
||||
nsFrame::DisplayReflowShutdown();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user