mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 547333: Call FlushAnimations() in SVG DOM getters for animated values, and not in internal getters. r=jwatt
This commit is contained in:
parent
00ed82e5e1
commit
71488977d3
@ -61,13 +61,8 @@ public:
|
||||
{ return mBaseVal; }
|
||||
|
||||
void SetAnimValue(PRBool aValue, nsSVGElement *aSVGElement);
|
||||
PRBool GetAnimValue(nsSVGElement *aSVGElement) const
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
aSVGElement->FlushAnimations();
|
||||
#endif
|
||||
return mAnimVal;
|
||||
}
|
||||
PRBool GetAnimValue() const
|
||||
{ return mAnimVal; }
|
||||
|
||||
nsresult ToDOMAnimatedBoolean(nsIDOMSVGAnimatedBoolean **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
@ -98,9 +93,17 @@ private:
|
||||
{ *aResult = mVal->GetBaseValue(); return NS_OK; }
|
||||
NS_IMETHOD SetBaseVal(PRBool aValue)
|
||||
{ mVal->SetBaseValue(aValue, mSVGElement); return NS_OK; }
|
||||
NS_IMETHOD GetAnimVal(PRBool* aResult)
|
||||
{ *aResult = mVal->GetAnimValue(mSVGElement); return NS_OK; }
|
||||
|
||||
// Script may have modified animation parameters or timeline -- DOM getters
|
||||
// need to flush any resample requests to reflect these modifications.
|
||||
NS_IMETHOD GetAnimVal(PRBool* aResult)
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
mSVGElement->FlushAnimations();
|
||||
#endif
|
||||
*aResult = mVal->GetAnimValue();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_SMIL
|
||||
|
@ -1330,7 +1330,7 @@ nsSVGElement::GetAnimatedNumberValues(float *aFirst, ...)
|
||||
va_start(args, aFirst);
|
||||
|
||||
while (f && i < info.mNumberCount) {
|
||||
*f = info.mNumbers[i++].GetAnimValue(this);
|
||||
*f = info.mNumbers[i++].GetAnimValue();
|
||||
f = va_arg(args, float*);
|
||||
}
|
||||
va_end(args);
|
||||
@ -1396,7 +1396,7 @@ nsSVGElement::GetAnimatedIntegerValues(PRInt32 *aFirst, ...)
|
||||
va_start(args, aFirst);
|
||||
|
||||
while (n && i < info.mIntegerCount) {
|
||||
*n = info.mIntegers[i++].GetAnimValue(this);
|
||||
*n = info.mIntegers[i++].GetAnimValue();
|
||||
n = va_arg(args, PRInt32*);
|
||||
}
|
||||
va_end(args);
|
||||
|
@ -70,13 +70,8 @@ public:
|
||||
{ return mBaseVal; }
|
||||
|
||||
void SetAnimValue(PRUint16 aValue, nsSVGElement *aSVGElement);
|
||||
PRUint16 GetAnimValue(nsSVGElement *aSVGElement) const
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
aSVGElement->FlushAnimations();
|
||||
#endif
|
||||
return mAnimVal;
|
||||
}
|
||||
PRUint16 GetAnimValue() const
|
||||
{ return mAnimVal; }
|
||||
|
||||
nsresult ToDOMAnimatedEnum(nsIDOMSVGAnimatedEnumeration **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
@ -108,8 +103,17 @@ private:
|
||||
{ *aResult = mVal->GetBaseValue(); return NS_OK; }
|
||||
NS_IMETHOD SetBaseVal(PRUint16 aValue)
|
||||
{ return mVal->SetBaseValue(aValue, mSVGElement, PR_TRUE); }
|
||||
|
||||
// Script may have modified animation parameters or timeline -- DOM getters
|
||||
// need to flush any resample requests to reflect these modifications.
|
||||
NS_IMETHOD GetAnimVal(PRUint16* aResult)
|
||||
{ *aResult = mVal->GetAnimValue(mSVGElement); return NS_OK; }
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
mSVGElement->FlushAnimations();
|
||||
#endif
|
||||
*aResult = mVal->GetAnimValue();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_SMIL
|
||||
|
@ -132,8 +132,7 @@ nsSVGFE::ScaleInfo
|
||||
nsSVGFE::SetupScalingFilter(nsSVGFilterInstance *aInstance,
|
||||
const Image *aSource, const Image *aTarget,
|
||||
const nsIntRect& aDataRect,
|
||||
nsSVGNumber2 *aUnitX, nsSVGNumber2 *aUnitY,
|
||||
nsSVGElement *aElement)
|
||||
nsSVGNumber2 *aUnitX, nsSVGNumber2 *aUnitY)
|
||||
{
|
||||
ScaleInfo result;
|
||||
result.mRescaling = HasAttr(kNameSpaceID_None, nsGkAtoms::kernelUnitLength);
|
||||
@ -147,11 +146,11 @@ nsSVGFE::SetupScalingFilter(nsSVGFilterInstance *aInstance,
|
||||
float kernelX, kernelY;
|
||||
nsSVGLength2 val;
|
||||
val.Init(nsSVGUtils::X, 0xff,
|
||||
aUnitX->GetAnimValue(aElement),
|
||||
aUnitX->GetAnimValue(),
|
||||
nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
|
||||
kernelX = aInstance->GetPrimitiveLength(&val);
|
||||
val.Init(nsSVGUtils::Y, 0xff,
|
||||
aUnitY->GetAnimValue(aElement),
|
||||
aUnitY->GetAnimValue(),
|
||||
nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
|
||||
kernelY = aInstance->GetPrimitiveLength(&val);
|
||||
#ifdef DEBUG_tor
|
||||
@ -952,7 +951,7 @@ nsSVGFEBlendElement::Filter(nsSVGFilterInstance* aInstance,
|
||||
PRUint8* targetData = aTarget->mImage->Data();
|
||||
PRUint32 stride = aTarget->mImage->Stride();
|
||||
|
||||
PRUint16 mode = mEnumAttributes[MODE].GetAnimValue(this);
|
||||
PRUint16 mode = mEnumAttributes[MODE].GetAnimValue();
|
||||
|
||||
for (PRInt32 x = rect.x; x < rect.XMost(); x++) {
|
||||
for (PRInt32 y = rect.y; y < rect.YMost(); y++) {
|
||||
@ -1185,7 +1184,7 @@ nsSVGFEColorMatrixElement::Filter(nsSVGFilterInstance *instance,
|
||||
PRUint8* targetData = aTarget->mImage->Data();
|
||||
PRUint32 stride = aTarget->mImage->Stride();
|
||||
|
||||
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue(this);
|
||||
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue();
|
||||
|
||||
nsCOMPtr<nsIDOMSVGNumberList> list;
|
||||
mValues->GetAnimVal(getter_AddRefs(list));
|
||||
@ -1520,7 +1519,7 @@ nsSVGFECompositeElement::Filter(nsSVGFilterInstance *instance,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& rect)
|
||||
{
|
||||
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue(this);
|
||||
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue();
|
||||
|
||||
// Cairo does not support arithmetic operator
|
||||
if (op == nsSVGFECompositeElement::SVG_OPERATOR_ARITHMETIC) {
|
||||
@ -1593,7 +1592,7 @@ nsIntRect
|
||||
nsSVGFECompositeElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue(this);
|
||||
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue();
|
||||
|
||||
if (op == nsSVGFECompositeElement::SVG_OPERATOR_ARITHMETIC) {
|
||||
// "arithmetic" operator can produce non-zero alpha values even where
|
||||
@ -1953,7 +1952,7 @@ NS_IMETHODIMP nsSVGComponentTransferFunctionElement::GetOffset(nsIDOMSVGAnimated
|
||||
void
|
||||
nsSVGComponentTransferFunctionElement::GenerateLookupTable(PRUint8 *aTable)
|
||||
{
|
||||
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue(this);
|
||||
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue();
|
||||
|
||||
float slope, intercept, amplitude, exponent, offset;
|
||||
GetAnimatedNumberValues(&slope, &intercept, &litude,
|
||||
@ -3209,9 +3208,9 @@ nsSVGFETurbulenceElement::Filter(nsSVGFilterInstance *instance,
|
||||
#endif
|
||||
|
||||
float fX, fY, seed;
|
||||
PRInt32 octaves = mIntegerAttributes[OCTAVES].GetAnimValue(this);
|
||||
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue(this);
|
||||
PRUint16 stitch = mEnumAttributes[STITCHTILES].GetAnimValue(this);
|
||||
PRInt32 octaves = mIntegerAttributes[OCTAVES].GetAnimValue();
|
||||
PRUint16 type = mEnumAttributes[TYPE].GetAnimValue();
|
||||
PRUint16 stitch = mEnumAttributes[STITCHTILES].GetAnimValue();
|
||||
|
||||
GetAnimatedNumberValues(&fX, &fY, &seed, nsnull);
|
||||
|
||||
@ -3708,7 +3707,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(this);
|
||||
PRUint16 op = mEnumAttributes[OPERATOR].GetAnimValue();
|
||||
|
||||
/* 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.
|
||||
@ -3844,7 +3843,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual PRBool OperatesOnPremultipledAlpha() {
|
||||
return !mBooleanAttributes[PRESERVEALPHA].GetAnimValue(this);
|
||||
return !mBooleanAttributes[PRESERVEALPHA].GetAnimValue();
|
||||
}
|
||||
|
||||
virtual NumberAttributesInfo GetNumberInfo();
|
||||
@ -4189,7 +4188,7 @@ nsSVGFEConvolveMatrixElement::Filter(nsSVGFilterInstance *instance,
|
||||
|
||||
float divisor;
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::divisor)) {
|
||||
divisor = mNumberAttributes[DIVISOR].GetAnimValue(this);
|
||||
divisor = mNumberAttributes[DIVISOR].GetAnimValue();
|
||||
if (divisor == 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
} else {
|
||||
@ -4202,17 +4201,16 @@ nsSVGFEConvolveMatrixElement::Filter(nsSVGFilterInstance *instance,
|
||||
|
||||
ScaleInfo info = SetupScalingFilter(instance, aSources[0], aTarget, rect,
|
||||
&mNumberAttributes[KERNEL_UNIT_LENGTH_X],
|
||||
&mNumberAttributes[KERNEL_UNIT_LENGTH_Y],
|
||||
this);
|
||||
&mNumberAttributes[KERNEL_UNIT_LENGTH_Y]);
|
||||
if (!info.mTarget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint16 edgeMode = mEnumAttributes[EDGEMODE].GetAnimValue(this);
|
||||
PRBool preserveAlpha = mBooleanAttributes[PRESERVEALPHA].GetAnimValue(this);
|
||||
PRUint16 edgeMode = mEnumAttributes[EDGEMODE].GetAnimValue();
|
||||
PRBool preserveAlpha = mBooleanAttributes[PRESERVEALPHA].GetAnimValue();
|
||||
|
||||
float bias = 0;
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::bias)) {
|
||||
bias = mNumberAttributes[BIAS].GetAnimValue(this);
|
||||
bias = mNumberAttributes[BIAS].GetAnimValue();
|
||||
}
|
||||
|
||||
const nsIntRect& dataRect = info.mDataRect;
|
||||
@ -4788,8 +4786,7 @@ nsSVGFELightingElement::Filter(nsSVGFilterInstance *instance,
|
||||
{
|
||||
ScaleInfo info = SetupScalingFilter(instance, aSources[0], aTarget, rect,
|
||||
&mNumberAttributes[KERNEL_UNIT_LENGTH_X],
|
||||
&mNumberAttributes[KERNEL_UNIT_LENGTH_Y],
|
||||
this);
|
||||
&mNumberAttributes[KERNEL_UNIT_LENGTH_Y]);
|
||||
if (!info.mTarget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -4862,7 +4859,7 @@ nsSVGFELightingElement::Filter(nsSVGFilterInstance *instance,
|
||||
}
|
||||
}
|
||||
|
||||
float surfaceScale = mNumberAttributes[SURFACE_SCALE].GetAnimValue(this);
|
||||
float surfaceScale = mNumberAttributes[SURFACE_SCALE].GetAnimValue();
|
||||
|
||||
const nsIntRect& dataRect = info.mDataRect;
|
||||
PRInt32 stride = info.mSource->Stride();
|
||||
@ -5035,7 +5032,7 @@ nsSVGFEDiffuseLightingElement::LightPixel(const float *N, const float *L,
|
||||
nscolor color, PRUint8 *targetData)
|
||||
{
|
||||
float diffuseNL =
|
||||
mNumberAttributes[DIFFUSE_CONSTANT].GetAnimValue(this) * DOT(N, L);
|
||||
mNumberAttributes[DIFFUSE_CONSTANT].GetAnimValue() * DOT(N, L);
|
||||
|
||||
if (diffuseNL > 0) {
|
||||
targetData[GFX_ARGB32_OFFSET_B] =
|
||||
@ -5165,7 +5162,7 @@ nsSVGFESpecularLightingElement::Filter(nsSVGFilterInstance *instance,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& rect)
|
||||
{
|
||||
float specularExponent = mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue(this);
|
||||
float specularExponent = mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue();
|
||||
|
||||
// specification defined range (15.22)
|
||||
if (specularExponent < 1 || specularExponent > 128)
|
||||
@ -5185,12 +5182,12 @@ nsSVGFESpecularLightingElement::LightPixel(const float *N, const float *L,
|
||||
H[2] = L[2] + 1;
|
||||
NORMALIZE(H);
|
||||
|
||||
float kS = mNumberAttributes[SPECULAR_CONSTANT].GetAnimValue(this);
|
||||
float kS = mNumberAttributes[SPECULAR_CONSTANT].GetAnimValue();
|
||||
float dotNH = DOT(N, H);
|
||||
|
||||
if (dotNH > 0 && kS > 0) {
|
||||
float specularNH =
|
||||
kS * pow(dotNH, mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue(this));
|
||||
kS * pow(dotNH, mNumberAttributes[SPECULAR_EXPONENT].GetAnimValue());
|
||||
|
||||
targetData[GFX_ARGB32_OFFSET_B] =
|
||||
NS_MIN(PRUint32(specularNH * NS_GET_B(color)), 255U);
|
||||
@ -5737,7 +5734,7 @@ nsSVGFEDisplacementMapElement::Filter(nsSVGFilterInstance *instance,
|
||||
rect.x, rect.y, rect.width, rect.height);
|
||||
#endif
|
||||
|
||||
float scale = mNumberAttributes[SCALE].GetAnimValue(this);
|
||||
float scale = mNumberAttributes[SCALE].GetAnimValue();
|
||||
if (scale == 0.0f) {
|
||||
CopyRect(aTarget, aSources[0], rect);
|
||||
return NS_OK;
|
||||
@ -5761,8 +5758,8 @@ nsSVGFEDisplacementMapElement::Filter(nsSVGFilterInstance *instance,
|
||||
GFX_ARGB32_OFFSET_G,
|
||||
GFX_ARGB32_OFFSET_B,
|
||||
GFX_ARGB32_OFFSET_A };
|
||||
PRUint16 xChannel = channelMap[mEnumAttributes[CHANNEL_X].GetAnimValue(this)];
|
||||
PRUint16 yChannel = channelMap[mEnumAttributes[CHANNEL_Y].GetAnimValue(this)];
|
||||
PRUint16 xChannel = channelMap[mEnumAttributes[CHANNEL_X].GetAnimValue()];
|
||||
PRUint16 yChannel = channelMap[mEnumAttributes[CHANNEL_Y].GetAnimValue()];
|
||||
|
||||
double scaleOver255 = scale / 255.0;
|
||||
double scaleAdjustment = 0.5 - 0.5 * scale;
|
||||
|
@ -113,8 +113,7 @@ protected:
|
||||
const Image *aSource,
|
||||
const Image *aTarget,
|
||||
const nsIntRect& aDataRect,
|
||||
nsSVGNumber2 *aUnitX, nsSVGNumber2 *aUnitY,
|
||||
nsSVGElement *aElement);
|
||||
nsSVGNumber2 *aUnitX, nsSVGNumber2 *aUnitY);
|
||||
|
||||
void FinishScalingFilter(ScaleInfo *aScaleInfo);
|
||||
|
||||
|
@ -61,13 +61,8 @@ public:
|
||||
{ return mBaseVal; }
|
||||
|
||||
void SetAnimValue(int aValue, nsSVGElement *aSVGElement);
|
||||
int GetAnimValue(nsSVGElement *aSVGElement) const
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
aSVGElement->FlushAnimations();
|
||||
#endif
|
||||
return mAnimVal;
|
||||
}
|
||||
int GetAnimValue() const
|
||||
{ return mAnimVal; }
|
||||
|
||||
nsresult ToDOMAnimatedInteger(nsIDOMSVGAnimatedInteger **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
@ -98,9 +93,17 @@ private:
|
||||
{ *aResult = mVal->GetBaseValue(); return NS_OK; }
|
||||
NS_IMETHOD SetBaseVal(PRInt32 aValue)
|
||||
{ mVal->SetBaseValue(aValue, mSVGElement, PR_TRUE); return NS_OK; }
|
||||
NS_IMETHOD GetAnimVal(PRInt32* aResult)
|
||||
{ *aResult = mVal->GetAnimValue(mSVGElement); return NS_OK; }
|
||||
|
||||
// Script may have modified animation parameters or timeline -- DOM getters
|
||||
// need to flush any resample requests to reflect these modifications.
|
||||
NS_IMETHOD GetAnimVal(PRInt32* aResult)
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
mSVGElement->FlushAnimations();
|
||||
#endif
|
||||
*aResult = mVal->GetAnimValue();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_SMIL
|
||||
|
@ -75,12 +75,7 @@ public:
|
||||
float GetBaseValue(nsSVGElement* aSVGElement) const
|
||||
{ return mBaseVal / GetUnitScaleFactor(aSVGElement, mSpecifiedUnitType); }
|
||||
float GetAnimValue(nsSVGElement* aSVGElement) const
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
aSVGElement->FlushAnimations();
|
||||
#endif
|
||||
return mAnimVal / GetUnitScaleFactor(aSVGElement, mSpecifiedUnitType);
|
||||
}
|
||||
{ return mAnimVal / GetUnitScaleFactor(aSVGElement, mSpecifiedUnitType); }
|
||||
float GetAnimValue(nsIFrame* aFrame) const
|
||||
{ return mAnimVal / GetUnitScaleFactor(aFrame, mSpecifiedUnitType); }
|
||||
|
||||
@ -198,6 +193,8 @@ private:
|
||||
nsSVGLength2* mVal; // kept alive because it belongs to mSVGElement
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
// Script may have modified animation parameters or timeline -- DOM getters
|
||||
// need to flush any resample requests to reflect these modifications.
|
||||
NS_IMETHOD GetUnitType(PRUint16* aResult)
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
|
@ -383,7 +383,7 @@ nsSVGMarkerElement::GetMarkerTransform(float aStrokeWidth,
|
||||
float aX, float aY, float aAutoAngle)
|
||||
{
|
||||
float scale = 1.0;
|
||||
if (mEnumAttributes[MARKERUNITS].GetAnimValue(this) ==
|
||||
if (mEnumAttributes[MARKERUNITS].GetAnimValue() ==
|
||||
SVG_MARKERUNITS_STROKEWIDTH)
|
||||
scale = aStrokeWidth;
|
||||
|
||||
@ -405,7 +405,7 @@ nsSVGMarkerElement::GetViewBoxTransform()
|
||||
float viewportHeight =
|
||||
mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx);
|
||||
|
||||
const nsSVGViewBoxRect& viewbox = mViewBox.GetAnimValue(this);
|
||||
const nsSVGViewBoxRect& viewbox = mViewBox.GetAnimValue();
|
||||
|
||||
if (viewbox.width <= 0.0f || viewbox.height <= 0.0f) {
|
||||
return gfxMatrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // invalid - don't paint element
|
||||
|
@ -67,13 +67,8 @@ public:
|
||||
float GetBaseValue() const
|
||||
{ return mBaseVal; }
|
||||
void SetAnimValue(float aValue, nsSVGElement *aSVGElement);
|
||||
float GetAnimValue(nsSVGElement *aSVGElement) const
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
aSVGElement->FlushAnimations();
|
||||
#endif
|
||||
return mAnimVal;
|
||||
}
|
||||
float GetAnimValue() const
|
||||
{ return mAnimVal; }
|
||||
|
||||
nsresult ToDOMAnimatedNumber(nsIDOMSVGAnimatedNumber **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
@ -108,9 +103,17 @@ private:
|
||||
mVal->SetBaseValue(aValue, mSVGElement, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetAnimVal(float* aResult)
|
||||
{ *aResult = mVal->GetAnimValue(mSVGElement); return NS_OK; }
|
||||
|
||||
// Script may have modified animation parameters or timeline -- DOM getters
|
||||
// need to flush any resample requests to reflect these modifications.
|
||||
NS_IMETHOD GetAnimVal(float* aResult)
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
mSVGElement->FlushAnimations();
|
||||
#endif
|
||||
*aResult = mVal->GetAnimValue();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_SMIL
|
||||
|
@ -124,7 +124,7 @@ nsSVGPathElement::GetPointAtLength(float distance, nsIDOMSVGPoint **_retval)
|
||||
|
||||
float totalLength = flat->GetLength();
|
||||
if (HasAttr(kNameSpaceID_None, nsGkAtoms::pathLength)) {
|
||||
float pathLength = mPathLength.GetAnimValue(this);
|
||||
float pathLength = mPathLength.GetAnimValue();
|
||||
distance *= totalLength / pathLength;
|
||||
}
|
||||
distance = NS_MAX(0.f, distance);
|
||||
|
@ -109,13 +109,8 @@ public:
|
||||
|
||||
const PreserveAspectRatio &GetBaseValue() const
|
||||
{ return mBaseVal; }
|
||||
const PreserveAspectRatio &GetAnimValue(nsSVGElement *aSVGElement) const
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
aSVGElement->FlushAnimations();
|
||||
#endif
|
||||
return mAnimVal;
|
||||
}
|
||||
const PreserveAspectRatio &GetAnimValue() const
|
||||
{ return mAnimVal; }
|
||||
|
||||
nsresult ToDOMAnimatedPreserveAspectRatio(
|
||||
nsIDOMSVGAnimatedPreserveAspectRatio **aResult,
|
||||
@ -169,13 +164,27 @@ private:
|
||||
nsSVGPreserveAspectRatio* mVal; // kept alive because it belongs to mSVGElement
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
// Script may have modified animation parameters or timeline -- DOM getters
|
||||
// need to flush any resample requests to reflect these modifications.
|
||||
NS_IMETHOD GetAlign(PRUint16* aAlign)
|
||||
{ *aAlign = mVal->GetAnimValue(mSVGElement).GetAlign(); return NS_OK; }
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
mSVGElement->FlushAnimations();
|
||||
#endif
|
||||
*aAlign = mVal->GetAnimValue().GetAlign();
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetAlign(PRUint16 aAlign)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
|
||||
NS_IMETHOD GetMeetOrSlice(PRUint16* aMeetOrSlice)
|
||||
{ *aMeetOrSlice = mVal->GetAnimValue(mSVGElement).GetMeetOrSlice(); return NS_OK; }
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
mSVGElement->FlushAnimations();
|
||||
#endif
|
||||
*aMeetOrSlice = mVal->GetAnimValue().GetMeetOrSlice();
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD SetMeetOrSlice(PRUint16 aValue)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
};
|
||||
|
@ -819,7 +819,7 @@ nsSVGSVGElement::GetTransformToElement(nsIDOMSVGElement *element,
|
||||
NS_IMETHODIMP
|
||||
nsSVGSVGElement::GetZoomAndPan(PRUint16 *aZoomAndPan)
|
||||
{
|
||||
*aZoomAndPan = mEnumAttributes[ZOOMANDPAN].GetAnimValue(this);
|
||||
*aZoomAndPan = mEnumAttributes[ZOOMANDPAN].GetAnimValue();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -989,7 +989,7 @@ nsSVGSVGElement::GetViewBoxTransform()
|
||||
|
||||
nsSVGViewBoxRect viewBox;
|
||||
if (mViewBox.IsValid()) {
|
||||
viewBox = mViewBox.GetAnimValue(this);
|
||||
viewBox = mViewBox.GetAnimValue();
|
||||
} else {
|
||||
viewBox.x = viewBox.y = 0.0f;
|
||||
viewBox.width = viewportWidth;
|
||||
@ -1114,7 +1114,7 @@ nsSVGSVGElement::GetLength(PRUint8 aCtxType)
|
||||
float h, w;
|
||||
|
||||
if (mViewBox.IsValid()) {
|
||||
const nsSVGViewBoxRect& viewbox = mViewBox.GetAnimValue(this);
|
||||
const nsSVGViewBoxRect& viewbox = mViewBox.GetAnimValue();
|
||||
w = viewbox.width;
|
||||
h = viewbox.height;
|
||||
} else {
|
||||
|
@ -103,15 +103,6 @@ nsSVGViewBox::Init()
|
||||
mHasBaseVal = PR_FALSE;
|
||||
}
|
||||
|
||||
const nsSVGViewBoxRect&
|
||||
nsSVGViewBox::GetAnimValue(nsSVGElement *aSVGElement) const
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
aSVGElement->FlushAnimations();
|
||||
#endif
|
||||
return mAnimVal ? *mAnimVal : mBaseVal;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGViewBox::SetAnimValue(float aX, float aY, float aWidth, float aHeight,
|
||||
nsSVGElement *aSVGElement)
|
||||
|
@ -73,7 +73,8 @@ public:
|
||||
void SetBaseValue(float aX, float aY, float aWidth, float aHeight,
|
||||
nsSVGElement *aSVGElement, PRBool aDoSetAttr);
|
||||
|
||||
const nsSVGViewBoxRect& GetAnimValue(nsSVGElement *aSVGElement) const;
|
||||
const nsSVGViewBoxRect& GetAnimValue() const
|
||||
{ return mAnimVal ? *mAnimVal : mBaseVal; }
|
||||
void SetAnimValue(float aX, float aY, float aWidth, float aHeight,
|
||||
nsSVGElement *aSVGElement);
|
||||
|
||||
@ -132,14 +133,40 @@ private:
|
||||
nsSVGViewBox* mVal; // kept alive because it belongs to content
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
// Script may have modified animation parameters or timeline -- DOM getters
|
||||
// need to flush any resample requests to reflect these modifications.
|
||||
NS_IMETHOD GetX(float *aX)
|
||||
{ *aX = mVal->GetAnimValue(mSVGElement).x; return NS_OK; }
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
mSVGElement->FlushAnimations();
|
||||
#endif
|
||||
*aX = mVal->GetAnimValue().x;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetY(float *aY)
|
||||
{ *aY = mVal->GetAnimValue(mSVGElement).y; return NS_OK; }
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
mSVGElement->FlushAnimations();
|
||||
#endif
|
||||
*aY = mVal->GetAnimValue().y;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetWidth(float *aWidth)
|
||||
{ *aWidth = mVal->GetAnimValue(mSVGElement).width; return NS_OK; }
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
mSVGElement->FlushAnimations();
|
||||
#endif
|
||||
*aWidth = mVal->GetAnimValue().width;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetHeight(float *aHeight)
|
||||
{ *aHeight = mVal->GetAnimValue(mSVGElement).height; return NS_OK; }
|
||||
{
|
||||
#ifdef MOZ_SMIL
|
||||
mSVGElement->FlushAnimations();
|
||||
#endif
|
||||
*aHeight = mVal->GetAnimValue().height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHOD SetX(float aX)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
|
@ -108,9 +108,9 @@ nsAutoFilterInstance::nsAutoFilterInstance(nsIFrame *aTarget,
|
||||
static_cast<nsSVGFilterElement*>(aFilterFrame->GetContent());
|
||||
|
||||
PRUint16 filterUnits =
|
||||
filter->mEnumAttributes[nsSVGFilterElement::FILTERUNITS].GetAnimValue(filter);
|
||||
filter->mEnumAttributes[nsSVGFilterElement::FILTERUNITS].GetAnimValue();
|
||||
PRUint16 primitiveUnits =
|
||||
filter->mEnumAttributes[nsSVGFilterElement::PRIMITIVEUNITS].GetAnimValue(filter);
|
||||
filter->mEnumAttributes[nsSVGFilterElement::PRIMITIVEUNITS].GetAnimValue();
|
||||
|
||||
gfxRect bbox;
|
||||
if (aOverrideSourceBBox) {
|
||||
|
@ -193,7 +193,7 @@ nsSVGGradientFrame::GetSpreadMethod()
|
||||
nsSVGGradientElement *element =
|
||||
GetGradientWithAttr(nsGkAtoms::spreadMethod, mContent);
|
||||
|
||||
return element->mEnumAttributes[nsSVGGradientElement::SPREADMETHOD].GetAnimValue(element);
|
||||
return element->mEnumAttributes[nsSVGGradientElement::SPREADMETHOD].GetAnimValue();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -402,7 +402,7 @@ nsSVGGradientFrame::GetGradientUnits()
|
||||
|
||||
nsSVGGradientElement *element =
|
||||
GetGradientWithAttr(nsGkAtoms::gradientUnits, mContent);
|
||||
return element->mEnumAttributes[nsSVGGradientElement::GRADIENTUNITS].GetAnimValue(element);
|
||||
return element->mEnumAttributes[nsSVGGradientElement::GRADIENTUNITS].GetAnimValue();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
@ -77,7 +77,7 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsSVGRenderState *aContext,
|
||||
nsSVGMaskElement *mask = static_cast<nsSVGMaskElement*>(mContent);
|
||||
|
||||
PRUint16 units =
|
||||
mask->mEnumAttributes[nsSVGMaskElement::MASKUNITS].GetAnimValue(mask);
|
||||
mask->mEnumAttributes[nsSVGMaskElement::MASKUNITS].GetAnimValue();
|
||||
gfxRect bbox;
|
||||
if (units == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
|
||||
bbox = nsSVGUtils::GetBBox(aParent);
|
||||
|
@ -284,7 +284,7 @@ nsSVGOuterSVGFrame::GetIntrinsicRatio()
|
||||
}
|
||||
|
||||
if (content->mViewBox.IsValid()) {
|
||||
const nsSVGViewBoxRect viewbox = content->mViewBox.GetAnimValue(content);
|
||||
const nsSVGViewBoxRect viewbox = content->mViewBox.GetAnimValue();
|
||||
float viewBoxWidth = viewbox.width;
|
||||
float viewBoxHeight = viewbox.height;
|
||||
|
||||
|
@ -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(patternElement);
|
||||
return patternElement->mEnumAttributes[nsSVGPatternElement::PATTERNUNITS].GetAnimValue();
|
||||
}
|
||||
|
||||
PRUint16
|
||||
@ -348,7 +348,7 @@ nsSVGPatternFrame::GetPatternContentUnits()
|
||||
{
|
||||
nsSVGPatternElement *patternElement =
|
||||
GetPatternWithAttr(nsGkAtoms::patternContentUnits, mContent);
|
||||
return patternElement->mEnumAttributes[nsSVGPatternElement::PATTERNCONTENTUNITS].GetAnimValue(patternElement);
|
||||
return patternElement->mEnumAttributes[nsSVGPatternElement::PATTERNCONTENTUNITS].GetAnimValue();
|
||||
}
|
||||
|
||||
gfxMatrix
|
||||
@ -542,7 +542,7 @@ nsSVGPatternFrame::ConstructCTM(const gfxRect &callerBBox,
|
||||
nsSVGPatternElement *patternElement =
|
||||
static_cast<nsSVGPatternElement*>(mContent);
|
||||
gfxMatrix tm;
|
||||
const nsSVGViewBoxRect viewBox = GetViewBox().GetAnimValue(patternElement);
|
||||
const nsSVGViewBoxRect viewBox = GetViewBox().GetAnimValue();
|
||||
|
||||
if (viewBox.height > 0.0f && viewBox.width > 0.0f) {
|
||||
nsSVGSVGElement *ctx = aTargetContent->GetCtx();
|
||||
|
@ -187,7 +187,7 @@ nsSVGTextPathFrame::GetPathScale()
|
||||
return 1.0;
|
||||
|
||||
nsSVGPathElement *path = static_cast<nsSVGPathElement*>(pathFrame->GetContent());
|
||||
float pl = path->mPathLength.GetAnimValue(path);
|
||||
float pl = path->mPathLength.GetAnimValue();
|
||||
|
||||
if (pl == 0.0f)
|
||||
return 1.0;
|
||||
|
@ -809,8 +809,8 @@ nsSVGUtils::GetViewBoxTransform(nsSVGElement* aElement,
|
||||
NS_ASSERTION(aViewboxWidth > 0, "viewBox width must be greater than zero!");
|
||||
NS_ASSERTION(aViewboxHeight > 0, "viewBox height must be greater than zero!");
|
||||
|
||||
PRUint16 align = aPreserveAspectRatio.GetAnimValue(aElement).GetAlign();
|
||||
PRUint16 meetOrSlice = aPreserveAspectRatio.GetAnimValue(aElement).GetMeetOrSlice();
|
||||
PRUint16 align = aPreserveAspectRatio.GetAnimValue().GetAlign();
|
||||
PRUint16 meetOrSlice = aPreserveAspectRatio.GetAnimValue().GetMeetOrSlice();
|
||||
|
||||
// default to the defaults
|
||||
if (align == nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_UNKNOWN)
|
||||
@ -1437,7 +1437,7 @@ nsSVGUtils::AdjustMatrixForUnits(const gfxMatrix &aMatrix,
|
||||
nsIFrame *aFrame)
|
||||
{
|
||||
if (aFrame &&
|
||||
aUnits->GetAnimValue(static_cast<nsSVGElement*>(aFrame->GetContent())) ==
|
||||
aUnits->GetAnimValue() ==
|
||||
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
|
||||
gfxRect bbox = GetBBox(aFrame);
|
||||
return gfxMatrix().Scale(bbox.Width(), bbox.Height()) *
|
||||
|
Loading…
Reference in New Issue
Block a user