Bug 540478, part 1 of 2. Make nsSVGEnum::GetAnimVal take its element as an argument in preparation for it needing to call FlushAnimations() on it. r=dholbert

This commit is contained in:
Jonathan Watt 2010-01-23 18:58:47 +00:00
Родитель 937cd0e611
Коммит 2a6a1c2514
9 изменённых файлов: 24 добавлений и 23 удалений

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

@ -68,7 +68,7 @@ public:
PRUint16 GetBaseValue() const
{ return mBaseVal; }
PRUint16 GetAnimValue() const
PRUint16 GetAnimValue(nsSVGElement *aSVGElement) const
{ return mAnimVal; }
nsresult ToDOMAnimatedEnum(nsIDOMSVGAnimatedEnumeration **aResult,
@ -97,7 +97,7 @@ private:
NS_IMETHOD SetBaseVal(PRUint16 aValue)
{ return mVal->SetBaseValue(aValue, mSVGElement, PR_TRUE); }
NS_IMETHOD GetAnimVal(PRUint16* aResult)
{ *aResult = mVal->GetAnimValue(); return NS_OK; }
{ *aResult = mVal->GetAnimValue(mSVGElement); return NS_OK; }
};
};

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

@ -927,7 +927,7 @@ nsSVGFEBlendElement::Filter(nsSVGFilterInstance* aInstance,
PRUint8* targetData = aTarget->mImage->Data();
PRUint32 stride = aTarget->mImage->Stride();
PRUint16 mode = mEnumAttributes[MODE].GetAnimValue();
PRUint16 mode = mEnumAttributes[MODE].GetAnimValue(this);
for (PRInt32 x = rect.x; x < rect.XMost(); x++) {
for (PRInt32 y = rect.y; y < rect.YMost(); y++) {
@ -1160,7 +1160,7 @@ nsSVGFEColorMatrixElement::Filter(nsSVGFilterInstance *instance,
PRUint8* targetData = aTarget->mImage->Data();
PRUint32 stride = aTarget->mImage->Stride();
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue();
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue(this);
nsCOMPtr<nsIDOMSVGNumberList> list;
mValues->GetAnimVal(getter_AddRefs(list));
@ -1495,7 +1495,7 @@ nsSVGFECompositeElement::Filter(nsSVGFilterInstance *instance,
const Image* aTarget,
const nsIntRect& rect)
{
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue();
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue(this);
// Cairo does not support arithmetic operator
if (op == nsSVGFECompositeElement::SVG_OPERATOR_ARITHMETIC) {
@ -1568,7 +1568,7 @@ nsIntRect
nsSVGFECompositeElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
const nsSVGFilterInstance& aInstance)
{
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue();
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue(this);
if (op == nsSVGFECompositeElement::SVG_OPERATOR_ARITHMETIC) {
// "arithmetic" operator can produce non-zero alpha values even where
@ -1928,7 +1928,7 @@ NS_IMETHODIMP nsSVGComponentTransferFunctionElement::GetOffset(nsIDOMSVGAnimated
void
nsSVGComponentTransferFunctionElement::GenerateLookupTable(PRUint8 *aTable)
{
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue();
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue(this);
float slope, intercept, amplitude, exponent, offset;
GetAnimatedNumberValues(&slope, &intercept, &amplitude,
@ -3185,8 +3185,8 @@ nsSVGFETurbulenceElement::Filter(nsSVGFilterInstance *instance,
float fX, fY, seed;
PRInt32 octaves = mIntegerAttributes[OCTAVES].GetAnimValue();
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue();
PRUint16 stitch = mEnumAttributes[STITCHTILES].GetAnimValue();
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue(this);
PRUint16 stitch = mEnumAttributes[STITCHTILES].GetAnimValue(this);
GetAnimatedNumberValues(&fX, &fY, &seed, nsnull);
@ -3683,7 +3683,7 @@ nsSVGFEMorphologyElement::Filter(nsSVGFilterInstance *instance,
PRUint32 stride = aTarget->mImage->Stride();
PRUint32 xExt[4], yExt[4]; // X, Y indices of RGBA extrema
PRUint8 extrema[4]; // RGBA magnitude of extrema
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue();
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue(this);
/* Scan the kernel for each pixel to determine max/min RGBA values. Note that
* as we advance in the x direction, each kernel overlaps the previous kernel.
@ -4182,7 +4182,7 @@ nsSVGFEConvolveMatrixElement::Filter(nsSVGFilterInstance *instance,
if (!info.mTarget)
return NS_ERROR_FAILURE;
PRUint16 edgeMode = mEnumAttributes[EDGEMODE].GetAnimValue();
PRUint16 edgeMode = mEnumAttributes[EDGEMODE].GetAnimValue(this);
PRBool preserveAlpha = mBooleanAttributes[PRESERVEALPHA].GetAnimValue();
float bias = 0;
@ -5731,8 +5731,8 @@ nsSVGFEDisplacementMapElement::Filter(nsSVGFilterInstance *instance,
GFX_ARGB32_OFFSET_G,
GFX_ARGB32_OFFSET_B,
GFX_ARGB32_OFFSET_A };
PRUint16 xChannel = channelMap[mEnumAttributes[CHANNEL_X].GetAnimValue()];
PRUint16 yChannel = channelMap[mEnumAttributes[CHANNEL_Y].GetAnimValue()];
PRUint16 xChannel = channelMap[mEnumAttributes[CHANNEL_X].GetAnimValue(this)];
PRUint16 yChannel = channelMap[mEnumAttributes[CHANNEL_Y].GetAnimValue(this)];
double scaleOver255 = scale / 255.0;
double scaleAdjustment = 0.5 - 0.5 * scale;

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

@ -382,7 +382,7 @@ nsSVGMarkerElement::GetMarkerTransform(float aStrokeWidth,
float aX, float aY, float aAngle)
{
float scale = 1.0;
if (mEnumAttributes[MARKERUNITS].GetAnimValue() ==
if (mEnumAttributes[MARKERUNITS].GetAnimValue(this) ==
SVG_MARKERUNITS_STROKEWIDTH)
scale = aStrokeWidth;

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

@ -819,7 +819,7 @@ nsSVGSVGElement::GetTransformToElement(nsIDOMSVGElement *element,
NS_IMETHODIMP
nsSVGSVGElement::GetZoomAndPan(PRUint16 *aZoomAndPan)
{
*aZoomAndPan = mEnumAttributes[ZOOMANDPAN].GetAnimValue();
*aZoomAndPan = mEnumAttributes[ZOOMANDPAN].GetAnimValue(this);
return NS_OK;
}

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

@ -108,9 +108,9 @@ nsAutoFilterInstance::nsAutoFilterInstance(nsIFrame *aTarget,
static_cast<nsSVGFilterElement*>(aFilterFrame->GetContent());
PRUint16 filterUnits =
filter->mEnumAttributes[nsSVGFilterElement::FILTERUNITS].GetAnimValue();
filter->mEnumAttributes[nsSVGFilterElement::FILTERUNITS].GetAnimValue(filter);
PRUint16 primitiveUnits =
filter->mEnumAttributes[nsSVGFilterElement::PRIMITIVEUNITS].GetAnimValue();
filter->mEnumAttributes[nsSVGFilterElement::PRIMITIVEUNITS].GetAnimValue(filter);
gfxRect bbox;
if (aOverrideSourceBBox) {

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

@ -193,7 +193,7 @@ nsSVGGradientFrame::GetSpreadMethod()
nsSVGGradientElement *element =
GetGradientWithAttr(nsGkAtoms::spreadMethod, mContent);
return element->mEnumAttributes[nsSVGGradientElement::SPREADMETHOD].GetAnimValue();
return element->mEnumAttributes[nsSVGGradientElement::SPREADMETHOD].GetAnimValue(element);
}
//----------------------------------------------------------------------
@ -402,7 +402,7 @@ nsSVGGradientFrame::GetGradientUnits()
nsSVGGradientElement *element =
GetGradientWithAttr(nsGkAtoms::gradientUnits, mContent);
return element->mEnumAttributes[nsSVGGradientElement::GRADIENTUNITS].GetAnimValue();
return element->mEnumAttributes[nsSVGGradientElement::GRADIENTUNITS].GetAnimValue(element);
}
// -------------------------------------------------------------------------

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

@ -77,7 +77,7 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRenderState *aContext,
nsSVGMaskElement *mask = static_cast<nsSVGMaskElement*>(mContent);
PRUint16 units =
mask->mEnumAttributes[nsSVGMaskElement::MASKUNITS].GetAnimValue();
mask->mEnumAttributes[nsSVGMaskElement::MASKUNITS].GetAnimValue(mask);
gfxRect bbox;
if (units == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
bbox = nsSVGUtils::GetBBox(aParent);

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

@ -340,7 +340,7 @@ nsSVGPatternFrame::GetPatternUnits()
// See if we need to get the value from another pattern
nsSVGPatternElement *patternElement =
GetPatternWithAttr(nsGkAtoms::patternUnits, mContent);
return patternElement->mEnumAttributes[nsSVGPatternElement::PATTERNUNITS].GetAnimValue();
return patternElement->mEnumAttributes[nsSVGPatternElement::PATTERNUNITS].GetAnimValue(patternElement);
}
PRUint16
@ -348,7 +348,7 @@ nsSVGPatternFrame::GetPatternContentUnits()
{
nsSVGPatternElement *patternElement =
GetPatternWithAttr(nsGkAtoms::patternContentUnits, mContent);
return patternElement->mEnumAttributes[nsSVGPatternElement::PATTERNCONTENTUNITS].GetAnimValue();
return patternElement->mEnumAttributes[nsSVGPatternElement::PATTERNCONTENTUNITS].GetAnimValue(patternElement);
}
gfxMatrix

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

@ -1436,7 +1436,8 @@ nsSVGUtils::AdjustMatrixForUnits(const gfxMatrix &aMatrix,
nsIFrame *aFrame)
{
if (aFrame &&
aUnits->GetAnimValue() == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
aUnits->GetAnimValue(static_cast<nsSVGElement*>(aFrame->GetContent())) ==
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
gfxRect bbox = GetBBox(aFrame);
return gfxMatrix().Scale(bbox.Width(), bbox.Height()) *
gfxMatrix().Translate(gfxPoint(bbox.X(), bbox.Y())) *