зеркало из https://github.com/mozilla/pjs.git
Bug 683040: Override new method IsToAnimation instead of old method TreatSingleValueAsStatic, to handle "to animation" for animateMotion. r=birtles
This commit is contained in:
Родитель
b31cf2fea5
Коммит
d1f91fa94d
|
@ -383,6 +383,18 @@ SVGMotionSMILAnimationFunction::
|
|||
CheckKeyPoints();
|
||||
}
|
||||
|
||||
PRBool
|
||||
SVGMotionSMILAnimationFunction::IsToAnimation() const
|
||||
{
|
||||
// Rely on inherited method, but not if we have an <mpath> child or a |path|
|
||||
// attribute, because they'll override any 'to' attr we might have.
|
||||
// NOTE: We can't rely on mPathSourceType, because it might not have been
|
||||
// set to a useful value yet (or it might be stale).
|
||||
return !GetFirstMpathChild(&mAnimationElement->AsElement()) &&
|
||||
!HasAttr(nsGkAtoms::path) &&
|
||||
nsSMILAnimationFunction::IsToAnimation();
|
||||
}
|
||||
|
||||
void
|
||||
SVGMotionSMILAnimationFunction::CheckKeyPoints()
|
||||
{
|
||||
|
@ -485,15 +497,4 @@ SVGMotionSMILAnimationFunction::UnsetRotate()
|
|||
mHasChanged = PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
SVGMotionSMILAnimationFunction::TreatSingleValueAsStatic() const
|
||||
{
|
||||
// <animateMotion> has two more ways that we could be just sampling a single
|
||||
// value -- via path attribute and the <mpath> element, with a path
|
||||
// description that just includes a single "move" command.
|
||||
return (mPathSourceType == ePathSourceType_ValuesAttr ||
|
||||
mPathSourceType == ePathSourceType_PathAttr ||
|
||||
mPathSourceType == ePathSourceType_Mpath);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -85,7 +85,8 @@ protected:
|
|||
NS_OVERRIDE virtual nsresult GetValues(const nsISMILAttr& aSMILAttr,
|
||||
nsSMILValueArray& aResult);
|
||||
NS_OVERRIDE virtual void CheckValueListDependentAttrs(PRUint32 aNumValues);
|
||||
NS_OVERRIDE virtual PRBool TreatSingleValueAsStatic() const;
|
||||
|
||||
NS_OVERRIDE virtual PRBool IsToAnimation() const;
|
||||
|
||||
void CheckKeyPoints();
|
||||
nsresult SetKeyPoints(const nsAString& aKeyPoints, nsAttrValue& aResult);
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
class="reftest-wait">
|
||||
<script xlink:href="../smil-util.js" type="text/javascript"/>
|
||||
<script type="text/javascript">
|
||||
function doTest() {
|
||||
setTimeAndSnapshot(1, true);
|
||||
}
|
||||
window.addEventListener("MozReftestInvalidate", doTest, false);
|
||||
</script>
|
||||
|
||||
<!-- Big green background to match lime.svg -->
|
||||
<rect fill="lime" width="100%" height="100%" />
|
||||
|
||||
<!-- In the following pairs of rects, the only pairwise differences are the
|
||||
fill-color and the presence of the "to" attribute on the animateMotion
|
||||
element. "to" shouldn't have any effect in these cases, since it has
|
||||
lower priority than "values," "path," and "mpath". So in each case, the
|
||||
lime rect should cover up the red rect at all times. -->
|
||||
|
||||
<!-- Single-point path specified with "values" attribute: -->
|
||||
<g transform="translate(0,0)">
|
||||
<rect width="20" height="20" fill="red">
|
||||
<animateMotion values="20,0" dur="2"/>
|
||||
</rect>
|
||||
<rect width="20" height="20" fill="lime">
|
||||
<animateMotion values="20,0" dur="2" to="-50,0"/>
|
||||
</rect>
|
||||
</g>
|
||||
|
||||
<!-- Multi-point path specified with "values" attribute: -->
|
||||
<g transform="translate(0,30)">
|
||||
<rect width="20" height="20" fill="red">
|
||||
<animateMotion values="20,0; 80,0" dur="2"/>
|
||||
</rect>
|
||||
<rect width="20" height="20" fill="lime">
|
||||
<animateMotion values="20,0; 80,0" dur="2" to="-50,0"/>
|
||||
</rect>
|
||||
</g>
|
||||
|
||||
<!-- Path specified with "path" attribute: -->
|
||||
<g transform="translate(0,60)">
|
||||
<rect width="20" height="20" fill="red">
|
||||
<animateMotion path="m0,0 h100" dur="2"/>
|
||||
</rect>
|
||||
<rect width="20" height="20" fill="lime">
|
||||
<animateMotion path="m0,0 h100" dur="2" to="-50,0"/>
|
||||
</rect>
|
||||
</g>
|
||||
|
||||
<!-- Path specified with "mpath" subelement: -->
|
||||
<path id="p" d="m0,0 h100"/>
|
||||
<g transform="translate(0,90)">
|
||||
<rect width="20" height="20" fill="red">
|
||||
<animateMotion dur="2"><mpath xlink:href="#p"/></animateMotion>
|
||||
</rect>
|
||||
<rect width="20" height="20" fill="lime">
|
||||
<animateMotion dur="2" to="-50,0"><mpath xlink:href="#p"/></animateMotion>
|
||||
</rect>
|
||||
</g>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 2.1 KiB |
|
@ -6,6 +6,7 @@
|
|||
== animateMotion-rotate-1a.svg lime.svg
|
||||
== animateMotion-rotate-1b.svg lime.svg
|
||||
== animateMotion-rotate-2.svg lime.svg
|
||||
== animateMotion-to-overridden-1.svg lime.svg
|
||||
== animateMotion-values-linear-1.svg animateMotion-values-linear-1-ref.svg
|
||||
== animateMotion-values-paced-1a.svg animateMotion-values-paced-1-ref.svg
|
||||
== animateMotion-values-paced-1b.svg animateMotion-values-paced-1-ref.svg
|
||||
|
|
Загрузка…
Ссылка в новой задаче