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

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

Issue 2390773004: reflow comments in core/svg/ (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 // Implementation of SVGAnimatedProperty which uses primitive types. 154 // Implementation of SVGAnimatedProperty which uses primitive types.
155 // This is for classes which return primitive type for its "animVal". 155 // This is for classes which return primitive type for its "animVal".
156 // Examples are SVGAnimatedBoolean, SVGAnimatedNumber, etc. 156 // Examples are SVGAnimatedBoolean, SVGAnimatedNumber, etc.
157 template <typename Property, 157 template <typename Property,
158 typename TearOffType = typename Property::TearOffType, 158 typename TearOffType = typename Property::TearOffType,
159 typename PrimitiveType = typename Property::PrimitiveType> 159 typename PrimitiveType = typename Property::PrimitiveType>
160 class SVGAnimatedProperty : public SVGAnimatedPropertyCommon<Property> { 160 class SVGAnimatedProperty : public SVGAnimatedPropertyCommon<Property> {
161 public: 161 public:
162 bool needsSynchronizeAttribute() override { 162 bool needsSynchronizeAttribute() override {
163 // DOM attribute synchronization is only needed if tear-off is being touched from javascript or the property is being animated. 163 // DOM attribute synchronization is only needed if tear-off is being touched
164 // This prevents unnecessary attribute creation on target element. 164 // from javascript or the property is being animated. This prevents
165 // unnecessary attribute creation on target element.
165 return m_baseValueUpdated || this->isAnimating(); 166 return m_baseValueUpdated || this->isAnimating();
166 } 167 }
167 168
168 void synchronizeAttribute() override { 169 void synchronizeAttribute() override {
169 SVGAnimatedPropertyBase::synchronizeAttribute(); 170 SVGAnimatedPropertyBase::synchronizeAttribute();
170 m_baseValueUpdated = false; 171 m_baseValueUpdated = false;
171 } 172 }
172 173
173 // SVGAnimated* DOM Spec implementations: 174 // SVGAnimated* DOM Spec implementations:
174 175
175 // baseVal()/setBaseVal()/animVal() are only to be used from SVG DOM implement ation. 176 // baseVal()/setBaseVal()/animVal() are only to be used from SVG DOM
176 // Use currentValue() from C++ code. 177 // implementation. Use currentValue() from C++ code.
177 PrimitiveType baseVal() { return this->baseValue()->value(); } 178 PrimitiveType baseVal() { return this->baseValue()->value(); }
178 179
179 void setBaseVal(PrimitiveType value, ExceptionState& exceptionState) { 180 void setBaseVal(PrimitiveType value, ExceptionState& exceptionState) {
180 if (this->isReadOnly()) { 181 if (this->isReadOnly()) {
181 exceptionState.throwDOMException(NoModificationAllowedError, 182 exceptionState.throwDOMException(NoModificationAllowedError,
182 "The attribute is read-only."); 183 "The attribute is read-only.");
183 return; 184 return;
184 } 185 }
185 186
186 this->baseValue()->setValue(value); 187 this->baseValue()->setValue(value);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 SVGAnimatedPropertyCommon<Property>::setAnimatedValue(value); 229 SVGAnimatedPropertyCommon<Property>::setAnimatedValue(value);
229 updateAnimValTearOffIfNeeded(); 230 updateAnimValTearOffIfNeeded();
230 } 231 }
231 232
232 void animationEnded() override { 233 void animationEnded() override {
233 SVGAnimatedPropertyCommon<Property>::animationEnded(); 234 SVGAnimatedPropertyCommon<Property>::animationEnded();
234 updateAnimValTearOffIfNeeded(); 235 updateAnimValTearOffIfNeeded();
235 } 236 }
236 237
237 bool needsSynchronizeAttribute() override { 238 bool needsSynchronizeAttribute() override {
238 // DOM attribute synchronization is only needed if tear-off is being touched from javascript or the property is being animated. 239 // DOM attribute synchronization is only needed if tear-off is being touched
239 // This prevents unnecessary attribute creation on target element. 240 // from javascript or the property is being animated. This prevents
241 // unnecessary attribute creation on target element.
240 return m_baseValTearOff || this->isAnimating(); 242 return m_baseValTearOff || this->isAnimating();
241 } 243 }
242 244
243 // SVGAnimated* DOM Spec implementations: 245 // SVGAnimated* DOM Spec implementations:
244 246
245 // baseVal()/animVal() are only to be used from SVG DOM implementation. 247 // baseVal()/animVal() are only to be used from SVG DOM implementation.
246 // Use currentValue() from C++ code. 248 // Use currentValue() from C++ code.
247 virtual TearOffType* baseVal() { 249 virtual TearOffType* baseVal() {
248 if (!m_baseValTearOff) { 250 if (!m_baseValTearOff) {
249 m_baseValTearOff = 251 m_baseValTearOff =
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 public: 305 public:
304 static SVGAnimatedProperty<Property>* create( 306 static SVGAnimatedProperty<Property>* create(
305 SVGElement* contextElement, 307 SVGElement* contextElement,
306 const QualifiedName& attributeName, 308 const QualifiedName& attributeName,
307 Property* initialValue) { 309 Property* initialValue) {
308 return new SVGAnimatedProperty<Property>(contextElement, attributeName, 310 return new SVGAnimatedProperty<Property>(contextElement, attributeName,
309 initialValue); 311 initialValue);
310 } 312 }
311 313
312 bool needsSynchronizeAttribute() override { 314 bool needsSynchronizeAttribute() override {
313 // DOM attribute synchronization is only needed if the property is being ani mated. 315 // DOM attribute synchronization is only needed if the property is being
316 // animated.
314 return this->isAnimating(); 317 return this->isAnimating();
315 } 318 }
316 319
317 protected: 320 protected:
318 SVGAnimatedProperty(SVGElement* contextElement, 321 SVGAnimatedProperty(SVGElement* contextElement,
319 const QualifiedName& attributeName, 322 const QualifiedName& attributeName,
320 Property* initialValue) 323 Property* initialValue)
321 : SVGAnimatedPropertyCommon<Property>(contextElement, 324 : SVGAnimatedPropertyCommon<Property>(contextElement,
322 attributeName, 325 attributeName,
323 initialValue) {} 326 initialValue) {}
324 }; 327 };
325 328
326 } // namespace blink 329 } // namespace blink
327 330
328 #endif // SVGAnimatedProperty_h 331 #endif // SVGAnimatedProperty_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698