michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef NS_ISMILATTR_H_ michael@0: #define NS_ISMILATTR_H_ michael@0: michael@0: #include "nscore.h" michael@0: michael@0: class nsSMILValue; michael@0: class nsISMILType; michael@0: class nsIContent; michael@0: class nsAString; michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class SVGAnimationElement; michael@0: } michael@0: } michael@0: michael@0: //////////////////////////////////////////////////////////////////////// michael@0: // nsISMILAttr: A variable targeted by SMIL for animation and can therefore have michael@0: // an underlying (base) value and an animated value For example, an attribute of michael@0: // a particular SVG element. michael@0: // michael@0: // These objects only exist during the compositing phase of SMIL animation michael@0: // calculations. They have a single owner who is responsible for deleting the michael@0: // object. michael@0: michael@0: class nsISMILAttr michael@0: { michael@0: public: michael@0: /** michael@0: * Creates a new nsSMILValue for this attribute from a string. The string is michael@0: * parsed in the context of this attribute so that context-dependent values michael@0: * such as em-based units can be resolved into a canonical form suitable for michael@0: * animation (including interpolation etc.). michael@0: * michael@0: * @param aStr A string defining the new value to be created. michael@0: * @param aSrcElement The source animation element. This may be needed to michael@0: * provided additional context data such as for michael@0: * animateTransform where the 'type' attribute is needed to michael@0: * parse the value. michael@0: * @param[out] aValue Outparam for storing the parsed value. michael@0: * @param[out] aPreventCachingOfSandwich michael@0: * Outparam to indicate whether the attribute contains michael@0: * dependencies on its context that should prevent the michael@0: * result of the animation sandwich from being cached and michael@0: * reused in future samples. michael@0: * @return NS_OK on success or an error code if creation failed. michael@0: */ michael@0: virtual nsresult ValueFromString(const nsAString& aStr, michael@0: const mozilla::dom::SVGAnimationElement* aSrcElement, michael@0: nsSMILValue& aValue, michael@0: bool& aPreventCachingOfSandwich) const = 0; michael@0: michael@0: /** michael@0: * Gets the underlying value of this attribute. michael@0: * michael@0: * @return an nsSMILValue object. returned_object.IsNull() will be true if an michael@0: * error occurred. michael@0: */ michael@0: virtual nsSMILValue GetBaseValue() const = 0; michael@0: michael@0: /** michael@0: * Clears the animated value of this attribute. michael@0: * michael@0: * NOTE: The animation target is not guaranteed to be in a document when this michael@0: * method is called. (See bug 523188) michael@0: */ michael@0: virtual void ClearAnimValue() = 0; michael@0: michael@0: /** michael@0: * Sets the presentation value of this attribute. michael@0: * michael@0: * @param aValue The value to set. michael@0: * @return NS_OK on success or an error code if setting failed. michael@0: */ michael@0: virtual nsresult SetAnimValue(const nsSMILValue& aValue) = 0; michael@0: michael@0: /** michael@0: * Returns the targeted content node, for any nsISMILAttr implementations michael@0: * that want to expose that to the animation logic. Otherwise, returns michael@0: * null. michael@0: * michael@0: * @return the targeted content node, if this nsISMILAttr implementation michael@0: * wishes to make it avaiable. Otherwise, nullptr. michael@0: */ michael@0: virtual const nsIContent* GetTargetNode() const { return nullptr; } michael@0: michael@0: /** michael@0: * Virtual destructor, to make sure subclasses can clean themselves up. michael@0: */ michael@0: virtual ~nsISMILAttr() {} michael@0: }; michael@0: michael@0: #endif // NS_ISMILATTR_H_