Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Side by Side Diff: Source/core/svg/properties/SVGAnimatedPropertyMacros.h

Issue 180243018: Remove SVGAnimatedProperty::animatedPropertyCache (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/svg/properties/SVGAnimatedProperty.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 typedef OwnerType UseOwnerType; 84 typedef OwnerType UseOwnerType;
85 85
86 #define REGISTER_LOCAL_ANIMATED_PROPERTY(LowerProperty) \ 86 #define REGISTER_LOCAL_ANIMATED_PROPERTY(LowerProperty) \
87 map.addProperty(UseOwnerType::LowerProperty##PropertyInfo()); 87 map.addProperty(UseOwnerType::LowerProperty##PropertyInfo());
88 88
89 #define REGISTER_PARENT_ANIMATED_PROPERTIES(ClassName) \ 89 #define REGISTER_PARENT_ANIMATED_PROPERTIES(ClassName) \
90 map.addProperties(ClassName::attributeToPropertyMap()); \ 90 map.addProperties(ClassName::attributeToPropertyMap()); \
91 91
92 #define END_REGISTER_ANIMATED_PROPERTIES } 92 #define END_REGISTER_ANIMATED_PROPERTIES }
93 93
94 // Property definition helpers (used in SVG*.cpp files)
95 #define DEFINE_ANIMATED_PROPERTY(AnimatedPropertyTypeEnum, OwnerType, DOMAttribu te, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty, TearOffType, Proper tyType) \
96 const SVGPropertyInfo* OwnerType::LowerProperty##PropertyInfo() { \
97 DEFINE_STATIC_LOCAL(const SVGPropertyInfo, s_propertyInfo, \
98 (AnimatedPropertyTypeEnum, \
99 PropertyIsReadWrite, \
100 DOMAttribute, \
101 SVGDOMAttributeIdentifier, \
102 &OwnerType::synchronize##UpperProperty, \
103 &OwnerType::lookupOrCreate##UpperProperty##Wrapper)); \
104 return &s_propertyInfo; \
105 } \
106 bool OwnerType::LowerProperty##Specified() const \
107 { \
108 if (TearOffType* wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) { \
109 if (wrapper->isAnimating()) \
110 return true; \
111 } \
112 return hasAttribute(SVGDOMAttributeIdentifier); \
113 } \
114 PropertyType& OwnerType::LowerProperty##CurrentValue() const \
115 { \
116 if (TearOffType* wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) { \
117 if (wrapper->isAnimating()) \
118 return wrapper->currentAnimatedValue(); \
119 } \
120 return m_##LowerProperty.value; \
121 } \
122 \
123 PropertyType& OwnerType::LowerProperty##BaseValue() const \
124 { \
125 return m_##LowerProperty.value; \
126 } \
127 \
128 void OwnerType::set##UpperProperty##BaseValue(const PropertyType& type) \
129 { \
130 m_##LowerProperty.value = type; \
131 } \
132 \
133 PassRefPtr<TearOffType> OwnerType::LowerProperty() \
134 { \
135 m_##LowerProperty.shouldSynchronize = true; \
136 return static_pointer_cast<TearOffType>(lookupOrCreate##UpperProperty##Wrapp er(this)); \
137 } \
138 \
139 void OwnerType::synchronize##UpperProperty() \
140 { \
141 if (!m_##LowerProperty.shouldSynchronize) \
142 return; \
143 AtomicString value(SVGPropertyTraits<PropertyType>::toString(m_##LowerProper ty.value)); \
144 m_##LowerProperty.synchronize(this, LowerProperty##PropertyInfo()->attribute Name, value); \
145 } \
146 \
147 PassRefPtr<SVGAnimatedProperty> OwnerType::lookupOrCreate##UpperProperty##Wrappe r(SVGElement* maskedOwnerType) \
148 { \
149 ASSERT(maskedOwnerType); \
150 UseOwnerType* ownerType = static_cast<UseOwnerType*>(maskedOwnerType); \
151 return SVGAnimatedProperty::lookupOrCreateWrapper<UseOwnerType, TearOffType, PropertyType>(ownerType, LowerProperty##PropertyInfo(), ownerType->m_##LowerPro perty.value); \
152 } \
153 \
154 void OwnerType::synchronize##UpperProperty(SVGElement* maskedOwnerType) \
155 { \
156 ASSERT(maskedOwnerType); \
157 UseOwnerType* ownerType = static_cast<UseOwnerType*>(maskedOwnerType); \
158 ownerType->synchronize##UpperProperty(); \
159 }
160
161 // Property declaration helpers (used in SVG*.h files) 94 // Property declaration helpers (used in SVG*.h files)
162 #define BEGIN_DECLARE_ANIMATED_PROPERTIES(OwnerType) \ 95 #define BEGIN_DECLARE_ANIMATED_PROPERTIES(OwnerType) \
163 public: \ 96 public: \
164 static SVGAttributeToPropertyMap& attributeToPropertyMap(); \ 97 static SVGAttributeToPropertyMap& attributeToPropertyMap(); \
165 virtual SVGAttributeToPropertyMap& localAttributeToPropertyMap() const; \ 98 virtual SVGAttributeToPropertyMap& localAttributeToPropertyMap() const; \
166 void registerAnimatedPropertiesFor##OwnerType(); \ 99 void registerAnimatedPropertiesFor##OwnerType(); \
167 typedef OwnerType UseOwnerType; 100 typedef OwnerType UseOwnerType;
168 101
169 #define DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, Lowe rProperty) \ 102 #define DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, Lowe rProperty) \
170 public: \ 103 public: \
171 static const SVGPropertyInfo* LowerProperty##PropertyInfo(); \ 104 static const SVGPropertyInfo* LowerProperty##PropertyInfo(); \
172 bool LowerProperty##Specified() const; \ 105 bool LowerProperty##Specified() const; \
173 PropertyType& LowerProperty##CurrentValue() const; \ 106 PropertyType& LowerProperty##CurrentValue() const; \
174 PropertyType& LowerProperty##BaseValue() const; \ 107 PropertyType& LowerProperty##BaseValue() const; \
175 void set##UpperProperty##BaseValue(const PropertyType& type); \ 108 void set##UpperProperty##BaseValue(const PropertyType& type); \
176 PassRefPtr<TearOffType> LowerProperty(); \ 109 PassRefPtr<TearOffType> LowerProperty(); \
177 \ 110 \
178 private: \ 111 private: \
179 void synchronize##UpperProperty(); \ 112 void synchronize##UpperProperty(); \
180 static PassRefPtr<SVGAnimatedProperty> lookupOrCreate##UpperProperty##Wrappe r(SVGElement* maskedOwnerType); \ 113 static PassRefPtr<SVGAnimatedProperty> lookupOrCreate##UpperProperty##Wrappe r(SVGElement* maskedOwnerType); \
181 static void synchronize##UpperProperty(SVGElement* maskedOwnerType); \ 114 static void synchronize##UpperProperty(SVGElement* maskedOwnerType); \
182 \ 115 \
183 mutable SVGSynchronizableAnimatedProperty<PropertyType> m_##LowerProperty; 116 mutable SVGSynchronizableAnimatedProperty<PropertyType> m_##LowerProperty;
184 117
185 #define END_DECLARE_ANIMATED_PROPERTIES \ 118 #define END_DECLARE_ANIMATED_PROPERTIES \
186 CleanUpAnimatedPropertiesCaller m_cleanupAnimatedPropertiesCaller; 119 CleanUpAnimatedPropertiesCaller m_cleanupAnimatedPropertiesCaller;
187 120
188 // List specific definition/declaration helpers
189 #define DECLARE_ANIMATED_LIST_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty) \
190 DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerPropert y) \
191 void detachAnimated##UpperProperty##ListWrappers(unsigned newListSize) \
192 { \
193 if (TearOffType* wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, TearOffType>(this, LowerProperty##PropertyInfo())) \
194 wrapper->detachListWrappers(newListSize); \
195 }
196
197 } 121 }
198 122
199 #endif // SVGAnimatedPropertyMacros_h 123 #endif // SVGAnimatedPropertyMacros_h
OLDNEW
« no previous file with comments | « Source/core/svg/properties/SVGAnimatedProperty.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698