1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef NS_ISMILATTR_H_
7 #define NS_ISMILATTR_H_
13 class nsISMILAnimationElement
;
17 ////////////////////////////////////////////////////////////////////////
18 // nsISMILAttr: A variable targeted by SMIL for animation and can therefore have
19 // an underlying (base) value and an animated value For example, an attribute of
20 // a particular SVG element.
22 // These objects only exist during the compositing phase of SMIL animation
23 // calculations. They have a single owner who is responsible for deleting the
30 * Creates a new nsSMILValue for this attribute from a string. The string is
31 * parsed in the context of this attribute so that context-dependent values
32 * such as em-based units can be resolved into a canonical form suitable for
33 * animation (including interpolation etc.).
35 * @param aStr A string defining the new value to be created.
36 * @param aSrcElement The source animation element. This may be needed to
37 * provided additional context data such as for
38 * animateTransform where the 'type' attribute is needed to
40 * @param[out] aValue Outparam for storing the parsed value.
41 * @param[out] aPreventCachingOfSandwich
42 * Outparam to indicate whether the attribute contains
43 * dependencies on its context that should prevent the
44 * result of the animation sandwich from being cached and
45 * reused in future samples.
46 * @return NS_OK on success or an error code if creation failed.
48 virtual nsresult
ValueFromString(const nsAString
& aStr
,
49 const nsISMILAnimationElement
* aSrcElement
,
51 bool& aPreventCachingOfSandwich
) const = 0;
54 * Gets the underlying value of this attribute.
56 * @return an nsSMILValue object. returned_object.IsNull() will be true if an
59 virtual nsSMILValue
GetBaseValue() const = 0;
62 * Clears the animated value of this attribute.
64 * NOTE: The animation target is not guaranteed to be in a document when this
65 * method is called. (See bug 523188)
67 virtual void ClearAnimValue() = 0;
70 * Sets the presentation value of this attribute.
72 * @param aValue The value to set.
73 * @return NS_OK on success or an error code if setting failed.
75 virtual nsresult
SetAnimValue(const nsSMILValue
& aValue
) = 0;
78 * Returns the targeted content node, for any nsISMILAttr implementations
79 * that want to expose that to the animation logic. Otherwise, returns
82 * @return the targeted content node, if this nsISMILAttr implementation
83 * wishes to make it avaiable. Otherwise, nullptr.
85 virtual const nsIContent
* GetTargetNode() const { return nullptr; }
88 * Virtual destructor, to make sure subclasses can clean themselves up.
90 virtual ~nsISMILAttr() {}
93 #endif // NS_ISMILATTR_H_