|
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/. */ |
|
5 |
|
6 /* representation of a SMIL-animatable mapped attribute on an element */ |
|
7 |
|
8 #ifndef NS_SMILMAPPEDATTRIBUTE_H_ |
|
9 #define NS_SMILMAPPEDATTRIBUTE_H_ |
|
10 |
|
11 #include "mozilla/Attributes.h" |
|
12 #include "nsSMILCSSProperty.h" |
|
13 |
|
14 /* We'll use the empty-string atom |nsGkAtoms::_empty| as the key for storing |
|
15 * an element's animated content style rule in its Property Table, under the |
|
16 * property-category SMIL_MAPPED_ATTR_ANIMVAL. Everything else stored in that |
|
17 * category is keyed off of the XML attribute name, so the empty string is a |
|
18 * good "reserved" key to use for storing the style rule (since XML attributes |
|
19 * all have nonempty names). |
|
20 */ |
|
21 #define SMIL_MAPPED_ATTR_STYLERULE_ATOM nsGkAtoms::_empty |
|
22 |
|
23 /** |
|
24 * nsSMILMappedAttribute: Implements the nsISMILAttr interface for SMIL |
|
25 * animations whose targets are attributes that map to CSS properties. An |
|
26 * instance of this class represents a particular animation-targeted mapped |
|
27 * attribute on a particular element. |
|
28 */ |
|
29 class nsSMILMappedAttribute : public nsSMILCSSProperty { |
|
30 public: |
|
31 /** |
|
32 * Constructs a new nsSMILMappedAttribute. |
|
33 * |
|
34 * @param aPropID The CSS property for the mapped attribute we're |
|
35 * interested in animating. |
|
36 * @param aElement The element whose attribute is being animated. |
|
37 */ |
|
38 nsSMILMappedAttribute(nsCSSProperty aPropID, mozilla::dom::Element* aElement) : |
|
39 nsSMILCSSProperty(aPropID, aElement) {} |
|
40 |
|
41 // nsISMILAttr methods |
|
42 virtual nsresult ValueFromString(const nsAString& aStr, |
|
43 const mozilla::dom::SVGAnimationElement* aSrcElement, |
|
44 nsSMILValue& aValue, |
|
45 bool& aPreventCachingOfSandwich) const MOZ_OVERRIDE; |
|
46 virtual nsSMILValue GetBaseValue() const MOZ_OVERRIDE; |
|
47 virtual nsresult SetAnimValue(const nsSMILValue& aValue) MOZ_OVERRIDE; |
|
48 virtual void ClearAnimValue() MOZ_OVERRIDE; |
|
49 |
|
50 protected: |
|
51 // Helper Methods |
|
52 void FlushChangesToTargetAttr() const; |
|
53 already_AddRefed<nsIAtom> GetAttrNameAtom() const; |
|
54 }; |
|
55 #endif // NS_SMILMAPPEDATTRIBUTE_H_ |