1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/smil/nsSMILCSSProperty.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,66 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* representation of a SMIL-animatable CSS property on an element */ 1.10 + 1.11 +#ifndef NS_SMILCSSPROPERTY_H_ 1.12 +#define NS_SMILCSSPROPERTY_H_ 1.13 + 1.14 +#include "mozilla/Attributes.h" 1.15 +#include "nsISMILAttr.h" 1.16 +#include "nsIAtom.h" 1.17 +#include "nsCSSProperty.h" 1.18 +#include "nsCSSValue.h" 1.19 + 1.20 +namespace mozilla { 1.21 +namespace dom { 1.22 +class Element; 1.23 +} // namespace dom 1.24 +} // namespace mozilla 1.25 + 1.26 +/** 1.27 + * nsSMILCSSProperty: Implements the nsISMILAttr interface for SMIL animations 1.28 + * that target CSS properties. Represents a particular animation-targeted CSS 1.29 + * property on a particular element. 1.30 + */ 1.31 +class nsSMILCSSProperty : public nsISMILAttr 1.32 +{ 1.33 +public: 1.34 + /** 1.35 + * Constructs a new nsSMILCSSProperty. 1.36 + * @param aPropID The CSS property we're interested in animating. 1.37 + * @param aElement The element whose CSS property is being animated. 1.38 + */ 1.39 + nsSMILCSSProperty(nsCSSProperty aPropID, mozilla::dom::Element* aElement); 1.40 + 1.41 + // nsISMILAttr methods 1.42 + virtual nsresult ValueFromString(const nsAString& aStr, 1.43 + const mozilla::dom::SVGAnimationElement* aSrcElement, 1.44 + nsSMILValue& aValue, 1.45 + bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; 1.46 + virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; 1.47 + virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; 1.48 + virtual void ClearAnimValue() MOZ_OVERRIDE; 1.49 + 1.50 + /** 1.51 + * Utility method - returns true if the given property is supported for 1.52 + * SMIL animation. 1.53 + * 1.54 + * @param aProperty The property to check for animation support. 1.55 + * @return true if the given property is supported for SMIL animation, or 1.56 + * false otherwise 1.57 + */ 1.58 + static bool IsPropertyAnimatable(nsCSSProperty aPropID); 1.59 + 1.60 +protected: 1.61 + nsCSSProperty mPropID; 1.62 + // Using non-refcounted pointer for mElement -- we know mElement will stay 1.63 + // alive for my lifetime because a nsISMILAttr (like me) only lives as long 1.64 + // as the Compositing step, and DOM elements don't get a chance to die during 1.65 + // that time. 1.66 + mozilla::dom::Element* mElement; 1.67 +}; 1.68 + 1.69 +#endif // NS_SMILCSSPROPERTY_H_