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 mapped attribute on an element */ michael@0: michael@0: #ifndef NS_SMILMAPPEDATTRIBUTE_H_ michael@0: #define NS_SMILMAPPEDATTRIBUTE_H_ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsSMILCSSProperty.h" michael@0: michael@0: /* We'll use the empty-string atom |nsGkAtoms::_empty| as the key for storing michael@0: * an element's animated content style rule in its Property Table, under the michael@0: * property-category SMIL_MAPPED_ATTR_ANIMVAL. Everything else stored in that michael@0: * category is keyed off of the XML attribute name, so the empty string is a michael@0: * good "reserved" key to use for storing the style rule (since XML attributes michael@0: * all have nonempty names). michael@0: */ michael@0: #define SMIL_MAPPED_ATTR_STYLERULE_ATOM nsGkAtoms::_empty michael@0: michael@0: /** michael@0: * nsSMILMappedAttribute: Implements the nsISMILAttr interface for SMIL michael@0: * animations whose targets are attributes that map to CSS properties. An michael@0: * instance of this class represents a particular animation-targeted mapped michael@0: * attribute on a particular element. michael@0: */ michael@0: class nsSMILMappedAttribute : public nsSMILCSSProperty { michael@0: public: michael@0: /** michael@0: * Constructs a new nsSMILMappedAttribute. michael@0: * michael@0: * @param aPropID The CSS property for the mapped attribute we're michael@0: * interested in animating. michael@0: * @param aElement The element whose attribute is being animated. michael@0: */ michael@0: nsSMILMappedAttribute(nsCSSProperty aPropID, mozilla::dom::Element* aElement) : michael@0: nsSMILCSSProperty(aPropID, 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: protected: michael@0: // Helper Methods michael@0: void FlushChangesToTargetAttr() const; michael@0: already_AddRefed GetAttrNameAtom() const; michael@0: }; michael@0: #endif // NS_SMILMAPPEDATTRIBUTE_H_