Bug 614732 - Add prefs for enabling/disabling display-list hit-testing/painting. r=roc.

This commit is contained in:
Jonathan Watt 2012-05-17 05:05:04 +01:00
Родитель fd4271cf1c
Коммит acf3e38285
3 изменённых файлов: 35 добавлений и 19 удалений

Просмотреть файл

@ -270,6 +270,8 @@ nsLayoutStatics::Initialize()
nsWindowMemoryReporter::Init();
nsSVGUtils::Init();
return NS_OK;
}

Просмотреть файл

@ -160,31 +160,26 @@ static const PRUint8 gsRGBToLinearRGBMap[256] = {
239, 242, 244, 246, 248, 250, 253, 255
};
static bool gSMILEnabled;
static const char SMIL_PREF_STR[] = "svg.smil.enabled";
static int
SMILPrefChanged(const char *aPref, void *aClosure)
{
bool prefVal = Preferences::GetBool(SMIL_PREF_STR);
gSMILEnabled = prefVal;
return 0;
}
static bool sSMILEnabled;
static bool sSVGDisplayListHitTestingEnabled;
static bool sSVGDisplayListPaintingEnabled;
bool
NS_SMILEnabled()
{
static bool sInitialized = false;
if (!sInitialized) {
/* check and register ourselves with the pref */
gSMILEnabled = Preferences::GetBool(SMIL_PREF_STR);
Preferences::RegisterCallback(SMILPrefChanged, SMIL_PREF_STR);
return sSMILEnabled;
}
sInitialized = true;
}
bool
NS_SVGDisplayListHitTestingEnabled()
{
return sSVGDisplayListHitTestingEnabled;
}
return gSMILEnabled;
bool
NS_SVGDisplayListPaintingEnabled()
{
return sSVGDisplayListPaintingEnabled;
}
// we only take the address of this:
@ -237,6 +232,20 @@ SVGAutoRenderState::IsPaintingToWindow(nsRenderingContext *aContext)
return false;
}
void
nsSVGUtils::Init()
{
Preferences::AddBoolVarCache(&sSMILEnabled,
"svg.smil.enabled",
true);
Preferences::AddBoolVarCache(&sSVGDisplayListHitTestingEnabled,
"svg.display-lists.hit-testing.enabled");
Preferences::AddBoolVarCache(&sSVGDisplayListPaintingEnabled,
"svg.display-lists.painting.enabled");
}
nsSVGSVGElement*
nsSVGUtils::GetOuterSVGElement(nsSVGElement *aSVGElement)
{

Просмотреть файл

@ -143,6 +143,9 @@ IsSVGWhitespace(PRUnichar aChar)
*/
bool NS_SMILEnabled();
bool NS_SVGDisplayListHitTestingEnabled();
bool NS_SVGDisplayListPaintingEnabled();
/**
* Sometimes we need to distinguish between an empty box and a box
* that contains an element that has no size e.g. a point at the origin.
@ -225,6 +228,8 @@ public:
typedef mozilla::SVGAnimatedPreserveAspectRatio SVGAnimatedPreserveAspectRatio;
typedef mozilla::SVGPreserveAspectRatio SVGPreserveAspectRatio;
static void Init();
/*
* Get the parent element of an nsIContent
*/