OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 void commitChange(); | 42 void commitChange(); |
43 | 43 |
44 virtual bool isAnimatedListTearOff() const { return false; } | 44 virtual bool isAnimatedListTearOff() const { return false; } |
45 | 45 |
46 // Caching facilities. | 46 // Caching facilities. |
47 typedef HashMap<SVGAnimatedPropertyDescription, RefPtr<SVGAnimatedProperty>,
SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> C
ache; | 47 typedef HashMap<SVGAnimatedPropertyDescription, RefPtr<SVGAnimatedProperty>,
SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> C
ache; |
48 | 48 |
49 virtual ~SVGAnimatedProperty(); | 49 virtual ~SVGAnimatedProperty(); |
50 | 50 |
51 template<typename OwnerType, typename TearOffType, typename PropertyType> | |
52 static PassRefPtr<TearOffType> lookupOrCreateWrapper(OwnerType* element, con
st SVGPropertyInfo* info, PropertyType& property) | |
53 { | |
54 ASSERT(info); | |
55 SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); | |
56 RefPtr<SVGAnimatedProperty> wrapper = animatedPropertyCache()->get(key); | |
57 if (!wrapper) { | |
58 wrapper = TearOffType::create(element, info->attributeName, info->an
imatedPropertyType, property); | |
59 if (info->animatedPropertyState == PropertyIsReadOnly) | |
60 wrapper->setIsReadOnly(); | |
61 animatedPropertyCache()->set(key, wrapper); | |
62 } | |
63 return static_pointer_cast<TearOffType>(wrapper); | |
64 } | |
65 | |
66 template<typename OwnerType, typename TearOffType> | |
67 static TearOffType* lookupWrapper(OwnerType* element, const SVGPropertyInfo*
info) | |
68 { | |
69 ASSERT(info); | |
70 SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); | |
71 return static_cast<TearOffType*>(animatedPropertyCache()->get(key)); | |
72 } | |
73 | |
74 template<typename OwnerType, typename TearOffType> | |
75 static TearOffType* lookupWrapper(const OwnerType* element, const SVGPropert
yInfo* info) | |
76 { | |
77 return lookupWrapper<OwnerType, TearOffType>(const_cast<OwnerType*>(elem
ent), info); | |
78 } | |
79 | |
80 static void detachAnimatedPropertiesForElement(SVGElement*); | |
81 | |
82 protected: | 51 protected: |
83 SVGAnimatedProperty(SVGElement*, const QualifiedName&, AnimatedPropertyType)
; | 52 SVGAnimatedProperty(SVGElement*, const QualifiedName&, AnimatedPropertyType)
; |
84 | 53 |
85 private: | 54 private: |
86 static Cache* animatedPropertyCache(); | |
87 | |
88 SVGElement* m_contextElement; | 55 SVGElement* m_contextElement; |
89 const QualifiedName& m_attributeName; | 56 const QualifiedName& m_attributeName; |
90 AnimatedPropertyType m_animatedPropertyType; | 57 AnimatedPropertyType m_animatedPropertyType; |
91 | 58 |
92 protected: | 59 protected: |
93 bool m_isAnimating; | 60 bool m_isAnimating; |
94 bool m_isReadOnly; | 61 bool m_isReadOnly; |
95 }; | 62 }; |
96 | 63 |
97 } | 64 } |
98 | 65 |
99 #endif // SVGAnimatedProperty_h | 66 #endif // SVGAnimatedProperty_h |
OLD | NEW |