mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 606399 - SVG SMIL: Animating rect rx or ry only should animate corresponding attribute; r=roc; a=roc
This commit is contained in:
parent
7218dcc764
commit
b698e78544
@ -307,6 +307,7 @@ nsSVGLength2::SetBaseValueInSpecifiedUnits(float aValue,
|
||||
nsSVGElement *aSVGElement)
|
||||
{
|
||||
mBaseVal = aValue;
|
||||
mIsBaseSet = PR_TRUE;
|
||||
if (!mIsAnimated) {
|
||||
mAnimVal = mBaseVal;
|
||||
}
|
||||
@ -344,6 +345,7 @@ nsSVGLength2::NewValueSpecifiedUnits(PRUint16 unitType,
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
|
||||
mBaseVal = valueInSpecifiedUnits;
|
||||
mIsBaseSet = PR_TRUE;
|
||||
mSpecifiedUnitType = PRUint8(unitType);
|
||||
if (!mIsAnimated) {
|
||||
mAnimVal = mBaseVal;
|
||||
@ -413,6 +415,7 @@ nsSVGLength2::SetBaseValueString(const nsAString &aValueAsString,
|
||||
}
|
||||
|
||||
mBaseVal = value;
|
||||
mIsBaseSet = PR_TRUE;
|
||||
mSpecifiedUnitType = PRUint8(unitType);
|
||||
if (!mIsAnimated) {
|
||||
mAnimVal = mBaseVal;
|
||||
@ -445,6 +448,7 @@ void
|
||||
nsSVGLength2::SetBaseValue(float aValue, nsSVGElement *aSVGElement)
|
||||
{
|
||||
mBaseVal = aValue * GetUnitScaleFactor(aSVGElement, mSpecifiedUnitType);
|
||||
mIsBaseSet = PR_TRUE;
|
||||
if (!mIsAnimated) {
|
||||
mAnimVal = mBaseVal;
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ public:
|
||||
mAttrEnum = aAttrEnum;
|
||||
mCtxType = aCtxType;
|
||||
mIsAnimated = PR_FALSE;
|
||||
mIsBaseSet = PR_FALSE;
|
||||
}
|
||||
|
||||
nsresult SetBaseValueString(const nsAString& aValue,
|
||||
@ -90,6 +91,14 @@ public:
|
||||
{ return mBaseVal / GetUnitScaleFactor(aCtx, mSpecifiedUnitType); }
|
||||
float GetAnimValue(nsSVGSVGElement* aCtx) const
|
||||
{ return mAnimVal / GetUnitScaleFactor(aCtx, mSpecifiedUnitType); }
|
||||
|
||||
// Returns PR_TRUE if the animated value of this length has been explicitly
|
||||
// set (either by animation, or by taking on the base value which has been
|
||||
// explicitly set by markup or a DOM call), PR_FALSE otherwise.
|
||||
// If this returns PR_FALSE, the animated value is still valid, that is,
|
||||
// useable, and represents the default base value of the attribute.
|
||||
PRBool IsAnimValSet() const
|
||||
{ return mIsAnimated || mIsBaseSet; }
|
||||
|
||||
nsresult ToDOMAnimatedLength(nsIDOMSVGAnimatedLength **aResult,
|
||||
nsSVGElement* aSVGElement);
|
||||
@ -105,7 +114,8 @@ private:
|
||||
PRUint8 mSpecifiedUnitType;
|
||||
PRUint8 mAttrEnum; // element specified tracking for attribute
|
||||
PRUint8 mCtxType; // X, Y or Unspecified
|
||||
PRPackedBool mIsAnimated;
|
||||
PRPackedBool mIsAnimated:1;
|
||||
PRPackedBool mIsBaseSet:1;
|
||||
|
||||
static float GetMMPerPixel() { return MM_PER_INCH_FLOAT / 96; }
|
||||
float GetAxisLength(nsIFrame *aNonSVGFrame) const;
|
||||
|
@ -190,10 +190,10 @@ nsSVGRectElement::ConstructPath(gfxContext *aCtx)
|
||||
return;
|
||||
}
|
||||
|
||||
/* If either the 'rx' or the 'ry' attribute isn't set in the markup, then we
|
||||
/* If either the 'rx' or the 'ry' attribute isn't set, then we
|
||||
have to set it to the value of the other. */
|
||||
PRBool hasRx = HasAttr(kNameSpaceID_None, nsGkAtoms::rx);
|
||||
PRBool hasRy = HasAttr(kNameSpaceID_None, nsGkAtoms::ry);
|
||||
PRBool hasRx = mLengthAttributes[RX].IsAnimValSet();
|
||||
PRBool hasRy = mLengthAttributes[RY].IsAnimValSet();
|
||||
if (hasRx && !hasRy)
|
||||
ry = rx;
|
||||
else if (hasRy && !hasRx)
|
||||
|
25
layout/reftests/svg/smil/anim-rect-rxry-1-ref.svg
Normal file
25
layout/reftests/svg/smil/anim-rect-rxry-1-ref.svg
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill="blue" stroke="red" stroke-width="10" transform="translate(10 10)">
|
||||
<!-- Squares -->
|
||||
<rect x="0" width="40" height="40"/>
|
||||
<rect x="60" width="40" height="40"/>
|
||||
<rect x="120" width="40" height="40"/>
|
||||
<rect x="180" width="40" height="40"/>
|
||||
|
||||
<!-- rx=0 ry=20 -->
|
||||
<rect x="0" y="60" width="40" height="40" rx="0" ry="20"/>
|
||||
<rect x="60" y="60" width="40" height="40" rx="0" ry="20"/>
|
||||
<rect x="120" y="60" width="40" height="40" rx="0" ry="20"/>
|
||||
<rect x="180" y="60" width="40" height="40" rx="0" ry="20"/>
|
||||
<rect x="240" y="60" width="40" height="40" rx="0" ry="20"/>
|
||||
|
||||
<!-- rx=20 (hence ry=20) -->
|
||||
<rect x="0" y="120" width="40" height="40" rx="20"/>
|
||||
<rect x="60" y="120" width="40" height="40" rx="20"/>
|
||||
<rect x="120" y="120" width="40" height="40" rx="20"/>
|
||||
<rect x="180" y="120" width="40" height="40" rx="20"/>
|
||||
<rect x="240" y="120" width="40" height="40" rx="20"/>
|
||||
<rect x="300" y="120" width="40" height="40" rx="20"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
65
layout/reftests/svg/smil/anim-rect-rxry-1.svg
Normal file
65
layout/reftests/svg/smil/anim-rect-rxry-1.svg
Normal file
@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
class="reftest-wait">
|
||||
<g fill="blue" stroke="red" stroke-width="10" transform="translate(10 10)">
|
||||
<!-- Squares -->
|
||||
<rect x="0" width="40" height="40"/>
|
||||
<rect x="60" width="40" height="40">
|
||||
<set attributeName="rx" to="0"/>
|
||||
</rect>
|
||||
<rect x="120" width="40" height="40" rx="20">
|
||||
<set attributeName="rx" to="0"/>
|
||||
</rect>
|
||||
<rect x="180" width="40" height="40" rx="20" ry="20">
|
||||
<set attributeName="rx" to="0"/>
|
||||
<set attributeName="ry" to="0"/>
|
||||
</rect>
|
||||
|
||||
<!-- rx=0 ry=20 -->
|
||||
<rect x="0" y="60" width="40" height="40" rx="0" ry="20"/>
|
||||
<rect x="60" y="60" width="40" height="40" ry="20">
|
||||
<set attributeName="rx" to="0"/>
|
||||
</rect>
|
||||
<rect x="120" y="60" width="40" height="40" rx="20" ry="20">
|
||||
<set attributeName="rx" to="0"/>
|
||||
</rect>
|
||||
<rect x="180" y="60" width="40" height="40">
|
||||
<set attributeName="rx" to="0"/>
|
||||
<set attributeName="ry" to="20"/>
|
||||
</rect>
|
||||
<rect x="240" y="60" width="40" height="40" id="a">
|
||||
<set attributeName="ry" to="20"/>
|
||||
<!-- rx.baseVal will be set to 0 by script -->
|
||||
</rect>
|
||||
|
||||
<!-- rx=20 (hence ry=20) -->
|
||||
<rect x="0" y="120" width="40" height="40" rx="20"/>
|
||||
<rect x="60" y="120" width="40" height="40">
|
||||
<set attributeName="rx" to="20"/>
|
||||
</rect>
|
||||
<rect x="120" y="120" width="40" height="40" rx="0">
|
||||
<set attributeName="rx" to="20"/>
|
||||
</rect>
|
||||
<rect x="180" y="120" width="40" height="40" rx="10">
|
||||
<set attributeName="rx" to="20"/>
|
||||
</rect>
|
||||
<rect x="240" y="120" width="40" height="40" ry="0" id="b">
|
||||
<set attributeName="rx" to="20"/>
|
||||
<!-- ry attribute will be removed by script -->
|
||||
</rect>
|
||||
<!-- rx.baseVal attribute will be set by script -->
|
||||
<rect x="300" y="120" width="40" height="40" id="c"/>
|
||||
</g>
|
||||
<script xlink:href="smil-util.js" type="text/javascript"/>
|
||||
<script type="text/javascript">
|
||||
document.getElementById('a').rx.baseVal.value = 0;
|
||||
document.getElementById('b').removeAttribute('ry');
|
||||
document.getElementById('c').rx.baseVal.value = 20;
|
||||
// We can get very minor rendering differences on Windows due to the
|
||||
// presence of animation in the document, even on un-animated content.
|
||||
// This is most likely due to interaction with layers so we forcibly seek
|
||||
// the animation timeline to try to produce a steady state for snapshot.
|
||||
setTimeAndSnapshot(0.0, true);
|
||||
</script>
|
||||
</svg>
|
After Width: | Height: | Size: 2.5 KiB |
@ -176,6 +176,8 @@ random == anim-text-x-y-dx-dy-01.svg anim-text-x-y-dx-dy-01-ref.svg # bug 579588
|
||||
== anim-y-interp-5.svg anim-y-interp-5-ref.svg
|
||||
== anim-y-interp-6.svg anim-y-interp-6-ref.svg
|
||||
|
||||
== anim-rect-rxry-1.svg anim-rect-rxry-1-ref.svg
|
||||
|
||||
== api-sanity-1.svg lime.svg
|
||||
|
||||
== freeze-applied-late-1.svg anim-standard-ref.svg
|
||||
|
Loading…
Reference in New Issue
Block a user