Bug 450495 - Make foreignObject a mandatory part of SVG. r+sr=roc

This commit is contained in:
Robert Longson 2008-08-17 12:18:21 +01:00
parent a535309e07
commit d388bfe998
11 changed files with 15 additions and 67 deletions

View File

@ -237,7 +237,6 @@ MOZ_PERMISSIONS = @MOZ_PERMISSIONS@
MOZ_XTF = @MOZ_XTF@
MOZ_NO_INSPECTOR_APIS = @MOZ_NO_INSPECTOR_APIS@
MOZ_SVG = @MOZ_SVG@
MOZ_SVG_FOREIGNOBJECT = @MOZ_SVG_FOREIGNOBJECT@
MOZ_LIBART_CFLAGS = @MOZ_LIBART_CFLAGS@
MOZ_ENABLE_CANVAS = @MOZ_ENABLE_CANVAS@
MOZ_CAIRO_CFLAGS = @MOZ_CAIRO_CFLAGS@

View File

@ -5816,23 +5816,6 @@ if test -n "$MOZ_SVG"; then
AC_DEFINE(MOZ_SVG)
fi
MOZ_SVG_FOREIGNOBJECT=1
dnl ========================================================
dnl SVG <foreignObject>
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(svg-foreignobject,
[ --disable-svg-foreignobject
Disable SVG <foreignObject> support],
MOZ_SVG_FOREIGNOBJECT=,
MOZ_SVG_FOREIGNOBJECT=1 )
if test "$MOZ_SVG_FOREIGNOBJECT"; then
if test "$MOZ_SVG"; then
AC_DEFINE(MOZ_SVG_FOREIGNOBJECT)
else
MOZ_SVG_FOREIGNOBEJCT=
fi
fi
dnl ========================================================
dnl Installer
dnl ========================================================
@ -7958,7 +7941,6 @@ AC_SUBST(MOZ_XTF)
AC_SUBST(MOZ_NO_INSPECTOR_APIS)
AC_SUBST(MOZ_PREF_EXTENSIONS)
AC_SUBST(MOZ_SVG)
AC_SUBST(MOZ_SVG_FOREIGNOBJECT)
AC_SUBST(MOZ_XSLT_STANDALONE)
AC_SUBST(MOZ_JS_LIBS)
AC_SUBST(MOZ_PSM)

View File

@ -1083,9 +1083,7 @@ GK_ATOM(font_size_adjust, "font-size-adjust")
GK_ATOM(font_stretch, "font-stretch")
GK_ATOM(font_style, "font-style")
GK_ATOM(font_variant, "font-variant")
#ifdef MOZ_SVG_FOREIGNOBJECT
GK_ATOM(foreignObject, "foreignObject")
#endif
GK_ATOM(fractalNoise, "fractalNoise")
GK_ATOM(fx, "fx")
GK_ATOM(fy, "fy")
@ -1522,9 +1520,7 @@ GK_ATOM(svgAFrame, "SVGAFrame")
GK_ATOM(svgClipPathFrame, "SVGClipPathFrame")
GK_ATOM(svgDefsFrame, "SVGDefsFrame")
GK_ATOM(svgFilterFrame, "SVGFilterFrame")
#ifdef MOZ_SVG_FOREIGNOBJECT
GK_ATOM(svgForeignObjectFrame, "SVGForeignObjectFrame")
#endif
GK_ATOM(svgGenericContainerFrame, "SVGGenericContainerFrame")
GK_ATOM(svgGFrame, "SVGGFrame")
GK_ATOM(svgGlyphFrame, "SVGGlyphFrame")

View File

@ -88,6 +88,7 @@ CPPSRCS = \
nsSVGFeatures.cpp \
nsSVGFilterElement.cpp \
nsSVGFilters.cpp \
nsSVGForeignObjectElement.cpp \
nsSVGGElement.cpp \
nsSVGGradientElement.cpp \
nsSVGGraphicElement.cpp \
@ -138,10 +139,6 @@ 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.

View File

@ -64,10 +64,8 @@ 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

View File

@ -114,9 +114,7 @@ SVG_ELEMENT(font_face_format, ATTRS_NONE)
SVG_ELEMENT(font_face_name, ATTRS_NONE)
SVG_ELEMENT(font_face_src, ATTRS_NONE)
SVG_ELEMENT(font_face_uri, ATTRS_NONE)
#ifdef MOZ_SVG_FOREIGNOBJECT
SVG_ELEMENT(foreignObject, ATTRS_ALL)
#endif
SVG_ELEMENT(g, ATTRS_ALL)
SVG_ELEMENT(glyph, ATTRS_NONE)
SVG_ELEMENT(glyphRef, ATTRS_NONE)

View File

