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 /* representation of a SMIL-animatable CSS property on an element */
8 #ifndef NS_SMILCSSPROPERTY_H_
9 #define NS_SMILCSSPROPERTY_H_
11 #include "mozilla/Attributes.h"
12 #include "nsISMILAttr.h"
14 #include "nsCSSProperty.h"
15 #include "nsCSSValue.h"
21 } // namespace mozilla
24 * nsSMILCSSProperty: Implements the nsISMILAttr interface for SMIL animations
25 * that target CSS properties. Represents a particular animation-targeted CSS
26 * property on a particular element.
28 class nsSMILCSSProperty
: public nsISMILAttr
32 * Constructs a new nsSMILCSSProperty.
33 * @param aPropID The CSS property we're interested in animating.
34 * @param aElement The element whose CSS property is being animated.
36 nsSMILCSSProperty(nsCSSProperty aPropID
, mozilla::dom::Element
* aElement
);
38 // nsISMILAttr methods
39 virtual nsresult
ValueFromString(const nsAString
& aStr
,
40 const mozilla::dom::SVGAnimationElement
* aSrcElement
,
42 bool& aPreventCachingOfSandwich
) const MOZ_OVERRIDE
;
43 virtual nsSMILValue
GetBaseValue() const MOZ_OVERRIDE
;
44 virtual nsresult
SetAnimValue(const nsSMILValue
& aValue
) MOZ_OVERRIDE
;
45 virtual void ClearAnimValue() MOZ_OVERRIDE
;
48 * Utility method - returns true if the given property is supported for
51 * @param aProperty The property to check for animation support.
52 * @return true if the given property is supported for SMIL animation, or
55 static bool IsPropertyAnimatable(nsCSSProperty aPropID
);
58 nsCSSProperty mPropID
;
59 // Using non-refcounted pointer for mElement -- we know mElement will stay
60 // alive for my lifetime because a nsISMILAttr (like me) only lives as long
61 // as the Compositing step, and DOM elements don't get a chance to die during
63 mozilla::dom::Element
* mElement
;
66 #endif // NS_SMILCSSPROPERTY_H_