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: /* representation of a SMIL-animatable CSS property on an element */ michael@0: michael@0: #ifndef NS_SMILCSSPROPERTY_H_ michael@0: #define NS_SMILCSSPROPERTY_H_ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsISMILAttr.h" michael@0: #include "nsIAtom.h" michael@0: #include "nsCSSProperty.h" michael@0: #include "nsCSSValue.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: class Element; michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: /** michael@0: * nsSMILCSSProperty: Implements the nsISMILAttr interface for SMIL animations michael@0: * that target CSS properties. Represents a particular animation-targeted CSS michael@0: * property on a particular element. michael@0: */ michael@0: class nsSMILCSSProperty : public nsISMILAttr michael@0: { michael@0: public: michael@0: /** michael@0: * Constructs a new nsSMILCSSProperty. michael@0: * @param aPropID The CSS property we're interested in animating. michael@0: * @param aElement The element whose CSS property is being animated. michael@0: */ michael@0: nsSMILCSSProperty(nsCSSProperty aPropID, mozilla::dom::Element* aElement); michael@0: michael@0: // nsISMILAttr methods michael@0: virtual nsresult ValueFromString(const nsAString& aStr, michael@0: const mozilla::dom::SVGAnimationElement* aSrcElement, michael@0: nsSMILValue& aValue, michael@0: bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; michael@0: virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; michael@0: virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; michael@0: virtual void ClearAnimValue() MOZ_OVERRIDE; michael@0: michael@0: /** michael@0: * Utility method - returns true if the given property is supported for michael@0: * SMIL animation. michael@0: * michael@0: * @param aProperty The property to check for animation support. michael@0: * @return true if the given property is supported for SMIL animation, or michael@0: * false otherwise michael@0: */ michael@0: static bool IsPropertyAnimatable(nsCSSProperty aPropID); michael@0: michael@0: protected: michael@0: nsCSSProperty mPropID; michael@0: // Using non-refcounted pointer for mElement -- we know mElement will stay michael@0: // alive for my lifetime because a nsISMILAttr (like me) only lives as long michael@0: // as the Compositing step, and DOM elements don't get a chance to die during michael@0: // that time. michael@0: mozilla::dom::Element* mElement; michael@0: }; michael@0: michael@0: #endif // NS_SMILCSSPROPERTY_H_