diff --git a/content/base/src/nsNameSpaceManager.cpp b/content/base/src/nsNameSpaceManager.cpp index ebf708b39737..34350285aa12 100644 --- a/content/base/src/nsNameSpaceManager.cpp +++ b/content/base/src/nsNameSpaceManager.cpp @@ -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); } diff --git a/content/svg/content/src/nsSVGElementFactory.cpp b/content/svg/content/src/nsSVGElementFactory.cpp index 5b795df9265a..4567d509696e 100644 --- a/content/svg/content/src/nsSVGElementFactory.cpp +++ b/content/svg/content/src/nsSVGElementFactory.cpp @@ -245,9 +245,6 @@ nsresult NS_NewSVGElement(nsIContent** aResult, already_AddRefed 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 diff --git a/content/svg/content/src/nsSVGFeatures.cpp b/content/svg/content/src/nsSVGFeatures.cpp index 41d9fbeb2d7f..4a2b5d2b2769 100644 --- a/content/svg/content/src/nsSVGFeatures.cpp +++ b/content/svg/content/src/nsSVGFeatures.cpp @@ -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" diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 2b34f606a2fc..156281cd87e2 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -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 - 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 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; diff --git a/layout/build/nsContentDLF.cpp b/layout/build/nsContentDLF.cpp index 3f92af3b56db..bc364a2d64bc 100644 --- a/layout/build/nsContentDLF.cpp +++ b/layout/build/nsContentDLF.cpp @@ -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; diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index 143f92865df7..9b1a7767475b 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -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" diff --git a/layout/svg/base/src/nsSVGUtils.cpp b/layout/svg/base/src/nsSVGUtils.cpp index 77131cf4a8c6..f4181ff780c3 100644 --- a/layout/svg/base/src/nsSVGUtils.cpp +++ b/layout/svg/base/src/nsSVGUtils.cpp @@ -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) diff --git a/layout/svg/base/src/nsSVGUtils.h b/layout/svg/base/src/nsSVGUtils.h index c4e341de31d1..049a2b834ccb 100644 --- a/layout/svg/base/src/nsSVGUtils.h +++ b/layout/svg/base/src/nsSVGUtils.h @@ -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 diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 63747b19b94f..4eba5704c2ae 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -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);