diff --git a/content/svg/content/src/nsSVGAnimatedString.cpp b/content/svg/content/src/nsSVGAnimatedString.cpp index cec616713db1..e0ea3e1f8d16 100644 --- a/content/svg/content/src/nsSVGAnimatedString.cpp +++ b/content/svg/content/src/nsSVGAnimatedString.cpp @@ -41,13 +41,49 @@ #include "nsSVGAnimatedString.h" #include "nsContentUtils.h" + +//////////////////////////////////////////////////////////////////////// +// nsSVGAnimatedString + +class nsSVGAnimatedString : public nsIDOMSVGAnimatedString, + public nsSVGValue +{ +protected: + friend nsresult NS_NewSVGAnimatedString(nsIDOMSVGAnimatedString** result); + nsSVGAnimatedString(); + ~nsSVGAnimatedString(); + void Init(); + +public: + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGAnimatedString interface: + NS_DECL_NSIDOMSVGANIMATEDSTRING + + // remainder of nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAString& aValue); + NS_IMETHOD GetValueString(nsAString& aValue); + +protected: + nsString mBaseVal; +}; + + //---------------------------------------------------------------------- // Implementation -void -nsSVGAnimatedString::Clear() +nsSVGAnimatedString::nsSVGAnimatedString() +{ +} + +nsSVGAnimatedString::~nsSVGAnimatedString() +{ +} + +void +nsSVGAnimatedString::Init() { - mBaseVal.Truncate(); } //---------------------------------------------------------------------- @@ -121,6 +157,8 @@ NS_NewSVGAnimatedString(nsIDOMSVGAnimatedString** aResult) if(!animatedString) return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(animatedString); + animatedString->Init(); + *aResult = (nsIDOMSVGAnimatedString*) animatedString; return NS_OK; diff --git a/content/svg/content/src/nsSVGAnimatedString.h b/content/svg/content/src/nsSVGAnimatedString.h index b7bae387810b..60685665b227 100644 --- a/content/svg/content/src/nsSVGAnimatedString.h +++ b/content/svg/content/src/nsSVGAnimatedString.h @@ -40,34 +40,10 @@ #define __NS_SVGANIMATEDSTRING_H__ #include "nsIDOMSVGAnimatedString.h" -#include "nsSVGValue.h" nsresult NS_NewSVGAnimatedString(nsIDOMSVGAnimatedString** result); -//////////////////////////////////////////////////////////////////////// -// nsSVGAnimatedString -class nsSVGAnimatedString : public nsIDOMSVGAnimatedString, - public nsSVGValue -{ -protected: - friend nsresult NS_NewSVGAnimatedString(nsIDOMSVGAnimatedString** result); -public: - // nsISupports interface: - NS_DECL_ISUPPORTS - - // nsIDOMSVGAnimatedString interface: - NS_DECL_NSIDOMSVGANIMATEDSTRING - - // remainder of nsISVGValue interface: - NS_IMETHOD SetValueString(const nsAString& aValue); - NS_IMETHOD GetValueString(nsAString& aValue); - - void Clear(); - -protected: - nsString mBaseVal; -}; #endif //__NS_SVGANIMATEDSTRING_H__ diff --git a/content/svg/content/src/nsSVGElement.cpp b/content/svg/content/src/nsSVGElement.cpp index 165963f42b3f..6d861cfd3a37 100644 --- a/content/svg/content/src/nsSVGElement.cpp +++ b/content/svg/content/src/nsSVGElement.cpp @@ -69,25 +69,6 @@ #include "nsSVGNumber2.h" #include "nsSVGEnum.h" #include "nsIDOMSVGUnitTypes.h" -#include "nsIDOMSVGAngle.h" -#include "nsIDOMSVGAnimatedAngle.h" -#include "nsIDOMSVGAnimatedBoolean.h" -#include "nsIDOMSVGAnimatedInteger.h" -#include "nsIDOMSVGLength.h" -#include "nsIDOMSVGLengthList.h" -#include "nsIDOMSVGAnimatedLengthList.h" -#include "nsIDOMSVGNumberList.h" -#include "nsIDOMSVGAnimatedNumberList.h" -#include "nsIDOMSVGPointList.h" -#include "nsIDOMSVGAnimatedPoints.h" -#include "nsIDOMSVGPresAspectRatio.h" -#include "nsIDOMSVGAnimPresAspRatio.h" -#include "nsIDOMSVGTransformList.h" -#include "nsIDOMSVGAnimTransformList.h" -#include "nsIDOMSVGAnimatedString.h" -#include "nsIDOMSVGAnimatedRect.h" -#include "nsSVGRect.h" -#include "nsSVGAnimatedString.h" #include nsSVGEnumMapping nsSVGElement::sSVGUnitTypesMap[] = { @@ -336,62 +317,6 @@ nsSVGElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, break; } } - - // Now check for one of the old style basetypes going away - nsCOMPtr svg_value = GetMappedAttribute(aNamespaceID, aName); - - if (svg_value) { -#ifdef DEBUG_tor - nsCOMPtr a = do_QueryInterface(svg_value); - NS_ASSERTION(!a, "must provide element processing for unset angle"); - - nsCOMPtr b = do_QueryInterface(svg_value); - NS_ASSERTION(!b, "must provide element processing for unset boolean"); - - nsCOMPtr i = do_QueryInterface(svg_value); - NS_ASSERTION(!i, "must provide element processing for unset integer"); -#endif - - nsCOMPtr r = do_QueryInterface(svg_value); - if (r) { - nsIDOMSVGRect *rect; - r->GetBaseVal(&rect); - static_cast(rect)->Clear(); - } - nsCOMPtr ar = do_QueryInterface(svg_value); - if (ar) { - nsIDOMSVGPreserveAspectRatio *par; - ar->GetBaseVal(&par); - par->SetAlign(nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMIDYMID); - par->SetMeetOrSlice(nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_MEET); - } - nsCOMPtr s = do_QueryInterface(svg_value); - if (s) { - static_cast(s.get())->Clear(); - } - nsCOMPtr pl = do_QueryInterface(svg_value); - if (pl) { - pl->Clear(); - } - nsCOMPtr ll = do_QueryInterface(svg_value); - if (ll) { - nsIDOMSVGLengthList *lengthlist; - ll->GetBaseVal(&lengthlist); - lengthlist->Clear(); - } - nsCOMPtr nl = do_QueryInterface(svg_value); - if (nl) { - nsIDOMSVGNumberList *numberlist; - nl->GetBaseVal(&numberlist); - numberlist->Clear(); - } - nsCOMPtr tl = do_QueryInterface(svg_value); - if (tl) { - nsIDOMSVGTransformList *transform; - tl->GetBaseVal(&transform); - transform->Clear(); - } - } } } diff --git a/content/svg/content/src/nsSVGFilterElement.cpp b/content/svg/content/src/nsSVGFilterElement.cpp index 6845bbb98c47..25b49a7fe4ca 100644 --- a/content/svg/content/src/nsSVGFilterElement.cpp +++ b/content/svg/content/src/nsSVGFilterElement.cpp @@ -238,20 +238,6 @@ nsSVGFilterElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, return rv; } -nsresult -nsSVGFilterElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, - PRBool aNotify) -{ - if (aName == nsGkAtoms::filterRes && aNamespaceID == kNameSpaceID_None) { - mFilterResX->SetBaseVal(0); - mFilterResY->SetBaseVal(0); - - return nsGenericElement::UnsetAttr(aNamespaceID, aName, aNotify); - } - - return nsSVGFilterElementBase::UnsetAttr(aNamespaceID, aName, aNotify); -} - NS_IMETHODIMP_(PRBool) nsSVGFilterElement::IsAttributeMapped(const nsIAtom* name) const { diff --git a/content/svg/content/src/nsSVGFilterElement.h b/content/svg/content/src/nsSVGFilterElement.h index b4d418b14294..bb115ffda6fa 100644 --- a/content/svg/content/src/nsSVGFilterElement.h +++ b/content/svg/content/src/nsSVGFilterElement.h @@ -79,8 +79,6 @@ public: virtual nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, nsIAtom* aPrefix, const nsAString& aValue, PRBool aNotify); - virtual nsresult UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, - PRBool aNotify); virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* aAttribute) const; diff --git a/content/svg/content/src/nsSVGFilters.cpp b/content/svg/content/src/nsSVGFilters.cpp index 8072de0a8110..0aa2e3964990 100644 --- a/content/svg/content/src/nsSVGFilters.cpp +++ b/content/svg/content/src/nsSVGFilters.cpp @@ -3010,8 +3010,6 @@ public: const nsAString& aValue, nsAttrValue& aResult); virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; - virtual nsresult UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, - PRBool aNotify); protected: virtual NumberAttributesInfo GetNumberInfo(); @@ -3236,18 +3234,6 @@ nsSVGFETurbulenceElement::ParseAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, aValue, aResult); } -nsresult -nsSVGFETurbulenceElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, - PRBool aNotify) -{ - if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::numOctaves) { - mNumOctaves->SetBaseVal(1); - return nsGenericElement::UnsetAttr(aNamespaceID, aName, aNotify); - } - - return nsSVGFETurbulenceElementBase::UnsetAttr(aNamespaceID, aName, aNotify); -} - NS_IMETHODIMP nsSVGFETurbulenceElement::Filter(nsSVGFilterInstance *instance) { @@ -3849,8 +3835,6 @@ public: const nsAString& aValue, nsAttrValue& aResult); virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; - virtual nsresult UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, - PRBool aNotify); protected: virtual PRBool OperatesOnPremultipledAlpha() { @@ -3967,7 +3951,7 @@ nsSVGFEConvolveMatrixElement::Init() NS_ENSURE_SUCCESS(rv,rv); } - // DOM property: preserveAlpha , #IMPLIED attrib: preserveAlpha + // DOM property: targetY , #IMPLIED attrib: targetY { rv = NS_NewSVGAnimatedBoolean(getter_AddRefs(mPreserveAlpha), PR_FALSE); NS_ENSURE_SUCCESS(rv,rv); @@ -4135,35 +4119,6 @@ nsSVGFEConvolveMatrixElement::ParseAttribute(PRInt32 aNameSpaceID, nsIAtom* aNam aValue, aResult); } -nsresult -nsSVGFEConvolveMatrixElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, - PRBool aNotify) -{ - if (aNamespaceID == kNameSpaceID_None) { - PRBool processed = PR_FALSE; - if (aName == nsGkAtoms::order) { - mOrderX->SetBaseVal(0); - mOrderY->SetBaseVal(0); - processed = PR_TRUE; - } else if (aName == nsGkAtoms::targetX) { - mTargetX->SetBaseVal(0); - processed = PR_TRUE; - } else if (aName == nsGkAtoms::targetY) { - mTargetY->SetBaseVal(0); - processed = PR_TRUE; - } else if (aName == nsGkAtoms::preserveAlpha) { - mPreserveAlpha->SetBaseVal(PR_FALSE); - processed = PR_TRUE; - } - - if (processed) { - return nsGenericElement::UnsetAttr(aNamespaceID, aName, aNotify); - } - } - - return nsSVGFEConvolveMatrixElementBase::UnsetAttr(aNamespaceID, aName, aNotify); -} - #define BOUND(val, min, max) \ PR_MIN(PR_MAX(val, min), max) diff --git a/content/svg/content/src/nsSVGMarkerElement.cpp b/content/svg/content/src/nsSVGMarkerElement.cpp index a509740aed75..eb71fc3a9082 100644 --- a/content/svg/content/src/nsSVGMarkerElement.cpp +++ b/content/svg/content/src/nsSVGMarkerElement.cpp @@ -306,13 +306,7 @@ nsSVGMarkerElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, vb->SetHeight(mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx)); } else if (aName == nsGkAtoms::orient) { mOrientType.SetBaseValue(SVG_MARKER_ORIENT_AUTO, this, PR_FALSE); - nsIDOMSVGAngle *angle; - mOrient->GetBaseVal(&angle); - angle->NewValueSpecifiedUnits(nsIDOMSVGAngle::SVG_ANGLETYPE_UNSPECIFIED, - 0.0f); } - - return nsGenericElement::UnsetAttr(aNamespaceID, aName, aNotify); } return nsSVGMarkerElementBase::UnsetAttr(aNamespaceID, aName, aNotify); diff --git a/content/svg/content/src/nsSVGPathElement.cpp b/content/svg/content/src/nsSVGPathElement.cpp index a79c9317e5f6..648ad6b16eb9 100644 --- a/content/svg/content/src/nsSVGPathElement.cpp +++ b/content/svg/content/src/nsSVGPathElement.cpp @@ -442,24 +442,6 @@ nsSVGPathElement::BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName, aValue, aNotify); } -nsresult -nsSVGPathElement::UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, - PRBool aNotify) -{ - if (aNamespaceID == kNameSpaceID_None && aName == nsGkAtoms::d) { - if (mSegments) { - NS_REMOVE_SVGVALUE_OBSERVER(mSegments); - mSegments = nsnull; - } - - mPathData.Clear(); - - return nsGenericElement::UnsetAttr(aNamespaceID, aName, aNotify); - } - - return nsSVGPathElementBase::UnsetAttr(aNamespaceID, aName, aNotify); -} - NS_IMETHODIMP nsSVGPathElement::DidModifySVGObservable(nsISVGValue* observable, nsISVGValue::modificationType aModType) diff --git a/content/svg/content/src/nsSVGPathElement.h b/content/svg/content/src/nsSVGPathElement.h index 98ec22b1c29d..0ca812d415e8 100644 --- a/content/svg/content/src/nsSVGPathElement.h +++ b/content/svg/content/src/nsSVGPathElement.h @@ -56,9 +56,10 @@ public: nsSVGPathList() : mArguments(nsnull), mNumCommands(0), mNumArguments(0) {} ~nsSVGPathList() { Clear(); } void Playback(gfxContext *aCtx); - void Clear(); protected: + void Clear(); + float *mArguments; PRUint32 mNumCommands; PRUint32 mNumArguments; @@ -105,17 +106,13 @@ public: virtual already_AddRefed GetFlattenedPath(nsIDOMSVGMatrix *aMatrix); - // nsIContent interface virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; - virtual nsresult BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName, - const nsAString* aValue, PRBool aNotify); - virtual nsresult UnsetAttr(PRInt32 aNamespaceID, nsIAtom* aName, - PRBool aNotify); protected: - // nsSVGElement method virtual NumberAttributesInfo GetNumberInfo(); + virtual nsresult BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName, + const nsAString* aValue, PRBool aNotify); // Helper for lazily creating pathseg list nsresult CreatePathSegList(); diff --git a/content/svg/content/src/nsSVGRect.cpp b/content/svg/content/src/nsSVGRect.cpp index caf8cd0822d3..074238b59814 100644 --- a/content/svg/content/src/nsSVGRect.cpp +++ b/content/svg/content/src/nsSVGRect.cpp @@ -48,6 +48,30 @@ #include "nsContentUtils.h" #include "nsDOMError.h" +//////////////////////////////////////////////////////////////////////// +// nsSVGRect class + +class nsSVGRect : public nsIDOMSVGRect, + public nsSVGValue +{ +public: + nsSVGRect(float x=0.0f, float y=0.0f, float w=0.0f, float h=0.0f); + + // nsISupports interface: + NS_DECL_ISUPPORTS + + // nsIDOMSVGRect interface: + NS_DECL_NSIDOMSVGRECT + + // nsISVGValue interface: + NS_IMETHOD SetValueString(const nsAString& aValue); + NS_IMETHOD GetValueString(nsAString& aValue); + + +protected: + float mX, mY, mWidth, mHeight; +}; + //---------------------------------------------------------------------- // implementation: @@ -56,12 +80,6 @@ nsSVGRect::nsSVGRect(float x, float y, float w, float h) { } -void -nsSVGRect::Clear() -{ - mX = mY = mWidth = mHeight = 0.0f; -} - //---------------------------------------------------------------------- // nsISupports methods: diff --git a/content/svg/content/src/nsSVGRect.h b/content/svg/content/src/nsSVGRect.h index 883cf9bf6346..e44510d8a30a 100644 --- a/content/svg/content/src/nsSVGRect.h +++ b/content/svg/content/src/nsSVGRect.h @@ -41,9 +41,10 @@ #define __NS_SVGRECT_H__ #include "nsIDOMSVGRect.h" -#include "nsSVGValue.h" #include "gfxRect.h" +class nsIDOMSVGLength; + nsresult NS_NewSVGRect(nsIDOMSVGRect** result, float x=0.0f, float y=0.0f, @@ -57,29 +58,4 @@ NS_NewSVGReadonlyRect(nsIDOMSVGRect** result, float x=0.0f, float y=0.0f, float width=0.0f, float height=0.0f); -//////////////////////////////////////////////////////////////////////// -// nsSVGRect class - -class nsSVGRect : public nsIDOMSVGRect, - public nsSVGValue -{ -public: - nsSVGRect(float x=0.0f, float y=0.0f, float w=0.0f, float h=0.0f); - - // nsISupports interface: - NS_DECL_ISUPPORTS - - // nsIDOMSVGRect interface: - NS_DECL_NSIDOMSVGRECT - - // nsISVGValue interface: - NS_IMETHOD SetValueString(const nsAString& aValue); - NS_IMETHOD GetValueString(nsAString& aValue); - - void Clear(); - -protected: - float mX, mY, mWidth, mHeight; -}; - #endif //__NS_SVGRECT_H__