@ -400,7 +400,7 @@ enum nsDOMClassInfoID {
// added here, which is the end of the things that are currently on by
// default.
#if defined(MOZ_SVG) && defined(MOZ_SVG_FOREIGNOBJECT)
#ifdef MOZ_SVG
eDOMClassInfo_SVGForeignObjectElement_id,
#endif

View File

@ -389,9 +389,7 @@
#include "nsIDOMSVGFilterElement.h"
#include "nsIDOMSVGFilters.h"
#include "nsIDOMSVGFitToViewBox.h"
#ifdef MOZ_SVG_FOREIGNOBJECT
#include "nsIDOMSVGForeignObjectElem.h"
#endif
#include "nsIDOMSVGGElement.h"
#include "nsIDOMSVGGradientElement.h"
#include "nsIDOMSVGImageElement.h"
@ -1212,10 +1210,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(ClientRectList, nsClientRectListSH,
ARRAY_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)
#ifdef MOZ_SVG
NS_DEFINE_CLASSINFO_DATA(SVGForeignObjectElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
#endif

View File

@ -174,10 +174,8 @@ nsIFrame*
NS_NewSVGGFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
nsIFrame*
NS_NewSVGGenericContainerFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
#ifdef MOZ_SVG_FOREIGNOBJECT
nsIFrame*
NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
#endif
nsIFrame*
NS_NewSVGAFrame(nsIPresShell* aPresShell, nsIContent* aContent, nsStyleContext* aContext);
nsIFrame*
@ -7073,15 +7071,12 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState,
mDocument->BindingManager()->ResolveTag(aParentFrame->GetContent(),
&parentNSID);
parentIsSVG = parentNSID == kNameSpaceID_SVG
#ifdef MOZ_SVG_FOREIGNOBJECT
// It's not clear whether the SVG spec intends to allow any SVG
// content within svg:foreignObject at all (SVG 1.1, section
// 23.2), but if it does, it better be svg:svg. So given that
// we're allowing it, treat it as a non-SVG parent.
&& parentTag != nsGkAtoms::foreignObject
#endif
;
// It's not clear whether the SVG spec intends to allow any SVG
// content within svg:foreignObject at all (SVG 1.1, section
// 23.2), but if it does, it better be svg:svg. So given that
// we're allowing it, treat it as a non-SVG parent.
parentIsSVG = parentNSID == kNameSpaceID_SVG &&
parentTag != nsGkAtoms::foreignObject;
}
if ((aTag != nsGkAtoms::svg && !parentIsSVG) ||
@ -7149,11 +7144,9 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState,
else if (aTag == nsGkAtoms::defs) {
newFrame = NS_NewSVGContainerFrame(mPresShell, aContent, aStyleContext);
}
#ifdef MOZ_SVG_FOREIGNOBJECT
else if (aTag == nsGkAtoms::foreignObject) {
newFrame = NS_NewSVGForeignObjectFrame(mPresShell, aContent, aStyleContext);
}
#endif
else if (aTag == nsGkAtoms::a) {
newFrame = NS_NewSVGAFrame(mPresShell, aContent, aStyleContext);
}
@ -7272,7 +7265,6 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState,
}
nsFrameItems childItems;
#ifdef MOZ_SVG_FOREIGNOBJECT
if (aTag == nsGkAtoms::foreignObject) {
// Resolve pseudo style and create an inner block frame
// XXX this breaks style inheritance
@ -7297,9 +7289,7 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState,
// Give the blockFrame a view so that GetOffsetTo works for descendants
// of blockFrame with views...
nsHTMLContainerFrame::CreateViewForFrame(blockFrame, nsnull, PR_TRUE);
} else
#endif // MOZ_SVG_FOREIGNOBJECT
{
} else {
// Process the child content if requested.
if (!newFrame->IsLeaf()) {
rv = ProcessChildren(aState, aContent, newFrame, PR_FALSE, childItems,
@ -7508,10 +7498,8 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsFrameConstructorState& aState,
// Don't create frames for non-SVG children of SVG elements
if (aNameSpaceID != kNameSpaceID_SVG &&
aParentFrame &&
aParentFrame->IsFrameOfType(nsIFrame::eSVG)
#ifdef MOZ_SVG_FOREIGNOBJECT
&& !aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)
#endif
aParentFrame->IsFrameOfType(nsIFrame::eSVG) &&
!aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)
) {
return NS_OK;
}

View File

@ -79,8 +79,6 @@
#ifdef MOZ_SVG
#include "nsSVGUtils.h"
#endif
#ifdef MOZ_SVG_FOREIGNOBJECT
#include "nsSVGForeignObjectFrame.h"
#include "nsSVGOuterSVGFrame.h"
#endif
@ -632,7 +630,7 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(const nsEvent* aEvent, nsIFrame* aF
// then we need to do extra work
nsIFrame* rootFrame = aFrame;
for (nsIFrame* f = aFrame; f; f = GetCrossDocParentFrame(f)) {
#ifdef MOZ_SVG_FOREIGNOBJECT
#ifdef MOZ_SVG
if (f->IsFrameOfType(nsIFrame::eSVGForeignObject) && f->GetFirstChild(nsnull)) {
nsSVGForeignObjectFrame* fo = static_cast<nsSVGForeignObjectFrame*>(f);
nsIFrame* outer = nsSVGUtils::GetOuterSVGFrame(fo);

View File

@ -72,6 +72,7 @@ CPPSRCS = \
nsSVGEffects.cpp \
nsSVGFilterFrame.cpp \
nsSVGFilterInstance.cpp \
nsSVGForeignObjectFrame.cpp \
nsSVGGFrame.cpp \
nsSVGGenericContainerFrame.cpp \
nsSVGGeometryFrame.cpp \
@ -96,10 +97,6 @@ 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.
@ -108,7 +105,7 @@ FORCE_STATIC_LIB = 1
EXPORTS = \
nsSVGUtils.h \
nsSVGFilterInstance.h \
nsSVGForeignObjectFrame.h \
nsSVGForeignObjectFrame.h \
$(NULL)
include $(topsrcdir)/config/rules.mk