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

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

Issue 1212253012: Fix virtual/override/final usage in Source/core/svg/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 G* * Redistributions in binary form must reproduce the above 10 G* * Redistributions in binary form must reproduce the above
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 Property* currentValue() 119 Property* currentValue()
120 { 120 {
121 return m_currentValue ? m_currentValue.get() : m_baseValue.get(); 121 return m_currentValue ? m_currentValue.get() : m_baseValue.get();
122 } 122 }
123 123
124 const Property* currentValue() const 124 const Property* currentValue() const
125 { 125 {
126 return const_cast<SVGAnimatedPropertyCommon*>(this)->currentValue(); 126 return const_cast<SVGAnimatedPropertyCommon*>(this)->currentValue();
127 } 127 }
128 128
129 virtual SVGPropertyBase* currentValueBase() override 129 SVGPropertyBase* currentValueBase() override
130 { 130 {
131 return currentValue(); 131 return currentValue();
132 } 132 }
133 133
134 virtual bool isAnimating() const override 134 bool isAnimating() const override
135 { 135 {
136 return m_currentValue; 136 return m_currentValue;
137 } 137 }
138 138
139 void setBaseValueAsString(const String& value, SVGParsingError& parseError) override 139 void setBaseValueAsString(const String& value, SVGParsingError& parseError) override
140 { 140 {
141 TrackExceptionState es; 141 TrackExceptionState es;
142 142
143 m_baseValue->setValueAsString(value, es); 143 m_baseValue->setValueAsString(value, es);
144 144
145 if (es.hadException()) 145 if (es.hadException())
146 parseError = ParsingAttributeFailedError; 146 parseError = ParsingAttributeFailedError;
147 } 147 }
148 148
149 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> createAnimatedValue() overri de 149 PassRefPtrWillBeRawPtr<SVGPropertyBase> createAnimatedValue() override
150 { 150 {
151 return m_baseValue->clone(); 151 return m_baseValue->clone();
152 } 152 }
153 153
154 virtual void setAnimatedValue(PassRefPtrWillBeRawPtr<SVGPropertyBase> passVa lue) override 154 void setAnimatedValue(PassRefPtrWillBeRawPtr<SVGPropertyBase> passValue) ove rride
155 { 155 {
156 RefPtrWillBeRawPtr<SVGPropertyBase> value = passValue; 156 RefPtrWillBeRawPtr<SVGPropertyBase> value = passValue;
157 ASSERT(value->type() == Property::classType()); 157 ASSERT(value->type() == Property::classType());
158 m_currentValue = static_pointer_cast<Property>(value.release()); 158 m_currentValue = static_pointer_cast<Property>(value.release());
159 } 159 }
160 160
161 virtual void animationEnded() override 161 void animationEnded() override
162 { 162 {
163 m_currentValue.clear(); 163 m_currentValue.clear();
164 164
165 SVGAnimatedPropertyBase::animationEnded(); 165 SVGAnimatedPropertyBase::animationEnded();
166 } 166 }
167 167
168 DEFINE_INLINE_VIRTUAL_TRACE() 168 DEFINE_INLINE_VIRTUAL_TRACE()
169 { 169 {
170 visitor->trace(m_baseValue); 170 visitor->trace(m_baseValue);
171 visitor->trace(m_currentValue); 171 visitor->trace(m_currentValue);
(...skipping 11 matching lines...) Expand all
183 RefPtrWillBeMember<Property> m_baseValue; 183 RefPtrWillBeMember<Property> m_baseValue;
184 RefPtrWillBeMember<Property> m_currentValue; 184 RefPtrWillBeMember<Property> m_currentValue;
185 }; 185 };
186 186
187 // Implementation of SVGAnimatedProperty which uses primitive types. 187 // Implementation of SVGAnimatedProperty which uses primitive types.
188 // This is for classes which return primitive type for its "animVal". 188 // This is for classes which return primitive type for its "animVal".
189 // Examples are SVGAnimatedBoolean, SVGAnimatedNumber, etc. 189 // Examples are SVGAnimatedBoolean, SVGAnimatedNumber, etc.
190 template <typename Property, typename TearOffType = typename Property::TearOffTy pe, typename PrimitiveType = typename Property::PrimitiveType> 190 template <typename Property, typename TearOffType = typename Property::TearOffTy pe, typename PrimitiveType = typename Property::PrimitiveType>
191 class SVGAnimatedProperty : public SVGAnimatedPropertyCommon<Property> { 191 class SVGAnimatedProperty : public SVGAnimatedPropertyCommon<Property> {
192 public: 192 public:
193 virtual bool needsSynchronizeAttribute() override 193 bool needsSynchronizeAttribute() override
194 { 194 {
195 // DOM attribute synchronization is only needed if tear-off is being tou ched from javascript or the property is being animated. 195 // DOM attribute synchronization is only needed if tear-off is being tou ched from javascript or the property is being animated.
196 // This prevents unnecessary attribute creation on target element. 196 // This prevents unnecessary attribute creation on target element.
197 return m_baseValueUpdated || this->isAnimating(); 197 return m_baseValueUpdated || this->isAnimating();
198 } 198 }
199 199
200 virtual void synchronizeAttribute() override 200 void synchronizeAttribute() override
201 { 201 {
202 SVGAnimatedPropertyBase::synchronizeAttribute(); 202 SVGAnimatedPropertyBase::synchronizeAttribute();
203 m_baseValueUpdated = false; 203 m_baseValueUpdated = false;
204 } 204 }
205 205
206 // SVGAnimated* DOM Spec implementations: 206 // SVGAnimated* DOM Spec implementations:
207 207
208 // baseVal()/setBaseVal()/animVal() are only to be used from SVG DOM impleme ntation. 208 // baseVal()/setBaseVal()/animVal() are only to be used from SVG DOM impleme ntation.
209 // Use currentValue() from C++ code. 209 // Use currentValue() from C++ code.
210 PrimitiveType baseVal() 210 PrimitiveType baseVal()
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // This is for classes which return special type for its "animVal". 247 // This is for classes which return special type for its "animVal".
248 // Examples are SVGAnimatedLength, SVGAnimatedRect, SVGAnimated*List, etc. 248 // Examples are SVGAnimatedLength, SVGAnimatedRect, SVGAnimated*List, etc.
249 template <typename Property, typename TearOffType> 249 template <typename Property, typename TearOffType>
250 class SVGAnimatedProperty<Property, TearOffType, void> : public SVGAnimatedPrope rtyCommon<Property> { 250 class SVGAnimatedProperty<Property, TearOffType, void> : public SVGAnimatedPrope rtyCommon<Property> {
251 public: 251 public:
252 static PassRefPtrWillBeRawPtr<SVGAnimatedProperty<Property>> create(SVGEleme nt* contextElement, const QualifiedName& attributeName, PassRefPtrWillBeRawPtr<P roperty> initialValue) 252 static PassRefPtrWillBeRawPtr<SVGAnimatedProperty<Property>> create(SVGEleme nt* contextElement, const QualifiedName& attributeName, PassRefPtrWillBeRawPtr<P roperty> initialValue)
253 { 253 {
254 return adoptRefWillBeNoop(new SVGAnimatedProperty<Property>(contextEleme nt, attributeName, initialValue)); 254 return adoptRefWillBeNoop(new SVGAnimatedProperty<Property>(contextEleme nt, attributeName, initialValue));
255 } 255 }
256 256
257 virtual void setAnimatedValue(PassRefPtrWillBeRawPtr<SVGPropertyBase> value) override 257 void setAnimatedValue(PassRefPtrWillBeRawPtr<SVGPropertyBase> value) overrid e
258 { 258 {
259 SVGAnimatedPropertyCommon<Property>::setAnimatedValue(value); 259 SVGAnimatedPropertyCommon<Property>::setAnimatedValue(value);
260 updateAnimValTearOffIfNeeded(); 260 updateAnimValTearOffIfNeeded();
261 } 261 }
262 262
263 virtual void animationEnded() override 263 void animationEnded() override
264 { 264 {
265 SVGAnimatedPropertyCommon<Property>::animationEnded(); 265 SVGAnimatedPropertyCommon<Property>::animationEnded();
266 updateAnimValTearOffIfNeeded(); 266 updateAnimValTearOffIfNeeded();
267 } 267 }
268 268
269 virtual bool needsSynchronizeAttribute() override 269 bool needsSynchronizeAttribute() override
270 { 270 {
271 // DOM attribute synchronization is only needed if tear-off is being tou ched from javascript or the property is being animated. 271 // DOM attribute synchronization is only needed if tear-off is being tou ched from javascript or the property is being animated.
272 // This prevents unnecessary attribute creation on target element. 272 // This prevents unnecessary attribute creation on target element.
273 return m_baseValTearOff || this->isAnimating(); 273 return m_baseValTearOff || this->isAnimating();
274 } 274 }
275 275
276 // SVGAnimated* DOM Spec implementations: 276 // SVGAnimated* DOM Spec implementations:
277 277
278 // baseVal()/animVal() are only to be used from SVG DOM implementation. 278 // baseVal()/animVal() are only to be used from SVG DOM implementation.
279 // Use currentValue() from C++ code. 279 // Use currentValue() from C++ code.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // When animated: 321 // When animated:
322 // m_animValTearOff targets m_currentValue. 322 // m_animValTearOff targets m_currentValue.
323 // m_baseValTearOff targets m_baseValue. 323 // m_baseValTearOff targets m_baseValue.
324 RefPtrWillBeMember<TearOffType> m_baseValTearOff; 324 RefPtrWillBeMember<TearOffType> m_baseValTearOff;
325 RefPtrWillBeMember<TearOffType> m_animValTearOff; 325 RefPtrWillBeMember<TearOffType> m_animValTearOff;
326 }; 326 };
327 327
328 } // namespace blink 328 } // namespace blink
329 329
330 #endif // SVGAnimatedProperty_h 330 #endif // SVGAnimatedProperty_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698