This commit is contained in:
tor@cs.brown.edu 2007-09-05 14:56:06 -07:00
Родитель 04220b6a5c
Коммит 6d4f3a6609
11 изменённых файлов: 72 добавлений и 227 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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__

Просмотреть файл

@ -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 <stdarg.h>
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<nsISVGValue> svg_value = GetMappedAttribute(aNamespaceID, aName);
if (svg_value) {
#ifdef DEBUG_tor
nsCOMPtr<nsIDOMSVGAnimatedAngle> a = do_QueryInterface(svg_value);
NS_ASSERTION(!a, "must provide element processing for unset angle");
nsCOMPtr<nsIDOMSVGAnimatedBoolean> b = do_QueryInterface(svg_value);
NS_ASSERTION(!b, "must provide element processing for unset boolean");
nsCOMPtr<nsIDOMSVGAnimatedInteger> i = do_QueryInterface(svg_value);
NS_ASSERTION(!i, "must provide element processing for unset integer");
#endif
nsCOMPtr<nsIDOMSVGAnimatedRect> r = do_QueryInterface(svg_value);
if (r) {
nsIDOMSVGRect *rect;
r->GetBaseVal(&rect);
static_cast<nsSVGRect*>(rect)->Clear();
}
nsCOMPtr<nsIDOMSVGAnimatedPreserveAspectRatio> 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<nsIDOMSVGAnimatedString> s = do_QueryInterface(svg_value);
if (s) {
static_cast<nsSVGAnimatedString*>(s.get())->Clear();
}
nsCOMPtr<nsIDOMSVGPointList> pl = do_QueryInterface(svg_value);
if (pl) {
pl->Clear();
}
nsCOMPtr<nsIDOMSVGAnimatedLengthList> ll = do_QueryInterface(svg_value);
if (ll) {
nsIDOMSVGLengthList *lengthlist;
ll->GetBaseVal(&lengthlist);
lengthlist->Clear();
}
nsCOMPtr<nsIDOMSVGAnimatedNumberList> nl = do_QueryInterface(svg_value);
if (nl) {
nsIDOMSVGNumberList *numberlist;
nl->GetBaseVal(&numberlist);
numberlist->Clear();
}
nsCOMPtr<nsIDOMSVGAnimatedTransformList> tl = do_QueryInterface(svg_value);
if (tl) {
nsIDOMSVGTransformList *transform;
tl->GetBaseVal(&transform);
transform->Clear();
}
}
}
}

Просмотреть файл

@ -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
{

Просмотреть файл

@ -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;

Просмотреть файл

@ -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)

Просмотреть файл

@ -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);

Просмотреть файл

@ -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)

Просмотреть файл

@ -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<gfxFlattenedPath> 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();

Просмотреть файл

@ -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:

Просмотреть файл

@ -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__