From afe40e0ab9800a7fddba1664c7bf462418c9bab4 Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Wed, 29 Jun 2005 03:51:44 +0000 Subject: [PATCH] Bug 288438. Turn off SVG because it's pretty broken. r=benjamin,sr=dbaron,a=benjamin,patch by jwatt,tor and roc --- build/autoconf/mozconfig2configure | 4 +++- config/autoconf.mk.in | 1 + configure.in | 15 ++++++++++++ content/svg/content/src/Makefile.in | 5 +++- content/svg/content/src/nsSVGAtomList.h | 2 ++ .../svg/content/src/nsSVGElementFactory.cpp | 4 ++++ dom/public/nsIDOMClassInfo.h | 10 +++++--- dom/src/base/nsDOMClassInfo.cpp | 24 +++++++++++++------ layout/base/nsCSSFrameConstructor.cpp | 9 ++++++- layout/base/nsLayoutAtomList.h | 2 ++ layout/svg/base/src/Makefile.in | 5 +++- 11 files changed, 67 insertions(+), 14 deletions(-) diff --git a/build/autoconf/mozconfig2configure b/build/autoconf/mozconfig2configure index 258f0e03f35..2619dc1020c 100755 --- a/build/autoconf/mozconfig2configure +++ b/build/autoconf/mozconfig2configure @@ -68,7 +68,9 @@ ac_add_options() { # Avoid adding duplicates case "$ac_options" in - *"$_opt"* ) ;; + # Note that all options in $ac_options are enclosed in quotes, + # so there will always be a last character to match [^-A-Za-z0-9_] + *"\"$_opt[^-A-Za-z0-9_]"* ) ;; * ) mozconfig_ac_options="$mozconfig_ac_options $_opt" ;; esac done diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 9a0e544dd14..fc8e7a1d1d1 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -186,6 +186,7 @@ MOZ_UPDATE_XTERM = @MOZ_UPDATE_XTERM@ MOZ_MATHML = @MOZ_MATHML@ MOZ_XTF = @MOZ_XTF@ MOZ_SVG = @MOZ_SVG@ +MOZ_SVG_FOREIGNOBJECT = @MOZ_SVG_FOREIGNOBJECT@ MOZ_SVG_RENDERER_GDIPLUS = @MOZ_SVG_RENDERER_GDIPLUS@ MOZ_SVG_RENDERER_LIBART = @MOZ_SVG_RENDERER_LIBART@ MOZ_SVG_RENDERER_CAIRO = @MOZ_SVG_RENDERER_CAIRO@ diff --git a/configure.in b/configure.in index 8382ced4191..d69bb9f996e 100644 --- a/configure.in +++ b/configure.in @@ -4840,6 +4840,20 @@ if test -n "$MOZ_SVG"; then esac fi +dnl COMMENTED OUT because foreignobject support should +dnl not be tweakable by distributors! +dnl ======================================================== +dnl SVG +dnl ======================================================== +dnl MOZ_ARG_ENABLE_BOOL(svg-foreignobject, +dnl [ --enable-svg-foreignobject +dnl Enable SVG support], +dnl MOZ_SVG_FOREIGNOBJECT=1, +dnl MOZ_SVG_FOREIGNOBJECT= ) +dnl if test -n "$MOZ_SVG_FOREIGNOBJECT"; then +dnl AC_DEFINE(MOZ_SVG_FOREIGNOBJECT) +dnl fi + dnl ======================================================== dnl Transformiix dnl ======================================================== @@ -6464,6 +6478,7 @@ AC_SUBST(MINIMO) AC_SUBST(MOZ_MATHML) AC_SUBST(MOZ_XTF) AC_SUBST(MOZ_SVG) +AC_SUBST(MOZ_SVG_FOREIGNOBJECT) AC_SUBST(MOZ_SVG_RENDERER_GDIPLUS) AC_SUBST(MOZ_SVG_RENDERER_LIBART) AC_SUBST(MOZ_SVG_RENDERER_CAIRO) diff --git a/content/svg/content/src/Makefile.in b/content/svg/content/src/Makefile.in index 65d043e3255..2b4ed966748 100644 --- a/content/svg/content/src/Makefile.in +++ b/content/svg/content/src/Makefile.in @@ -89,7 +89,6 @@ CPPSRCS = \ nsSVGEllipseElement.cpp \ nsSVGEnum.cpp \ nsSVGFeatures.cpp \ - nsSVGForeignObjectElement.cpp \ nsSVGGElement.cpp \ nsSVGGenericStringValue.cpp \ nsSVGGradientElement.cpp \ @@ -130,6 +129,10 @@ CPPSRCS = \ nsSVGValue.cpp \ $(NULL) +ifdef MOZ_SVG_FOREIGNOBJECT +CPPSRCS += nsSVGForeignObjectElement.cpp +endif + include $(topsrcdir)/config/config.mk # we don't want the shared lib, but we want to force the creation of a static lib. diff --git a/content/svg/content/src/nsSVGAtomList.h b/content/svg/content/src/nsSVGAtomList.h index b7381c50c96..6bc330ebda0 100644 --- a/content/svg/content/src/nsSVGAtomList.h +++ b/content/svg/content/src/nsSVGAtomList.h @@ -60,7 +60,9 @@ SVG_ATOM(clipPath, "clipPath") SVG_ATOM(defs, "defs") SVG_ATOM(desc, "desc") SVG_ATOM(ellipse, "ellipse") +#ifdef MOZ_SVG_FOREIGNOBJECT SVG_ATOM(foreignObject, "foreignObject") +#endif SVG_ATOM(g, "g") SVG_ATOM(generic, "generic") SVG_ATOM(image, "image") diff --git a/content/svg/content/src/nsSVGElementFactory.cpp b/content/svg/content/src/nsSVGElementFactory.cpp index c78098c62e4..eef29ea11ea 100644 --- a/content/svg/content/src/nsSVGElementFactory.cpp +++ b/content/svg/content/src/nsSVGElementFactory.cpp @@ -60,8 +60,10 @@ nsresult NS_NewSVGGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); nsresult NS_NewSVGSVGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +#ifdef MOZ_SVG_FOREIGNOBJECT nsresult NS_NewSVGForeignObjectElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); +#endif nsresult NS_NewSVGPathElement(nsIContent **aResult, nsINodeInfo *aNodeInfo); nsresult @@ -161,8 +163,10 @@ NS_NewSVGElement(nsIContent** aResult, nsINodeInfo *aNodeInfo) return NS_NewSVGSVGElement(aResult, aNodeInfo); if (name == nsSVGAtoms::g) return NS_NewSVGGElement(aResult, aNodeInfo); +#ifdef MOZ_SVG_FOREIGNOBJECT if (name == nsSVGAtoms::foreignObject) return NS_NewSVGForeignObjectElement(aResult, aNodeInfo); +#endif if (name == nsSVGAtoms::path) return NS_NewSVGPathElement(aResult, aNodeInfo); if (name == nsSVGAtoms::text) diff --git a/dom/public/nsIDOMClassInfo.h b/dom/public/nsIDOMClassInfo.h index 03cf3066046..68254cadf83 100644 --- a/dom/public/nsIDOMClassInfo.h +++ b/dom/public/nsIDOMClassInfo.h @@ -198,8 +198,7 @@ enum nsDOMClassInfoID { // We are now trying to preserve binary compat in classinfo. No // more putting things in those categories up there. New entries - // are to be added right before eDOMClassInfoIDCount (or, for now, - // before the MOZ_SVG ifdefs, since they're off by default). + // are to be added right before eDOMClassInfoIDCount. // Rect object used by getComputedStyle eDOMClassInfo_CSSRect_id, @@ -254,7 +253,6 @@ enum nsDOMClassInfoID { eDOMClassInfo_SVGDefsElement_id, eDOMClassInfo_SVGDescElement_id, eDOMClassInfo_SVGEllipseElement_id, - eDOMClassInfo_SVGForeignObjectElement_id, eDOMClassInfo_SVGGElement_id, eDOMClassInfo_SVGGradientElement_id, eDOMClassInfo_SVGImageElement_id, @@ -338,6 +336,12 @@ enum nsDOMClassInfoID { // PageTransition Events eDOMClassInfo_PageTransitionEvent_id, + // Define this near the end so that enabling/disabling foreignobject doesn't + // break binary compatibility +#if defined(MOZ_SVG) && defined(MOZ_SVG_FOREIGNOBJECT) + eDOMClassInfo_SVGForeignObjectElement_id, +#endif + // This one better be the last one in this list eDOMClassInfoIDCount }; diff --git a/dom/src/base/nsDOMClassInfo.cpp b/dom/src/base/nsDOMClassInfo.cpp index d56e9ba4b86..e99c2541e68 100644 --- a/dom/src/base/nsDOMClassInfo.cpp +++ b/dom/src/base/nsDOMClassInfo.cpp @@ -336,7 +336,9 @@ #include "nsIDOMSVGEllipseElement.h" #include "nsIDOMSVGException.h" #include "nsIDOMSVGFitToViewBox.h" +#ifdef MOZ_SVG_FOREIGNOBJECT #include "nsIDOMSVGForeignObjectElem.h" +#endif #include "nsIDOMSVGGElement.h" #include "nsIDOMSVGGradientElement.h" #include "nsIDOMSVGImageElement.h" @@ -857,8 +859,6 @@ static nsDOMClassInfoData sClassInfoData[] = { ELEMENT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(SVGEllipseElement, nsElementSH, ELEMENT_SCRIPTABLE_FLAGS) - NS_DEFINE_CLASSINFO_DATA(SVGForeignObjectElement, nsElementSH, - ELEMENT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(SVGGElement, nsElementSH, ELEMENT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(SVGGradientElement, nsElementSH, @@ -1008,6 +1008,14 @@ static nsDOMClassInfoData sClassInfoData[] = { DOM_DEFAULT_SCRIPTABLE_FLAGS) NS_DEFINE_CLASSINFO_DATA(PageTransitionEvent, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) + + // Define MOZ_SVG_FOREIGNOBJECT here so that when it gets switched on, + // we preserve binary compatibility. New classes should be added + // at the end. +#if defined(MOZ_SVG) && defined(MOZ_SVG_FOREIGNOBJECT) + NS_DEFINE_CLASSINFO_DATA(SVGForeignObjectElement, nsElementSH, + ELEMENT_SCRIPTABLE_FLAGS) +#endif }; nsIXPConnect *nsDOMClassInfo::sXPConnect = nsnull; @@ -2385,11 +2393,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(SVGForeignObjectElement, nsIDOMSVGForeignObjectElement) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGForeignObjectElement) - DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES - DOM_CLASSINFO_MAP_END - DOM_CLASSINFO_MAP_BEGIN(SVGGElement, nsIDOMSVGGElement) DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGGElement) DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES @@ -2713,6 +2716,13 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_END #endif // MOZ_ENABLE_CANVAS +#if defined(MOZ_SVG) && defined(MOZ_SVG_FOREIGNOBJECT) + DOM_CLASSINFO_MAP_BEGIN(SVGForeignObjectElement, nsIDOMSVGForeignObjectElement) + DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGForeignObjectElement) + DOM_CLASSINFO_SVG_GRAPHIC_ELEMENT_MAP_ENTRIES + DOM_CLASSINFO_MAP_END +#endif + #ifdef NS_DEBUG { PRUint32 i = sizeof(sClassInfoData) / sizeof(sClassInfoData[0]); diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 96a710509d4..ad869df33c1 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -189,8 +189,10 @@ nsresult NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); nsresult NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +#ifdef MOZ_SVG_FOREIGNOBJECT nsresult NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); +#endif nsresult NS_NewSVGPathFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsIFrame** aNewFrame); nsresult @@ -7293,10 +7295,12 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState, rv = NS_NewSVGLineFrame(mPresShell, aContent, &newFrame); else if (aTag == nsSVGAtoms::rect) rv = NS_NewSVGRectFrame(mPresShell, aContent, &newFrame); +#ifdef MOZ_SVG_FOREIGNOBJECT else if (aTag == nsSVGAtoms::foreignObject) { processChildren = PR_TRUE; rv = NS_NewSVGForeignObjectFrame(mPresShell, aContent, &newFrame); } +#endif else if (aTag == nsSVGAtoms::path) rv = NS_NewSVGPathFrame(mPresShell, aContent, &newFrame); else if (aTag == nsSVGAtoms::text) { @@ -7355,6 +7359,7 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState, // If we succeeded in creating a frame then initialize it, process its // children (if requested), and set the initial child list if (NS_SUCCEEDED(rv) && newFrame != nsnull) { +#ifdef MOZ_SVG_FOREIGNOBJECT if (aTag == nsSVGAtoms::foreignObject) { // Claim to be relatively positioned so that we end up being the // absolute containing block. Also, push "null" as the floater @@ -7365,7 +7370,9 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState, rv = ConstructBlock(aState, disp, aContent, geometricParent, aParentFrame, aStyleContext, &newFrame, aFrameItems, PR_TRUE); - } else { + } else +#endif // MOZ_SVG_FOREIGNOBJECT + { InitAndRestoreFrame(aState, aContent, geometricParent, aStyleContext, nsnull, newFrame); diff --git a/layout/base/nsLayoutAtomList.h b/layout/base/nsLayoutAtomList.h index 02ff831ea07..f380243ddfc 100644 --- a/layout/base/nsLayoutAtomList.h +++ b/layout/base/nsLayoutAtomList.h @@ -248,7 +248,9 @@ LAYOUT_ATOM(svgCircleFrame,"SVGCircleFrame") LAYOUT_ATOM(svgClipPathFrame,"SVGClipPathFrame") LAYOUT_ATOM(svgDefsFrame,"SVGDefsFrame") LAYOUT_ATOM(svgEllipseFrame,"SVGEllipseFrame") +#ifdef MOZ_SVG_FOREIGNOBJECT LAYOUT_ATOM(svgForeignObjectFrame,"SVGForeignObjectFrame") +#endif LAYOUT_ATOM(svgGenericContainerFrame,"SVGGenericContainerFrame") LAYOUT_ATOM(svgGFrame,"SVGGFrame") LAYOUT_ATOM(svgGlyphFrame,"SVGGlyphFrame") diff --git a/layout/svg/base/src/Makefile.in b/layout/svg/base/src/Makefile.in index 00a4f3d5be4..a4ef9d4dead 100644 --- a/layout/svg/base/src/Makefile.in +++ b/layout/svg/base/src/Makefile.in @@ -68,7 +68,6 @@ CPPSRCS = \ nsSVGClipPathFrame.cpp \ nsSVGDefsFrame.cpp \ nsSVGEllipseFrame.cpp \ - nsSVGForeignObjectFrame.cpp \ nsSVGGFrame.cpp \ nsSVGGenericContainerFrame.cpp \ nsSVGGlyphFrame.cpp \ @@ -90,6 +89,10 @@ CPPSRCS = \ nsSVGUtils.cpp \ $(NULL) +ifdef MOZ_SVG_FOREIGNOBJECT +CPPSRCS += nsSVGForeignObjectFrame.cpp +endif + include $(topsrcdir)/config/config.mk # we don't want the shared lib, but we want to force the creation of a static lib.