зеркало из https://github.com/mozilla/pjs.git
Bug 696078 - Move filter attribute processing to frame classes. r=jwatt
--HG-- rename : layout/svg/base/src/nsSVGLeafFrame.cpp => layout/svg/base/src/SVGFELeafFrame.cpp extra : rebase_source : 74ac4d84da2f0a99272e83590a9adc1dc8511fce
This commit is contained in:
Родитель
ceaae4130f
Коммит
605b8784d0
|
@ -1776,6 +1776,10 @@ GK_ATOM(XULLabelFrame, "XULLabelFrame")
|
|||
GK_ATOM(svgAFrame, "SVGAFrame")
|
||||
GK_ATOM(svgClipPathFrame, "SVGClipPathFrame")
|
||||
GK_ATOM(svgDefsFrame, "SVGDefsFrame")
|
||||
GK_ATOM(svgFEContainerFrame, "SVGFEContainerFrame")
|
||||
GK_ATOM(svgFEImageFrame, "SVGFEImageFrame")
|
||||
GK_ATOM(svgFELeafFrame, "SVGFELeafFrame")
|
||||
GK_ATOM(svgFEUnstyledLeafFrame, "SVGFEUnstyledLeafFrame")
|
||||
GK_ATOM(svgFilterFrame, "SVGFilterFrame")
|
||||
GK_ATOM(svgForeignObjectFrame, "SVGForeignObjectFrame")
|
||||
GK_ATOM(svgGenericContainerFrame, "SVGGenericContainerFrame")
|
||||
|
|
|
@ -59,11 +59,8 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "gfxContext.h"
|
||||
#include "gfxMatrix.h"
|
||||
#include "nsIDOMSVGURIReference.h"
|
||||
#include "nsImageLoadingContent.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "SVGAnimatedPreserveAspectRatio.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsSVGFilterElement.h"
|
||||
#include "nsSVGString.h"
|
||||
|
@ -251,6 +248,18 @@ nsSVGFE::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
|||
{
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFE::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::x ||
|
||||
aAttribute == nsGkAtoms::y ||
|
||||
aAttribute == nsGkAtoms::width ||
|
||||
aAttribute == nsGkAtoms::height ||
|
||||
aAttribute == nsGkAtoms::result);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFilterPrimitiveStandardAttributes methods
|
||||
|
||||
|
@ -308,85 +317,6 @@ nsSVGFE::GetLengthInfo()
|
|||
ArrayLength(sLengthInfo));
|
||||
}
|
||||
|
||||
inline static void DidAnimateAttr(Element *aFilterPrimitive)
|
||||
{
|
||||
// nsSVGLeafFrame doesn't implement AttributeChanged.
|
||||
nsIFrame* frame = aFilterPrimitive->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
nsSVGEffects::InvalidateRenderingObservers(frame);
|
||||
}
|
||||
}
|
||||
|
||||
inline static void DidAnimateAttrViaParent(Element *aFilterPrimitive)
|
||||
{
|
||||
// No frame, use parent's
|
||||
NS_ASSERTION(!aFilterPrimitive->GetPrimaryFrame(), "Not expecting a frame");
|
||||
nsIContent *parent = aFilterPrimitive->GetFlattenedTreeParent();
|
||||
if (parent && parent->IsElement()) {
|
||||
DidAnimateAttr(parent->AsElement());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFE::DidAnimateLength(PRUint8 aAttrEnum)
|
||||
{
|
||||
DidAnimateAttr(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFE::DidAnimateNumber(PRUint8 aAttrEnum)
|
||||
{
|
||||
DidAnimateAttr(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFE::DidAnimateNumberPair(PRUint8 aAttrEnum)
|
||||
{
|
||||
DidAnimateAttr(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFE::DidAnimateNumberList(PRUint8 aAttrEnum)
|
||||
{
|
||||
DidAnimateAttr(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFE::DidAnimateInteger(PRUint8 aAttrEnum)
|
||||
{
|
||||
DidAnimateAttr(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFE::DidAnimateIntegerPair(PRUint8 aAttrEnum)
|
||||
{
|
||||
DidAnimateAttr(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFE::DidAnimateEnum(PRUint8 aAttrEnum)
|
||||
{
|
||||
DidAnimateAttr(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFE::DidAnimatePreserveAspectRatio()
|
||||
{
|
||||
DidAnimateAttr(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFE::DidAnimateBoolean(PRUint8 aAttrEnum)
|
||||
{
|
||||
DidAnimateAttr(this);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFE::DidAnimateString(PRUint8 aAttrEnum)
|
||||
{
|
||||
DidAnimateAttr(this);
|
||||
}
|
||||
|
||||
//---------------------Gaussian Blur------------------------
|
||||
|
||||
typedef nsSVGFE nsSVGFEGaussianBlurElementBase;
|
||||
|
@ -411,6 +341,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo >& aSources);
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
|
@ -800,6 +732,16 @@ nsSVGFEGaussianBlurElement::Filter(nsSVGFilterInstance* aInstance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEGaussianBlurElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFEGaussianBlurElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::stdDeviation));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFEGaussianBlurElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
||||
{
|
||||
|
@ -881,6 +823,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
|
||||
|
@ -1035,6 +979,17 @@ nsSVGFEBlendElement::Filter(nsSVGFilterInstance* aInstance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEBlendElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFEBlendElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::in2 ||
|
||||
aAttribute == nsGkAtoms::mode));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFEBlendElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
||||
{
|
||||
|
@ -1083,6 +1038,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
|
||||
|
@ -1338,6 +1295,17 @@ nsSVGFEColorMatrixElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEColorMatrixElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFEColorMatrixElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::type ||
|
||||
aAttribute == nsGkAtoms::values));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
|
@ -1386,6 +1354,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
|
@ -1597,6 +1567,21 @@ nsSVGFECompositeElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFECompositeElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFECompositeElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::in2 ||
|
||||
aAttribute == nsGkAtoms::k1 ||
|
||||
aAttribute == nsGkAtoms::k2 ||
|
||||
aAttribute == nsGkAtoms::k3 ||
|
||||
aAttribute == nsGkAtoms::k4 ||
|
||||
aAttribute == nsGkAtoms::_operator));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFECompositeElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
||||
{
|
||||
|
@ -1680,6 +1665,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
|
||||
|
@ -1760,7 +1747,7 @@ nsSVGFEComponentTransferElement::GetStringInfo()
|
|||
{ 0xafab106d, 0xbc18, 0x4f7f, \
|
||||
{ 0x9e, 0x29, 0xfe, 0xb4, 0xb0, 0x16, 0x5f, 0xf4 } }
|
||||
|
||||
typedef nsSVGElement nsSVGComponentTransferFunctionElementBase;
|
||||
typedef SVGFEUnstyledElement nsSVGComponentTransferFunctionElementBase;
|
||||
|
||||
class nsSVGComponentTransferFunctionElement : public nsSVGComponentTransferFunctionElementBase
|
||||
{
|
||||
|
@ -1777,22 +1764,16 @@ public:
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT
|
||||
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
|
||||
virtual PRInt32 GetChannel() = 0;
|
||||
void GenerateLookupTable(PRUint8* aTable);
|
||||
|
||||
protected:
|
||||
virtual NumberAttributesInfo GetNumberInfo();
|
||||
virtual void DidAnimateNumber(PRUint8 aAttrEnum) {
|
||||
DidAnimateAttrViaParent(this);
|
||||
}
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
virtual void DidAnimateEnum(PRUint8 aAttrEnum) {
|
||||
DidAnimateAttrViaParent(this);
|
||||
}
|
||||
virtual NumberListAttributesInfo GetNumberListInfo();
|
||||
virtual void DidAnimateNumberList(PRUint8 aAttrEnum) {
|
||||
DidAnimateAttrViaParent(this);
|
||||
}
|
||||
|
||||
// nsIDOMSVGComponentTransferFunctionElement properties:
|
||||
enum { TABLEVALUES };
|
||||
|
@ -1851,6 +1832,15 @@ nsSVGFEComponentTransferElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEComponentTransferElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFEComponentTransferElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
aAttribute == nsGkAtoms::in);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFEComponentTransferElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
||||
{
|
||||
|
@ -1910,6 +1900,23 @@ NS_INTERFACE_MAP_BEGIN(nsSVGComponentTransferFunctionElement)
|
|||
NS_INTERFACE_MAP_END_INHERITING(nsSVGComponentTransferFunctionElementBase)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsFEUnstyledElement methods
|
||||
|
||||
bool
|
||||
nsSVGComponentTransferFunctionElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::tableValues ||
|
||||
aAttribute == nsGkAtoms::slope ||
|
||||
aAttribute == nsGkAtoms::intercept ||
|
||||
aAttribute == nsGkAtoms::amplitude ||
|
||||
aAttribute == nsGkAtoms::exponent ||
|
||||
aAttribute == nsGkAtoms::offset ||
|
||||
aAttribute == nsGkAtoms::type);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGComponentTransferFunctionElement methods
|
||||
|
||||
|
@ -2286,7 +2293,7 @@ protected:
|
|||
static StringInfo sStringInfo[1];
|
||||
};
|
||||
|
||||
typedef nsSVGStylableElement nsSVGFEMergeNodeElementBase;
|
||||
typedef SVGFEUnstyledElement nsSVGFEMergeNodeElementBase;
|
||||
|
||||
#define NS_SVG_FE_MERGE_NODE_CID \
|
||||
{ 0x413687ec, 0x77fd, 0x4077, \
|
||||
|
@ -2316,6 +2323,9 @@ public:
|
|||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
|
||||
const nsSVGString* In1() { return &mStringAttributes[IN1]; }
|
||||
|
||||
operator nsISupports*() { return static_cast<nsIContent*>(this); }
|
||||
|
@ -2432,6 +2442,16 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGFEMergeNodeElementBase)
|
|||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEMergeNodeElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsFEUnstyledElement methods
|
||||
|
||||
bool
|
||||
nsSVGFEMergeNodeElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::in;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFEMergeNodeElement methods
|
||||
|
||||
|
@ -2475,6 +2495,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
|
@ -2596,6 +2618,17 @@ nsSVGFEOffsetElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEOffsetElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFEOffsetElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::dx ||
|
||||
aAttribute == nsGkAtoms::dy));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFEOffsetElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
||||
{
|
||||
|
@ -2807,6 +2840,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
|
@ -2962,6 +2997,15 @@ nsSVGFETileElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFETileElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFETileElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
aAttribute == nsGkAtoms::in);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
|
@ -2998,6 +3042,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance);
|
||||
|
@ -3301,6 +3347,19 @@ nsSVGFETurbulenceElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFETurbulenceElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFETurbulenceElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::seed ||
|
||||
aAttribute == nsGkAtoms::baseFrequency ||
|
||||
aAttribute == nsGkAtoms::numOctaves ||
|
||||
aAttribute == nsGkAtoms::type ||
|
||||
aAttribute == nsGkAtoms::stitchTiles));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFETurbulenceElement::InitSeed(PRInt32 aSeed)
|
||||
{
|
||||
|
@ -3525,6 +3584,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
|
@ -3798,6 +3859,17 @@ nsSVGFEMorphologyElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEMorphologyElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFEMorphologyElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::radius ||
|
||||
aAttribute == nsGkAtoms::_operator));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
|
@ -3846,6 +3918,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
|
@ -4256,6 +4330,24 @@ nsSVGFEConvolveMatrixElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEConvolveMatrixElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFEConvolveMatrixElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::divisor ||
|
||||
aAttribute == nsGkAtoms::bias ||
|
||||
aAttribute == nsGkAtoms::kernelUnitLength ||
|
||||
aAttribute == nsGkAtoms::targetX ||
|
||||
aAttribute == nsGkAtoms::targetY ||
|
||||
aAttribute == nsGkAtoms::order ||
|
||||
aAttribute == nsGkAtoms::preserveAlpha||
|
||||
aAttribute == nsGkAtoms::edgeMode ||
|
||||
aAttribute == nsGkAtoms::kernelMatrix));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
|
@ -4317,7 +4409,7 @@ nsSVGFEConvolveMatrixElement::GetNumberListInfo()
|
|||
|
||||
//---------------------DistantLight------------------------
|
||||
|
||||
typedef nsSVGElement nsSVGFEDistantLightElementBase;
|
||||
typedef SVGFEUnstyledElement nsSVGFEDistantLightElementBase;
|
||||
|
||||
class nsSVGFEDistantLightElement : public nsSVGFEDistantLightElementBase,
|
||||
public nsIDOMSVGFEDistantLightElement
|
||||
|
@ -4337,14 +4429,14 @@ public:
|
|||
NS_FORWARD_NSIDOMNODE(nsSVGFEDistantLightElementBase::)
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGFEDistantLightElementBase::)
|
||||
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
protected:
|
||||
virtual NumberAttributesInfo GetNumberInfo();
|
||||
virtual void DidAnimateNumber(PRUint8 aAttrEnum) {
|
||||
DidAnimateAttrViaParent(this);
|
||||
}
|
||||
|
||||
enum { AZIMUTH, ELEVATION };
|
||||
nsSVGNumber2 mNumberAttributes[2];
|
||||
|
@ -4379,6 +4471,18 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGFEDistantLightElementBase)
|
|||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEDistantLightElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsFEUnstyledElement methods
|
||||
|
||||
bool
|
||||
nsSVGFEDistantLightElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::azimuth ||
|
||||
aAttribute == nsGkAtoms::elevation);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFEDistantLightElement methods
|
||||
|
||||
|
@ -4408,7 +4512,7 @@ nsSVGFEDistantLightElement::GetNumberInfo()
|
|||
|
||||
//---------------------PointLight------------------------
|
||||
|
||||
typedef nsSVGElement nsSVGFEPointLightElementBase;
|
||||
typedef SVGFEUnstyledElement nsSVGFEPointLightElementBase;
|
||||
|
||||
class nsSVGFEPointLightElement : public nsSVGFEPointLightElementBase,
|
||||
public nsIDOMSVGFEPointLightElement
|
||||
|
@ -4428,14 +4532,14 @@ public:
|
|||
NS_FORWARD_NSIDOMNODE(nsSVGFEPointLightElementBase::)
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGFEPointLightElementBase::)
|
||||
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
protected:
|
||||
virtual NumberAttributesInfo GetNumberInfo();
|
||||
virtual void DidAnimateNumber(PRUint8 aAttrEnum) {
|
||||
DidAnimateAttrViaParent(this);
|
||||
}
|
||||
|
||||
enum { X, Y, Z };
|
||||
nsSVGNumber2 mNumberAttributes[3];
|
||||
|
@ -4471,6 +4575,19 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGFEPointLightElementBase)
|
|||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEPointLightElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsFEUnstyledElement methods
|
||||
|
||||
bool
|
||||
nsSVGFEPointLightElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::x ||
|
||||
aAttribute == nsGkAtoms::y ||
|
||||
aAttribute == nsGkAtoms::z);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFEPointLightElement methods
|
||||
|
||||
|
@ -4504,7 +4621,7 @@ nsSVGFEPointLightElement::GetNumberInfo()
|
|||
|
||||
//---------------------SpotLight------------------------
|
||||
|
||||
typedef nsSVGElement nsSVGFESpotLightElementBase;
|
||||
typedef SVGFEUnstyledElement nsSVGFESpotLightElementBase;
|
||||
|
||||
class nsSVGFESpotLightElement : public nsSVGFESpotLightElementBase,
|
||||
public nsIDOMSVGFESpotLightElement
|
||||
|
@ -4525,14 +4642,14 @@ public:
|
|||
NS_FORWARD_NSIDOMNODE(nsSVGFESpotLightElementBase::)
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGFESpotLightElementBase::)
|
||||
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
protected:
|
||||
virtual NumberAttributesInfo GetNumberInfo();
|
||||
virtual void DidAnimateNumber(PRUint8 aAttrEnum) {
|
||||
DidAnimateAttrViaParent(this);
|
||||
}
|
||||
|
||||
enum { X, Y, Z, POINTS_AT_X, POINTS_AT_Y, POINTS_AT_Z,
|
||||
SPECULAR_EXPONENT, LIMITING_CONE_ANGLE };
|
||||
|
@ -4574,6 +4691,24 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGFESpotLightElementBase)
|
|||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFESpotLightElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsFEUnstyledElement methods
|
||||
|
||||
bool
|
||||
nsSVGFESpotLightElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::x ||
|
||||
aAttribute == nsGkAtoms::y ||
|
||||
aAttribute == nsGkAtoms::z ||
|
||||
aAttribute == nsGkAtoms::pointsAtX ||
|
||||
aAttribute == nsGkAtoms::pointsAtY ||
|
||||
aAttribute == nsGkAtoms::pointsAtZ ||
|
||||
aAttribute == nsGkAtoms::specularExponent ||
|
||||
aAttribute == nsGkAtoms::limitingConeAngle);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFESpotLightElement methods
|
||||
|
||||
|
@ -4658,6 +4793,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
// XXX shouldn't we have ComputeTargetBBox here, since the output can
|
||||
|
@ -4985,6 +5122,17 @@ nsSVGFELightingElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFELightingElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFELightingElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::surfaceScale ||
|
||||
aAttribute == nsGkAtoms::kernelUnitLength));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
|
@ -5034,6 +5182,9 @@ public:
|
|||
NS_FORWARD_NSIDOMNODE(nsSVGFEDiffuseLightingElementBase::)
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGFEDiffuseLightingElementBase::)
|
||||
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
@ -5105,6 +5256,15 @@ nsSVGFEDiffuseLightingElement::GetKernelUnitLengthY(nsIDOMSVGAnimatedNumber **aK
|
|||
this);
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEDiffuseLightingElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFEDiffuseLightingElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
aAttribute == nsGkAtoms::diffuseConstant);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
|
@ -5162,6 +5322,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
protected:
|
||||
|
@ -5257,6 +5419,15 @@ nsSVGFESpecularLightingElement::Filter(nsSVGFilterInstance *instance,
|
|||
return nsSVGFESpecularLightingElementBase::Filter(instance, aSources, aTarget, rect);
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFESpecularLightingElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFESpecularLightingElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::specularConstant ||
|
||||
aAttribute == nsGkAtoms::specularExponent));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFESpecularLightingElement::LightPixel(const float *N, const float *L,
|
||||
|
@ -5296,90 +5467,6 @@ nsSVGFESpecularLightingElement::LightPixel(const float *N, const float *L,
|
|||
|
||||
//---------------------Image------------------------
|
||||
|
||||
typedef nsSVGFE nsSVGFEImageElementBase;
|
||||
|
||||
class nsSVGFEImageElement : public nsSVGFEImageElementBase,
|
||||
public nsIDOMSVGFEImageElement,
|
||||
public nsIDOMSVGURIReference,
|
||||
public nsImageLoadingContent
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGFEImageElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
nsSVGFEImageElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsSVGFEImageElement();
|
||||
|
||||
public:
|
||||
virtual bool SubregionIsUnionOfRegions() { return false; }
|
||||
|
||||
// interfaces:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// FE Base
|
||||
NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEImageElementBase::)
|
||||
|
||||
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
|
||||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance);
|
||||
|
||||
NS_DECL_NSIDOMSVGFEIMAGEELEMENT
|
||||
NS_DECL_NSIDOMSVGURIREFERENCE
|
||||
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEImageElementBase::)
|
||||
|
||||
NS_FORWARD_NSIDOMNODE(nsSVGFEImageElementBase::)
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGFEImageElementBase::)
|
||||
|
||||
// nsIContent
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
const nsAString* aValue, bool aNotify);
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers);
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
// imgIDecoderObserver
|
||||
NS_IMETHOD OnStopDecode(imgIRequest *aRequest, nsresult status,
|
||||
const PRUnichar *statusArg);
|
||||
// imgIContainerObserver
|
||||
NS_IMETHOD FrameChanged(imgIContainer *aContainer,
|
||||
const nsIntRect *aDirtyRect);
|
||||
// imgIContainerObserver
|
||||
NS_IMETHOD OnStartContainer(imgIRequest *aRequest,
|
||||
imgIContainer *aContainer);
|
||||
|
||||
void MaybeLoadSVGImage();
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
private:
|
||||
// Invalidate users of the filter containing this element.
|
||||
void Invalidate();
|
||||
|
||||
nsresult LoadSVGImage(bool aForce, bool aNotify);
|
||||
|
||||
protected:
|
||||
virtual bool OperatesOnSRGB(nsSVGFilterInstance*,
|
||||
PRInt32, Image*) { return true; }
|
||||
|
||||
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
virtual void DidAnimateString(PRUint8 aAttrEnum);
|
||||
|
||||
enum { RESULT, HREF };
|
||||
nsSVGString mStringAttributes[2];
|
||||
static StringInfo sStringInfo[2];
|
||||
|
||||
SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo nsSVGFEImageElement::sStringInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::result, kNameSpaceID_None, true },
|
||||
|
@ -5468,10 +5555,22 @@ nsSVGFEImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
|||
const nsAString* aValue, bool aNotify)
|
||||
{
|
||||
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
|
||||
if (aValue) {
|
||||
LoadSVGImage(true, aNotify);
|
||||
} else {
|
||||
CancelImageRequests(aNotify);
|
||||
|
||||
// If there isn't a frame we still need to load the image in case
|
||||
// the frame is created later e.g. by attaching to a document.
|
||||
// If there is a frame then it should deal with loading as the image
|
||||
// url may be animated.
|
||||
if (!GetPrimaryFrame()) {
|
||||
|
||||
// Prevent setting image.src by exiting early
|
||||
if (nsContentUtils::IsImageSrcSetDisabled()) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (aValue) {
|
||||
LoadSVGImage(true, aNotify);
|
||||
} else {
|
||||
CancelImageRequests(aNotify);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5591,6 +5690,17 @@ nsSVGFEImageElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEImageElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
// nsGkAtoms::href is deliberately omitted as the frame has special
|
||||
// handling to load the image
|
||||
return nsSVGFEImageElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
aAttribute == nsGkAtoms::preserveAspectRatio);
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
nsSVGFEImageElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
|
@ -5617,17 +5727,6 @@ nsSVGFEImageElement::GetStringInfo()
|
|||
ArrayLength(sStringInfo));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFEImageElement::DidAnimateString(PRUint8 aAttrEnum)
|
||||
{
|
||||
if (aAttrEnum == HREF) {
|
||||
LoadSVGImage(true, false);
|
||||
return;
|
||||
}
|
||||
|
||||
nsSVGFEImageElementBase::DidAnimateString(aAttrEnum);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// imgIDecoderObserver methods
|
||||
|
||||
|
@ -5704,6 +5803,8 @@ public:
|
|||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
|
@ -5903,6 +6004,19 @@ nsSVGFEDisplacementMapElement::Filter(nsSVGFilterInstance *instance,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEDisplacementMapElement::AttributeAffectsRendering(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFEDisplacementMapElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::in2 ||
|
||||
aAttribute == nsGkAtoms::scale ||
|
||||
aAttribute == nsGkAtoms::xChannelSelector ||
|
||||
aAttribute == nsGkAtoms::yChannelSelector));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFEDisplacementMapElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
||||
{
|
||||
|
|
|
@ -39,13 +39,16 @@
|
|||
|
||||
#include "nsSVGStylableElement.h"
|
||||
#include "nsSVGLength2.h"
|
||||
#include "nsSVGString.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "gfxRect.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "nsIDOMSVGFilters.h"
|
||||
#include "nsImageLoadingContent.h"
|
||||
#include "nsIDOMSVGURIReference.h"
|
||||
#include "SVGAnimatedPreserveAspectRatio.h"
|
||||
|
||||
class nsSVGFilterResource;
|
||||
class nsSVGString;
|
||||
class nsSVGNumberPair;
|
||||
class nsSVGFilterInstance;
|
||||
|
||||
|
@ -64,6 +67,11 @@ typedef nsSVGStylableElement nsSVGFEBase;
|
|||
{ 0x60483958, 0xd229, 0x4a77, \
|
||||
{ 0x96, 0xb2, 0x62, 0x3e, 0x69, 0x95, 0x1e, 0x0e } }
|
||||
|
||||
/**
|
||||
* Base class for filter primitive elements
|
||||
* Children of those elements e.g. feMergeNode
|
||||
* derive from SVGFEUnstyledElement instead
|
||||
*/
|
||||
class nsSVGFE : public nsSVGFEBase
|
||||
//, public nsIDOMSVGFilterPrimitiveStandardAttributes
|
||||
{
|
||||
|
@ -194,6 +202,11 @@ public:
|
|||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect) = 0;
|
||||
|
||||
// returns true if changes to the attribute should cause us to
|
||||
// repaint the filter
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
|
||||
static nsIntRect GetMaxRect() {
|
||||
// Try to avoid overflow errors dealing with this rect. It will
|
||||
// be intersected with some other reasonable-sized rect eventually.
|
||||
|
@ -220,16 +233,6 @@ protected:
|
|||
|
||||
// nsSVGElement specializations:
|
||||
virtual LengthAttributesInfo GetLengthInfo();
|
||||
virtual void DidAnimateLength(PRUint8 aAttrEnum);
|
||||
virtual void DidAnimateNumber(PRUint8 aAttrEnum);
|
||||
virtual void DidAnimateNumberPair(PRUint8 aAttrEnum);
|
||||
virtual void DidAnimateNumberList(PRUint8 aAttrEnum);
|
||||
virtual void DidAnimateInteger(PRUint8 aAttrEnum);
|
||||
virtual void DidAnimateIntegerPair(PRUint8 aAttrEnum);
|
||||
virtual void DidAnimateEnum(PRUint8 aAttrEnum);
|
||||
virtual void DidAnimateBoolean(PRUint8 aAttrEnum);
|
||||
virtual void DidAnimatePreserveAspectRatio();
|
||||
virtual void DidAnimateString(PRUint8 aAttrEnum);
|
||||
|
||||
// nsIDOMSVGFitlerPrimitiveStandardAttributes values
|
||||
enum { X, Y, WIDTH, HEIGHT };
|
||||
|
@ -237,4 +240,106 @@ protected:
|
|||
static LengthInfo sLengthInfo[4];
|
||||
};
|
||||
|
||||
typedef nsSVGFE nsSVGFEImageElementBase;
|
||||
|
||||
class nsSVGFEImageElement : public nsSVGFEImageElementBase,
|
||||
public nsIDOMSVGFEImageElement,
|
||||
public nsIDOMSVGURIReference,
|
||||
public nsImageLoadingContent
|
||||
{
|
||||
friend class SVGFEImageFrame;
|
||||
|
||||
protected:
|
||||
friend nsresult NS_NewSVGFEImageElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
nsSVGFEImageElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
virtual ~nsSVGFEImageElement();
|
||||
|
||||
public:
|
||||
virtual bool SubregionIsUnionOfRegions() { return false; }
|
||||
|
||||
// interfaces:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// FE Base
|
||||
NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEImageElementBase::)
|
||||
|
||||
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
|
||||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance);
|
||||
|
||||
NS_DECL_NSIDOMSVGFEIMAGEELEMENT
|
||||
NS_DECL_NSIDOMSVGURIREFERENCE
|
||||
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEImageElementBase::)
|
||||
|
||||
NS_FORWARD_NSIDOMNODE(nsSVGFEImageElementBase::)
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGFEImageElementBase::)
|
||||
|
||||
// nsIContent
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsresult AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
const nsAString* aValue, bool aNotify);
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers);
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
// imgIDecoderObserver
|
||||
NS_IMETHOD OnStopDecode(imgIRequest *aRequest, nsresult status,
|
||||
const PRUnichar *statusArg);
|
||||
// imgIContainerObserver
|
||||
NS_IMETHOD FrameChanged(imgIContainer *aContainer,
|
||||
const nsIntRect *aDirtyRect);
|
||||
// imgIContainerObserver
|
||||
NS_IMETHOD OnStartContainer(imgIRequest *aRequest,
|
||||
imgIContainer *aContainer);
|
||||
|
||||
void MaybeLoadSVGImage();
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
private:
|
||||
// Invalidate users of the filter containing this element.
|
||||
void Invalidate();
|
||||
|
||||
nsresult LoadSVGImage(bool aForce, bool aNotify);
|
||||
|
||||
protected:
|
||||
virtual bool OperatesOnSRGB(nsSVGFilterInstance*,
|
||||
PRInt32, Image*) { return true; }
|
||||
|
||||
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
|
||||
enum { RESULT, HREF };
|
||||
nsSVGString mStringAttributes[2];
|
||||
static StringInfo sStringInfo[2];
|
||||
|
||||
SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
|
||||
};
|
||||
|
||||
typedef nsSVGElement SVGFEUnstyledElementBase;
|
||||
|
||||
class SVGFEUnstyledElement : public SVGFEUnstyledElementBase
|
||||
{
|
||||
protected:
|
||||
SVGFEUnstyledElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGFEUnstyledElementBase(aNodeInfo) {}
|
||||
|
||||
public:
|
||||
// returns true if changes to the attribute should cause us to
|
||||
// repaint the filter
|
||||
virtual bool AttributeAffectsRendering(
|
||||
PRInt32 aNameSpaceID, nsIAtom* aAttribute) const = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -173,7 +173,10 @@ nsSVGImageElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
|||
{
|
||||
if (aNamespaceID == kNameSpaceID_XLink && aName == nsGkAtoms::href) {
|
||||
|
||||
// If there's a frame it will deal
|
||||
// If there isn't a frame we still need to load the image in case
|
||||
// the frame is created later e.g. by attaching to a document.
|
||||
// If there is a frame then it should deal with loading as the image
|
||||
// url may be animated
|
||||
if (!GetPrimaryFrame()) {
|
||||
|
||||
// Prevent setting image.src by exiting early
|
||||
|
|
|
@ -142,6 +142,7 @@
|
|||
#undef NOISY_FIRST_LETTER
|
||||
|
||||
#include "nsMathMLParts.h"
|
||||
#include "nsIDOMSVGFilters.h"
|
||||
#include "nsSVGFeatures.h"
|
||||
#include "nsSVGEffects.h"
|
||||
#include "nsSVGUtils.h"
|
||||
|
@ -213,7 +214,13 @@ NS_NewSVGPatternFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
|||
nsIFrame*
|
||||
NS_NewSVGMaskFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSVGLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSVGFEImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
nsIFrame*
|
||||
NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIScrollable.h"
|
||||
|
@ -4717,7 +4724,7 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
|
|||
PRInt32 parentNSID;
|
||||
nsIAtom* parentTag =
|
||||
parentContent->OwnerDoc()->BindingManager()->
|
||||
ResolveTag(aParentFrame->GetContent(), &parentNSID);
|
||||
ResolveTag(parentContent, &parentNSID);
|
||||
|
||||
// It's not clear whether the SVG spec intends to allow any SVG
|
||||
// content within svg:foreignObject at all (SVG 1.1, section
|
||||
|
@ -4728,11 +4735,7 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
|
|||
}
|
||||
|
||||
if ((aTag != nsGkAtoms::svg && !parentIsSVG) ||
|
||||
(aTag == nsGkAtoms::desc || aTag == nsGkAtoms::title ||
|
||||
aTag == nsGkAtoms::feFuncR || aTag == nsGkAtoms::feFuncG ||
|
||||
aTag == nsGkAtoms::feFuncB || aTag == nsGkAtoms::feFuncA ||
|
||||
aTag == nsGkAtoms::feDistantLight || aTag == nsGkAtoms::fePointLight ||
|
||||
aTag == nsGkAtoms::feSpotLight)) {
|
||||
(aTag == nsGkAtoms::desc || aTag == nsGkAtoms::title)) {
|
||||
// Sections 5.1 and G.4 of SVG 1.1 say that SVG elements other than
|
||||
// svg:svg not contained within svg:svg are incorrect, although they
|
||||
// don't seem to specify error handling. Ignore them, since many of
|
||||
|
@ -4744,9 +4747,6 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
|
|||
// adding to the undisplayed content map.
|
||||
//
|
||||
// We don't currently handle any UI for desc/title
|
||||
//
|
||||
// The filter types are children of filter elements that use their
|
||||
// parent frames when necessary
|
||||
return &sSuppressData;
|
||||
}
|
||||
|
||||
|
@ -4775,6 +4775,24 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
|
|||
return &sContainerData;
|
||||
}
|
||||
|
||||
// Special case for filter primitive elements.
|
||||
// These elements must have a filter element as a parent
|
||||
nsCOMPtr<nsIDOMSVGFilterPrimitiveStandardAttributes> filterPrimitive =
|
||||
do_QueryInterface(aElement);
|
||||
if (filterPrimitive && aParentFrame->GetType() != nsGkAtoms::svgFilterFrame) {
|
||||
return &sSuppressData;
|
||||
}
|
||||
|
||||
// Some elements must be children of filter primitive elements.
|
||||
if ((aTag == nsGkAtoms::feDistantLight || aTag == nsGkAtoms::fePointLight ||
|
||||
aTag == nsGkAtoms::feSpotLight ||
|
||||
aTag == nsGkAtoms::feFuncR || aTag == nsGkAtoms::feFuncG ||
|
||||
aTag == nsGkAtoms::feFuncB || aTag == nsGkAtoms::feFuncA ||
|
||||
aTag == nsGkAtoms::feMergeNode) &&
|
||||
aParentFrame->GetType() != nsGkAtoms::svgFEContainerFrame) {
|
||||
return &sSuppressData;
|
||||
}
|
||||
|
||||
// Special cases for text/tspan/textPath, because the kind of frame
|
||||
// they get depends on the parent frame. We ignore 'a' elements when
|
||||
// determining the parent, however.
|
||||
|
@ -4834,22 +4852,30 @@ nsCSSFrameConstructor::FindSVGData(Element* aElement,
|
|||
SIMPLE_SVG_CREATE(filter, NS_NewSVGFilterFrame),
|
||||
SIMPLE_SVG_CREATE(pattern, NS_NewSVGPatternFrame),
|
||||
SIMPLE_SVG_CREATE(mask, NS_NewSVGMaskFrame),
|
||||
SIMPLE_SVG_CREATE(feBlend, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feColorMatrix, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feComposite, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feComponentTransfer, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feConvolveMatrix, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feDiffuseLighting, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feDisplacementMap, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feFlood, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feGaussianBlur, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feImage, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feMergeNode, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feMorphology, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feOffset, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feSpecularLighting, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feTile, NS_NewSVGLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feTurbulence, NS_NewSVGLeafFrame)
|
||||
SIMPLE_SVG_CREATE(feDistantLight, NS_NewSVGFEUnstyledLeafFrame),
|
||||
SIMPLE_SVG_CREATE(fePointLight, NS_NewSVGFEUnstyledLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feSpotLight, NS_NewSVGFEUnstyledLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feBlend, NS_NewSVGFELeafFrame),
|
||||
SIMPLE_SVG_CREATE(feColorMatrix, NS_NewSVGFELeafFrame),
|
||||
SIMPLE_SVG_CREATE(feFuncR, NS_NewSVGFEUnstyledLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feFuncG, NS_NewSVGFEUnstyledLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feFuncB, NS_NewSVGFEUnstyledLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feFuncA, NS_NewSVGFEUnstyledLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feComposite, NS_NewSVGFELeafFrame),
|
||||
SIMPLE_SVG_CREATE(feComponentTransfer, NS_NewSVGFEContainerFrame),
|
||||
SIMPLE_SVG_CREATE(feConvolveMatrix, NS_NewSVGFELeafFrame),
|
||||
SIMPLE_SVG_CREATE(feDiffuseLighting, NS_NewSVGFEContainerFrame),
|
||||
SIMPLE_SVG_CREATE(feDisplacementMap, NS_NewSVGFELeafFrame),
|
||||
SIMPLE_SVG_CREATE(feFlood, NS_NewSVGFELeafFrame),
|
||||
SIMPLE_SVG_CREATE(feGaussianBlur, NS_NewSVGFELeafFrame),
|
||||
SIMPLE_SVG_CREATE(feImage, NS_NewSVGFEImageFrame),
|
||||
SIMPLE_SVG_CREATE(feMerge, NS_NewSVGFEContainerFrame),
|
||||
SIMPLE_SVG_CREATE(feMergeNode, NS_NewSVGFEUnstyledLeafFrame),
|
||||
SIMPLE_SVG_CREATE(feMorphology, NS_NewSVGFELeafFrame),
|
||||
SIMPLE_SVG_CREATE(feOffset, NS_NewSVGFELeafFrame),
|
||||
SIMPLE_SVG_CREATE(feSpecularLighting, NS_NewSVGFEContainerFrame),
|
||||
SIMPLE_SVG_CREATE(feTile, NS_NewSVGFELeafFrame),
|
||||
SIMPLE_SVG_CREATE(feTurbulence, NS_NewSVGFELeafFrame)
|
||||
};
|
||||
|
||||
const FrameConstructionData* data =
|
||||
|
|
|
@ -199,6 +199,10 @@ public:
|
|||
nsSVGClipPathFrame_id,
|
||||
nsSVGContainerFrame_id,
|
||||
nsSVGDisplayContainerFrame_id,
|
||||
SVGFEContainerFrame_id,
|
||||
SVGFEImageFrame_id,
|
||||
SVGFELeafFrame_id,
|
||||
SVGFEUnstyledLeafFrame_id,
|
||||
nsSVGFilterFrame_id,
|
||||
nsSVGForeignObjectFrame_id,
|
||||
nsSVGGenericContainerFrame_id,
|
||||
|
@ -208,7 +212,6 @@ public:
|
|||
nsSVGGradientFrame_id,
|
||||
nsSVGImageFrame_id,
|
||||
nsSVGInnerSVGFrame_id,
|
||||
nsSVGLeafFrame_id,
|
||||
nsSVGLinearGradientFrame_id,
|
||||
nsSVGMarkerFrame_id,
|
||||
nsSVGMaskFrame_id,
|
||||
|
|
|
@ -63,7 +63,10 @@ CPPSRCS = \
|
|||
nsSVGImageFrame.cpp \
|
||||
nsSVGInnerSVGFrame.cpp \
|
||||
nsSVGIntegrationUtils.cpp \
|
||||
nsSVGLeafFrame.cpp \
|
||||
SVGFEContainerFrame.cpp \
|
||||
SVGFEImageFrame.cpp \
|
||||
SVGFELeafFrame.cpp \
|
||||
SVGFEUnstyledLeafFrame.cpp \
|
||||
nsSVGMarkerFrame.cpp \
|
||||
nsSVGMaskFrame.cpp \
|
||||
nsSVGOuterSVGFrame.cpp \
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Robert Longson.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsSVGEffects.h"
|
||||
#include "nsSVGFilters.h"
|
||||
|
||||
typedef nsContainerFrame SVGFEContainerFrameBase;
|
||||
|
||||
/*
|
||||
* This frame is used by filter primitive elements that
|
||||
* have special child elements that provide parameters.
|
||||
*/
|
||||
class SVGFEContainerFrame : public SVGFEContainerFrameBase
|
||||
{
|
||||
friend nsIFrame*
|
||||
NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
protected:
|
||||
SVGFEContainerFrame(nsStyleContext* aContext) : SVGFEContainerFrameBase(aContext) {}
|
||||
|
||||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
virtual bool IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return SVGFEContainerFrameBase::IsFrameOfType(
|
||||
aFlags & ~(nsIFrame::eSVG | nsIFrame::eSVGContainer));
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
{
|
||||
return MakeFrameName(NS_LITERAL_STRING("SVGFEContainer"), aResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow);
|
||||
#endif
|
||||
/**
|
||||
* Get the "type" of the frame
|
||||
*
|
||||
* @see nsGkAtoms::svgFEContainerFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
|
||||
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType);
|
||||
};
|
||||
|
||||
nsIFrame*
|
||||
NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
{
|
||||
return new (aPresShell) SVGFEContainerFrame(aContext);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(SVGFEContainerFrame)
|
||||
|
||||
/* virtual */ void
|
||||
SVGFEContainerFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||
{
|
||||
SVGFEContainerFrameBase::DidSetStyleContext(aOldStyleContext);
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHODIMP
|
||||
SVGFEContainerFrame::Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGFilterPrimitiveStandardAttributes> elem = do_QueryInterface(aContent);
|
||||
NS_ASSERTION(elem,
|
||||
"Trying to construct an SVGFEContainerFrame for a "
|
||||
"content element that doesn't support the right interfaces");
|
||||
|
||||
return SVGFEContainerFrameBase::Init(aContent, aParent, aPrevInFlow);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
nsIAtom *
|
||||
SVGFEContainerFrame::GetType() const
|
||||
{
|
||||
return nsGkAtoms::svgFEContainerFrame;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SVGFEContainerFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
nsSVGFE *element = static_cast<nsSVGFE*>(mContent);
|
||||
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
}
|
||||
|
||||
return SVGFEContainerFrameBase::AttributeChanged(aNameSpaceID,
|
||||
aAttribute, aModType);
|
||||
}
|
|
@ -0,0 +1,171 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Robert Longson.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsFrame.h"
|
||||
#include "nsSVGEffects.h"
|
||||
#include "nsSVGFilters.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsImageLoadingContent.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
typedef nsFrame SVGFEImageFrameBase;
|
||||
|
||||
class SVGFEImageFrame : public SVGFEImageFrameBase
|
||||
{
|
||||
friend nsIFrame*
|
||||
NS_NewSVGFEImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
protected:
|
||||
SVGFEImageFrame(nsStyleContext* aContext) : SVGFEImageFrameBase(aContext) {}
|
||||
|
||||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
NS_IMETHOD Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow);
|
||||
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
||||
|
||||
virtual bool IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return SVGFEImageFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
{
|
||||
return MakeFrameName(NS_LITERAL_STRING("SVGFEImage"), aResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
|
||||
|
||||
/**
|
||||
* Get the "type" of the frame
|
||||
*
|
||||
* @see nsGkAtoms::svgFEImageFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
|
||||
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType);
|
||||
};
|
||||
|
||||
nsIFrame*
|
||||
NS_NewSVGFEImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
{
|
||||
return new (aPresShell) SVGFEImageFrame(aContext);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(SVGFEImageFrame)
|
||||
|
||||
/* virtual */ void
|
||||
SVGFEImageFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||
{
|
||||
SVGFEImageFrameBase::DidSetStyleContext(aOldStyleContext);
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
SVGFEImageFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||
{
|
||||
nsCOMPtr<nsIImageLoadingContent> imageLoader =
|
||||
do_QueryInterface(SVGFEImageFrameBase::mContent);
|
||||
|
||||
if (imageLoader) {
|
||||
imageLoader->FrameDestroyed(this);
|
||||
}
|
||||
|
||||
SVGFEImageFrameBase::DestroyFrom(aDestructRoot);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SVGFEImageFrame::Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIDOMSVGFEImageElement> elem = do_QueryInterface(aContent);
|
||||
NS_ASSERTION(elem,
|
||||
"Trying to construct an SVGFEImageFrame for a "
|
||||
"content element that doesn't support the right interfaces");
|
||||
#endif /* DEBUG */
|
||||
|
||||
SVGFEImageFrameBase::Init(aContent, aParent, aPrevInFlow);
|
||||
nsCOMPtr<nsIImageLoadingContent> imageLoader =
|
||||
do_QueryInterface(SVGFEImageFrameBase::mContent);
|
||||
|
||||
if (imageLoader) {
|
||||
imageLoader->FrameCreated(this);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIAtom *
|
||||
SVGFEImageFrame::GetType() const
|
||||
{
|
||||
return nsGkAtoms::svgFEImageFrame;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SVGFEImageFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
nsSVGFEImageElement *element = static_cast<nsSVGFEImageElement*>(mContent);
|
||||
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
}
|
||||
if (aNameSpaceID == kNameSpaceID_XLink &&
|
||||
aAttribute == nsGkAtoms::href) {
|
||||
|
||||
// Prevent setting image.src by exiting early
|
||||
if (nsContentUtils::IsImageSrcSetDisabled()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (element->mStringAttributes[nsSVGFEImageElement::HREF].IsExplicitlySet()) {
|
||||
element->LoadSVGImage(true, true);
|
||||
} else {
|
||||
element->CancelImageRequests(true);
|
||||
}
|
||||
}
|
||||
|
||||
return SVGFEImageFrameBase::AttributeChanged(aNameSpaceID,
|
||||
aAttribute, aModType);
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is IBM Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsFrame.h"
|
||||
#include "nsSVGFilters.h"
|
||||
#include "nsSVGEffects.h"
|
||||
|
||||
typedef nsFrame SVGFELeafFrameBase;
|
||||
|
||||
/*
|
||||
* This frame is used by filter primitive elements that don't
|
||||
* have special child elements that provide parameters.
|
||||
*/
|
||||
class SVGFELeafFrame : public SVGFELeafFrameBase
|
||||
{
|
||||
friend nsIFrame*
|
||||
NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
protected:
|
||||
SVGFELeafFrame(nsStyleContext* aContext) : SVGFELeafFrameBase(aContext) {}
|
||||
|
||||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow);
|
||||
#endif
|
||||
|
||||
virtual bool IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return SVGFELeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
{
|
||||
return MakeFrameName(NS_LITERAL_STRING("SVGFELeaf"), aResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext);
|
||||
|
||||
/**
|
||||
* Get the "type" of the frame
|
||||
*
|
||||
* @see nsGkAtoms::svgFELeafFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
|
||||
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType);
|
||||
};
|
||||
|
||||
nsIFrame*
|
||||
NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
{
|
||||
return new (aPresShell) SVGFELeafFrame(aContext);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(SVGFELeafFrame)
|
||||
|
||||
/* virtual */ void
|
||||
SVGFELeafFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
|
||||
{
|
||||
SVGFELeafFrameBase::DidSetStyleContext(aOldStyleContext);
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHODIMP
|
||||
SVGFELeafFrame::Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGFilterPrimitiveStandardAttributes> elem = do_QueryInterface(aContent);
|
||||
NS_ASSERTION(elem,
|
||||
"Trying to construct an SVGFELeafFrame for a "
|
||||
"content element that doesn't support the right interfaces");
|
||||
|
||||
return SVGFELeafFrameBase::Init(aContent, aParent, aPrevInFlow);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
nsIAtom *
|
||||
SVGFELeafFrame::GetType() const
|
||||
{
|
||||
return nsGkAtoms::svgFELeafFrame;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SVGFELeafFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
nsSVGFE *element = static_cast<nsSVGFE*>(mContent);
|
||||
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
}
|
||||
|
||||
return SVGFELeafFrameBase::AttributeChanged(aNameSpaceID,
|
||||
aAttribute, aModType);
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla SVG project.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Robert Longson.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsFrame.h"
|
||||
#include "nsSVGFilters.h"
|
||||
#include "nsSVGEffects.h"
|
||||
|
||||
typedef nsFrame SVGFEUnstyledLeafFrameBase;
|
||||
|
||||
class SVGFEUnstyledLeafFrame : public SVGFEUnstyledLeafFrameBase
|
||||
{
|
||||
friend nsIFrame*
|
||||
NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
||||
protected:
|
||||
SVGFEUnstyledLeafFrame(nsStyleContext* aContext) : SVGFEUnstyledLeafFrameBase(aContext) {}
|
||||
|
||||
public:
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
virtual bool IsFrameOfType(PRUint32 aFlags) const
|
||||
{
|
||||
return SVGFEUnstyledLeafFrameBase::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
||||
{
|
||||
return MakeFrameName(NS_LITERAL_STRING("SVGFEUnstyledLeaf"), aResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the "type" of the frame
|
||||
*
|
||||
* @see nsGkAtoms::svgFEUnstyledLeafFrame
|
||||
*/
|
||||
virtual nsIAtom* GetType() const;
|
||||
|
||||
NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType);
|
||||
};
|
||||
|
||||
nsIFrame*
|
||||
NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
{
|
||||
return new (aPresShell) SVGFEUnstyledLeafFrame(aContext);
|
||||
}
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(SVGFEUnstyledLeafFrame)
|
||||
|
||||
nsIAtom *
|
||||
SVGFEUnstyledLeafFrame::GetType() const
|
||||
{
|
||||
return nsGkAtoms::svgFEUnstyledLeafFrame;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SVGFEUnstyledLeafFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
SVGFEUnstyledElement *element = static_cast<SVGFEUnstyledElement*>(mContent);
|
||||
if (element->AttributeAffectsRendering(aNameSpaceID, aAttribute)) {
|
||||
nsSVGEffects::InvalidateRenderingObservers(this);
|
||||
}
|
||||
|
||||
return SVGFEUnstyledLeafFrameBase::AttributeChanged(aNameSpaceID,
|
||||
aAttribute, aModType);
|
||||
}
|
Загрузка…
Ссылка в новой задаче