Bug 691194 - Move filter element attribute processing to the frame class. r=dholbert

This commit is contained in:
Robert Longson 2011-10-09 18:17:29 +01:00
parent dddc0cfe59
commit 938672ab18
4 changed files with 26 additions and 38 deletions

View File

@ -241,36 +241,3 @@ nsSVGFilterElement::GetStringInfo()
return StringAttributesInfo(mStringAttributes, sStringInfo,
NS_ARRAY_LENGTH(sStringInfo));
}
inline static void DidAnimateAttr(nsSVGFilterElement *aFilterElement)
{
// nsSVGFilterFrame doesn't implement a useful AttributeChanged
nsIFrame* frame = aFilterElement->GetPrimaryFrame();
if (frame) {
nsSVGEffects::InvalidateRenderingObservers(frame);
}
}
void
nsSVGFilterElement::DidAnimateLength(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFilterElement::DidAnimateIntegerPair(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFilterElement::DidAnimateEnum(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}
void
nsSVGFilterElement::DidAnimateString(PRUint8 aAttrEnum)
{
DidAnimateAttr(this);
}

View File

@ -88,11 +88,6 @@ protected:
virtual EnumAttributesInfo GetEnumInfo();
virtual StringAttributesInfo GetStringInfo();
virtual void DidAnimateLength(PRUint8 aAttrEnum);
virtual void DidAnimateIntegerPair(PRUint8 aAttrEnum);
virtual void DidAnimateEnum(PRUint8 aAttrEnum);
virtual void DidAnimateString(PRUint8 aAttrEnum);
enum { X, Y, WIDTH, HEIGHT };
nsSVGLength2 mLengthAttributes[4];
static LengthInfo sLengthInfo[4];

View File

@ -38,6 +38,7 @@
#include "nsIDocument.h"
#include "nsSVGOuterSVGFrame.h"
#include "nsGkAtoms.h"
#include "nsSVGEffects.h"
#include "nsSVGUtils.h"
#include "nsSVGFilterElement.h"
#include "nsSVGFilters.h"
@ -227,6 +228,27 @@ nsAutoFilterInstance::~nsAutoFilterInstance()
{
}
NS_IMETHODIMP
nsSVGFilterFrame::AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType)
{
if ((aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::x ||
aAttribute == nsGkAtoms::y ||
aAttribute == nsGkAtoms::width ||
aAttribute == nsGkAtoms::height ||
aAttribute == nsGkAtoms::filterRes ||
aAttribute == nsGkAtoms::filterUnits ||
aAttribute == nsGkAtoms::primitiveUnits)) ||
(aNameSpaceID == kNameSpaceID_XLink &&
aAttribute == nsGkAtoms::href)) {
nsSVGEffects::InvalidateRenderingObservers(this);
}
return nsSVGFilterFrameBase::AttributeChanged(aNameSpaceID,
aAttribute, aModType);
}
nsresult
nsSVGFilterFrame::FilterPaint(nsSVGRenderState *aContext,
nsIFrame *aTarget,

View File

@ -54,6 +54,10 @@ protected:
public:
NS_DECL_FRAMEARENA_HELPERS
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
PRInt32 aModType);
nsresult FilterPaint(nsSVGRenderState *aContext,
nsIFrame *aTarget, nsSVGFilterPaintCallback *aPaintCallback,
const nsIntRect* aDirtyRect);