Bug 617448 - remove svg.enabled as the browser now uses SVG and fails to start if it's disabled r+a=roc

This commit is contained in:
Robert Longson 2010-12-08 21:25:06 +00:00
parent 790a811019
commit b2a9c7cba7
9 changed files with 16 additions and 114 deletions

View File

@ -59,10 +59,6 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
using namespace mozilla::dom;
#ifdef MOZ_SVG
PRBool NS_SVGEnabled();
#endif
#define kXMLNSNameSpaceURI "http://www.w3.org/2000/xmlns/"
#define kXMLNameSpaceURI "http://www.w3.org/XML/1998/namespace"
#define kXHTMLNameSpaceURI "http://www.w3.org/1999/xhtml"
@ -244,11 +240,9 @@ NS_NewElement(nsIContent** aResult, PRInt32 aElementType,
return NS_NewMathMLElement(aResult, aNodeInfo);
}
#endif
#ifdef MOZ_SVG
if (aElementType == kNameSpaceID_SVG && NS_SVGEnabled()) {
if (aElementType == kNameSpaceID_SVG) {
return NS_NewSVGElement(aResult, aNodeInfo, aFromParser);
}
#endif
if (aElementType == kNameSpaceID_XMLEvents) {
return NS_NewXMLEventsElement(aResult, aNodeInfo);
}

View File

@ -245,9 +245,6 @@ nsresult
NS_NewSVGElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser)
{
NS_PRECONDITION(NS_SVGEnabled(),
"creating an SVG element while SVG disabled");
static const char kSVGStyleSheetURI[] = "resource://gre/res/svg.css";
// this bit of code is to load svg.css on demand

View File

@ -58,10 +58,6 @@
/*static*/ PRBool
nsSVGFeatures::HaveFeature(const nsAString& aFeature)
{
if (!NS_SVGEnabled()) {
return PR_FALSE;
}
#define SVG_SUPPORTED_FEATURE(str) if (aFeature.Equals(NS_LITERAL_STRING(str).get())) return PR_TRUE;
#define SVG_UNSUPPORTED_FEATURE(str)
#include "nsSVGFeaturesList.h"

View File

@ -144,12 +144,10 @@
#ifdef MOZ_MATHML
#include "nsMathMLParts.h"
#endif
#ifdef MOZ_SVG
#include "nsSVGFeatures.h"
#include "nsSVGEffects.h"
#include "nsSVGUtils.h"
#include "nsSVGOuterSVGFrame.h"
#endif
#include "nsRefreshDriver.h"
@ -164,11 +162,8 @@ nsIFrame*
NS_NewHTMLVideoFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);
#endif
#ifdef MOZ_SVG
#include "nsSVGTextContainerFrame.h"
PRBool
NS_SVGEnabled();
nsIFrame*
NS_NewSVGOuterSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
@ -217,7 +212,6 @@ nsIFrame*
NS_NewSVGMaskFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
nsIFrame*
NS_NewSVGLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
#endif
#include "nsIDocument.h"
#include "nsIDOMElement.h"
@ -2408,9 +2402,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
}
else
#endif
#ifdef MOZ_SVG
if (aDocElement->GetNameSpaceID() == kNameSpaceID_SVG) {
if (aDocElement->Tag() == nsGkAtoms::svg && NS_SVGEnabled()) {
if (aDocElement->Tag() == nsGkAtoms::svg) {
contentFrame = NS_NewSVGOuterSVGFrame(mPresShell, styleContext);
if (NS_UNLIKELY(!contentFrame)) {
return NS_ERROR_OUT_OF_MEMORY;
@ -2436,10 +2429,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
} else {
return NS_ERROR_FAILURE;
}
}
else
#endif
{
} else {
PRBool docElemIsTable = (display->mDisplay == NS_STYLE_DISPLAY_TABLE);
if (docElemIsTable) {
// We're going to call the right function ourselves, so no need to give a
@ -3371,7 +3361,6 @@ FindAncestorWithGeneratedContentPseudo(nsIFrame* aFrame)
const nsCSSFrameConstructor::FrameConstructionData*
nsCSSFrameConstructor::FindTextData(nsIFrame* aParentFrame)
{
#ifdef MOZ_SVG
if (aParentFrame && aParentFrame->IsFrameOfType(nsIFrame::eSVG)) {
nsIFrame *ancestorFrame =
nsSVGUtils::GetFirstNonAAncestorFrame(aParentFrame);
@ -3385,7 +3374,6 @@ nsCSSFrameConstructor::FindTextData(nsIFrame* aParentFrame)
}
return nsnull;
}
#endif
static const FrameConstructionData sTextData =
FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT, NS_NewTextFrame);
@ -3970,15 +3958,12 @@ nsCSSFrameConstructor::GetAnonymousContent(nsIContent* aParent,
nsIContent* content = aContent[i];
NS_ASSERTION(content, "null anonymous content?");
#ifdef MOZ_SVG
// least-surprise CSS binding until we do the SVG specified
// cascading rules for <svg:use> - bug 265894
if (aParent &&
aParent->NodeInfo()->Equals(nsGkAtoms::use, kNameSpaceID_SVG)) {
content->SetFlags(NODE_IS_ANONYMOUS);
} else
#endif
{
} else {
content->SetNativeAnonymous();
}
@ -4767,7 +4752,6 @@ nsCSSFrameConstructor::FindMathMLData(nsIContent* aContent,
}
#endif // MOZ_MATHML
#ifdef MOZ_SVG
// Only outer <svg> elements can be floated or positioned. All other SVG
// should be in-flow.
#define SIMPLE_SVG_FCDATA(_func) \
@ -4785,7 +4769,7 @@ nsCSSFrameConstructor::FindSVGData(nsIContent* aContent,
nsIFrame* aParentFrame,
nsStyleContext* aStyleContext)
{
if (aNameSpaceID != kNameSpaceID_SVG || !NS_SVGEnabled()) {
if (aNameSpaceID != kNameSpaceID_SVG) {
return nsnull;
}
@ -5007,8 +4991,6 @@ nsCSSFrameConstructor::ConstructSVGForeignObjectFrame(nsFrameConstructorState& a
return rv;
}
#endif // MOZ_SVG
void
nsCSSFrameConstructor::AddPageBreakItem(nsIContent* aContent,
nsStyleContext* aMainStyleContext,
@ -5226,14 +5208,11 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
const FrameConstructionData* data;
if (isText) {
data = FindTextData(aParentFrame);
#ifdef MOZ_SVG
if (!data) {
// Nothing to do here; suppressed text inside SVG
return;
}
#endif /* MOZ_SVG */
} else {
#ifdef MOZ_SVG
// Don't create frames for non-SVG element children of SVG elements.
if (aNameSpaceID != kNameSpaceID_SVG &&
aParentFrame &&
@ -5244,7 +5223,6 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
isGeneratedContent);
return;
}
#endif /* MOZ_SVG */
data = FindHTMLData(aContent, aTag, aNameSpaceID, aParentFrame,
styleContext);
@ -5256,12 +5234,10 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
data = FindMathMLData(aContent, aTag, aNameSpaceID, styleContext);
}
#endif
#ifdef MOZ_SVG
if (!data) {
data = FindSVGData(aContent, aTag, aNameSpaceID, aParentFrame,
styleContext);
}
#endif /* MOZ_SVG */
// Now check for XUL display types
if (!data) {
@ -7754,7 +7730,6 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
// if frame has view, will already be invalidated
if (aChange & nsChangeHint_RepaintFrame) {
if (aFrame->IsFrameOfType(nsIFrame::eSVG)) {
#ifdef MOZ_SVG
if (!(aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
nsSVGOuterSVGFrame *outerSVGFrame = nsSVGUtils::GetOuterSVGFrame(aFrame);
if (outerSVGFrame) {
@ -7772,7 +7747,6 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
outerSVGFrame->UpdateAndInvalidateCoveredRegion(aFrame);
}
}
#endif
} else {
aFrame->InvalidateOverflowRect();
}
@ -8061,11 +8035,9 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
RecreateFramesForContent(content, PR_FALSE);
} else {
NS_ASSERTION(frame, "This shouldn't happen");
#ifdef MOZ_SVG
if (hint & nsChangeHint_UpdateEffects) {
nsSVGEffects::UpdateEffects(frame);
}
#endif
if (hint & nsChangeHint_NeedReflow) {
StyleChangeReflow(frame, hint);
didReflow = PR_TRUE;

View File

@ -75,9 +75,7 @@ static NS_DEFINE_CID(kPluginDocumentCID, NS_PLUGINDOCUMENT_CID);
static NS_DEFINE_IID(kHTMLDocumentCID, NS_HTMLDOCUMENT_CID);
static NS_DEFINE_IID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
#ifdef MOZ_SVG
static NS_DEFINE_IID(kSVGDocumentCID, NS_SVGDOCUMENT_CID);
#endif
#ifdef MOZ_MEDIA
static NS_DEFINE_IID(kVideoDocumentCID, NS_VIDEODOCUMENT_CID);
#endif
@ -116,15 +114,11 @@ static const char* const gXMLTypes[] = {
0
};
#ifdef MOZ_SVG
static const char* const gSVGTypes[] = {
IMAGE_SVG_XML,
0
};
PRBool NS_SVGEnabled();
#endif
static const char* const gXULTypes[] = {
TEXT_XUL,
APPLICATION_CACHED_XUL,
@ -225,15 +219,11 @@ nsContentDLF::CreateInstance(const char* aCommand,
}
}
#ifdef MOZ_SVG
if (NS_SVGEnabled()) {
for (typeIndex = 0; gSVGTypes[typeIndex] && !knownType; ++typeIndex) {
if (type.Equals(gSVGTypes[typeIndex])) {
knownType = PR_TRUE;
}
for (typeIndex = 0; gSVGTypes[typeIndex] && !knownType; ++typeIndex) {
if (type.Equals(gSVGTypes[typeIndex])) {
knownType = PR_TRUE;
}
}
#endif // MOZ_SVG
for (typeIndex = 0; gXULTypes[typeIndex] && !knownType; ++typeIndex) {
if (type.Equals(gXULTypes[typeIndex])) {
@ -277,20 +267,16 @@ nsContentDLF::CreateInstance(const char* aCommand,
}
}
#ifdef MOZ_SVG
if (NS_SVGEnabled()) {
// Try SVG
typeIndex = 0;
while(gSVGTypes[typeIndex]) {
if (!PL_strcmp(gSVGTypes[typeIndex++], aContentType)) {
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kSVGDocumentCID,
aDocListener, aDocViewer);
}
// Try SVG
typeIndex = 0;
while(gSVGTypes[typeIndex]) {
if (!PL_strcmp(gSVGTypes[typeIndex++], aContentType)) {
return CreateDocument(aCommand,
aChannel, aLoadGroup,
aContainer, kSVGDocumentCID,
aDocListener, aDocViewer);
}
}
#endif
// Try XUL
typeIndex = 0;

View File

@ -108,10 +108,6 @@
#include "nsMathMLOperators.h"
#endif
#ifdef MOZ_SVG
PRBool NS_SVGEnabled();
#endif
#ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
#include "nsHTMLEditor.h"
#include "nsTextServicesDocument.h"

View File

@ -169,41 +169,11 @@ static const PRUint8 gsRGBToLinearRGBMap[256] = {
239, 242, 244, 246, 248, 250, 253, 255
};
static PRBool gSVGEnabled;
static const char SVG_PREF_STR[] = "svg.enabled";
#ifdef MOZ_SMIL
static PRBool gSMILEnabled;
static const char SMIL_PREF_STR[] = "svg.smil.enabled";
#endif // MOZ_SMIL
static int
SVGPrefChanged(const char *aPref, void *aClosure)
{
PRBool prefVal = nsContentUtils::GetBoolPref(SVG_PREF_STR);
if (prefVal == gSVGEnabled)
return 0;
gSVGEnabled = prefVal;
return 0;
}
PRBool
NS_SVGEnabled()
{
static PRBool sInitialized = PR_FALSE;
if (!sInitialized) {
/* check and register ourselves with the pref */
gSVGEnabled = nsContentUtils::GetBoolPref(SVG_PREF_STR);
nsContentUtils::RegisterPrefCallback(SVG_PREF_STR, SVGPrefChanged, nsnull);
sInitialized = PR_TRUE;
}
return gSVGEnabled;
}
#ifdef MOZ_SMIL
static int
SMILPrefChanged(const char *aPref, void *aClosure)

View File

@ -141,14 +141,6 @@ IsSVGWhitespace(PRUnichar aChar)
aChar == PRUnichar('\xD') || aChar == PRUnichar('\xA');
}
/*
* Checks the svg enable preference and if a renderer could
* successfully be created. Declared as a function instead of a
* nsSVGUtil method so that files that can't pull in nsSVGUtils.h (due
* to cairo.h usage) can still query this information.
*/
PRBool NS_SVGEnabled();
#ifdef MOZ_SMIL
/*
* Checks the smil enabled preference. Declared as a function to match

View File

@ -1351,7 +1351,6 @@ pref("dom.ipc.plugins.enabled.nppdf.so", false);
#endif
#endif
pref("svg.enabled", true);
pref("svg.smil.enabled", true);
pref("font.minimum-size.ar", 0);