2010-03-16 23:17:33 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-03-16 23:17:33 +00:00
|
|
|
|
|
|
|
/* representation of a SMIL-animatable mapped attribute on an element */
|
|
|
|
|
|
|
|
#ifndef NS_SMILMAPPEDATTRIBUTE_H_
|
|
|
|
#define NS_SMILMAPPEDATTRIBUTE_H_
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2010-03-16 23:17:33 +00:00
|
|
|
#include "nsSMILCSSProperty.h"
|
|
|
|
|
|
|
|
/* We'll use the empty-string atom |nsGkAtoms::_empty| as the key for storing
|
|
|
|
* an element's animated content style rule in its Property Table, under the
|
|
|
|
* property-category SMIL_MAPPED_ATTR_ANIMVAL. Everything else stored in that
|
|
|
|
* category is keyed off of the XML attribute name, so the empty string is a
|
|
|
|
* good "reserved" key to use for storing the style rule (since XML attributes
|
|
|
|
* all have nonempty names).
|
|
|
|
*/
|
|
|
|
#define SMIL_MAPPED_ATTR_STYLERULE_ATOM nsGkAtoms::_empty
|
|
|
|
|
|
|
|
/**
|
|
|
|
* nsSMILMappedAttribute: Implements the nsISMILAttr interface for SMIL
|
|
|
|
* animations whose targets are attributes that map to CSS properties. An
|
|
|
|
* instance of this class represents a particular animation-targeted mapped
|
|
|
|
* attribute on a particular element.
|
|
|
|
*/
|
|
|
|
class nsSMILMappedAttribute : public nsSMILCSSProperty {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Constructs a new nsSMILMappedAttribute.
|
|
|
|
*
|
|
|
|
* @param aPropID The CSS property for the mapped attribute we're
|
|
|
|
* interested in animating.
|
|
|
|
* @param aElement The element whose attribute is being animated.
|
|
|
|
*/
|
2010-05-14 17:04:51 +00:00
|
|
|
nsSMILMappedAttribute(nsCSSProperty aPropID, mozilla::dom::Element* aElement) :
|
2010-03-16 23:17:33 +00:00
|
|
|
nsSMILCSSProperty(aPropID, aElement) {}
|
|
|
|
|
|
|
|
// nsISMILAttr methods
|
2010-04-02 16:34:31 +00:00
|
|
|
virtual nsresult ValueFromString(const nsAString& aStr,
|
2013-03-19 03:18:45 +00:00
|
|
|
const mozilla::dom::SVGAnimationElement* aSrcElement,
|
2010-04-02 16:34:31 +00:00
|
|
|
nsSMILValue& aValue,
|
2013-05-29 20:43:41 +00:00
|
|
|
bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE;
|
|
|
|
virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE;
|
|
|
|
virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE;
|
|
|
|
virtual void ClearAnimValue() MOZ_OVERRIDE;
|
2010-03-16 23:17:33 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// Helper Methods
|
|
|
|
void FlushChangesToTargetAttr() const;
|
|
|
|
already_AddRefed<nsIAtom> GetAttrNameAtom() const;
|
|
|
|
};
|
|
|
|
#endif // NS_SMILMAPPEDATTRIBUTE_H_
|