Bug 828901 - Get the seek time as mBasePosition instead of the stream position in...
[gecko.git] / content / smil / nsISMILAttr.h
blob6d679660f63a57a93189b67191f4d9fc005faee8
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_
9 #include "nscore.h"
11 class nsSMILValue;
12 class nsISMILType;
13 class nsISMILAnimationElement;
14 class nsIContent;
15 class nsAString;
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
24 // object.
26 class nsISMILAttr
28 public:
29 /**
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
39 * parse the value.
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,
50 nsSMILValue& aValue,
51 bool& aPreventCachingOfSandwich) const = 0;
53 /**
54 * Gets the underlying value of this attribute.
56 * @return an nsSMILValue object. returned_object.IsNull() will be true if an
57 * error occurred.
59 virtual nsSMILValue GetBaseValue() const = 0;
61 /**
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;
69 /**
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;
77 /**
78 * Returns the targeted content node, for any nsISMILAttr implementations
79 * that want to expose that to the animation logic. Otherwise, returns
80 * null.
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; }
87 /**
88 * Virtual destructor, to make sure subclasses can clean themselves up.
90 virtual ~nsISMILAttr() {}
93 #endif // NS_ISMILATTR_H_