Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / smil / nsSMILCSSProperty.h
blob8098e51f9a8f4c74eabd4fc0d33674f49c4b2b89
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"
13 #include "nsIAtom.h"
14 #include "nsCSSProperty.h"
15 #include "nsCSSValue.h"
17 namespace mozilla {
18 namespace dom {
19 class Element;
20 } // namespace dom
21 } // namespace mozilla
23 /**
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
30 public:
31 /**
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,
41 nsSMILValue& aValue,
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;
47 /**
48 * Utility method - returns true if the given property is supported for
49 * SMIL animation.
51 * @param aProperty The property to check for animation support.
52 * @return true if the given property is supported for SMIL animation, or
53 * false otherwise
55 static bool IsPropertyAnimatable(nsCSSProperty aPropID);
57 protected:
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
62 // that time.
63 mozilla::dom::Element* mElement;
66 #endif // NS_SMILCSSPROPERTY_H_