Changeset 49745 in webkit
- Timestamp:
- Oct 17, 2009 3:52:54 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49743 r49745 1 2009-10-17 Nikolas Zimmermann <nzimmermann@rim.com> 2 3 Reviewed by George Staikos. 4 5 Cleanup SVGElement code, preparing for animVal support 6 https://bugs.webkit.org/show_bug.cgi?id=30466 7 8 Add new SynchronizablePropertyController and move the code for SVG property <-> XML attribute synchronization 9 from SVGElement. This is a further preparation for animVal support, where SynchronizablePropertyController will 10 be used to control the start/end state of an animated property. 11 12 We're currently tracking animated properties that need synchronization, generalize this concept and use 13 it to track their creation (bound to certain SVG*Element classes) as well as a flag determing the need 14 of synchronization (no SVG DOM object wrappers, no synchronization needed). 15 16 No change in functionality, thus no tests. 17 18 * GNUmakefile.am: Add 'SynchronizablePropertyController.cpp/h' to build 19 * WebCore.gypi: Ditto. 20 * WebCore.pro: Ditto. 21 * WebCore.vcproj/WebCore.vcproj: Ditto. 22 * WebCore.xcodeproj/project.pbxproj: Ditto. 23 * svg/SVGAllInOne.cpp: Ditto. 24 * svg/SVGAnimatedProperty.h: Add registerProperty() function 25 (WebCore::::SVGAnimatedProperty): Call registerProperty() function 26 (WebCore::::registerProperty): Add new registerProperty() function, announcing new properties to SynchronizablePropertyController. 27 * svg/SVGAnimatedTemplate.h: Use propertyController() method, to access the new functions moved from SVGElement. 28 (WebCore::lookupOrCreateWrapper): 29 * svg/SVGElement.cpp: Adapt to code moving to SynchronizablePropertyController. 30 (WebCore::SVGElement::updateAnimatedSVGAttribute): 31 * svg/SVGElement.h: Move handling SVG property synchronization to SynchronizablePropertyController. 32 (WebCore::SVGElement::propertyController): Expose reference to SynchronizablePropertyController object. 33 * svg/SVGViewSpec.cpp: Reorder initialization order of contextElement, leading to possible crashes. 34 (WebCore::SVGViewSpec::SVGViewSpec): 35 (WebCore::SVGViewSpec::viewTarget): 36 * svg/SVGViewSpec.h: Ditto. 37 (WebCore::SVGViewSpec::contextElement): 38 * svg/SynchronizablePropertyController.cpp: Added. 39 (WebCore::SynchronizablePropertyController::SynchronizablePropertyController): 40 (WebCore::SynchronizablePropertyController::registerProperty): 41 (WebCore::SynchronizablePropertyController::setPropertyNeedsSynchronization): 42 (WebCore::SynchronizablePropertyController::synchronizeProperty): 43 (WebCore::SynchronizablePropertyController::synchronizeAllProperties): 44 (WebCore::SynchronizablePropertyController::startAnimation): 45 (WebCore::SynchronizablePropertyController::stopAnimation): 46 * svg/SynchronizablePropertyController.h: Added. 47 (WebCore::SynchronizableProperty::SynchronizableProperty): 48 (WebCore::SynchronizableProperty::isHashTableDeletedValue): 49 (WebCore::SynchronizableProperty::operator==): 50 (WebCore::SynchronizablePropertyHash::hash): 51 (WebCore::SynchronizablePropertyHash::equal): 52 (WebCore::SynchronizablePropertyHashTraits::constructDeletedValue): 53 (WebCore::SynchronizablePropertyHashTraits::isDeletedValue): 54 1 55 2009-10-17 Joanmarie Diggs <joanmarie.diggs@gmail.com> 2 56 -
trunk/WebCore/GNUmakefile.am
r49739 r49745 3155 3155 WebCore/svg/SVGZoomEvent.cpp \ 3156 3156 WebCore/svg/SVGZoomEvent.h \ 3157 WebCore/svg/SynchronizablePropertyController.cpp \ 3158 WebCore/svg/SynchronizablePropertyController.h \ 3157 3159 WebCore/svg/SynchronizableTypeWrapper.h \ 3158 3160 WebCore/svg/animation/SMILTime.cpp \ -
trunk/WebCore/WebCore.gypi
r49723 r49745 3480 3480 'svg/SVGZoomEvent.cpp', 3481 3481 'svg/SVGZoomEvent.h', 3482 'svg/SynchronizablePropertyController.cpp', 3483 'svg/SynchronizablePropertyController.h', 3482 3484 'svg/SynchronizableTypeWrapper.h', 3483 3485 'websockets/WebSocket.cpp', -
trunk/WebCore/WebCore.pro
r49738 r49745 2254 2254 svg/SVGZoomAndPan.h \ 2255 2255 svg/SVGZoomEvent.h \ 2256 svg/SynchronizablePropertyController.h \ 2256 2257 wml/WMLAccessElement.h \ 2257 2258 wml/WMLAElement.h \ … … 3009 3010 svg/SVGViewSpec.cpp \ 3010 3011 svg/SVGZoomAndPan.cpp \ 3012 svg/SynchronizablePropertyController.cpp \ 3011 3013 svg/animation/SMILTime.cpp \ 3012 3014 svg/animation/SMILTimeContainer.cpp \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r49723 r49745 34271 34271 > 34272 34272 </File> 34273 <File 34274 RelativePath="..\svg\SynchronizablePropertyController.h" 34275 > 34276 </File> 34273 34277 <Filter 34274 34278 Name="animation" -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r49723 r49745 91 91 08744BAA0EDB7D86004C9E63 /* WMLOnEventElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08744BA90EDB7D86004C9E63 /* WMLOnEventElement.cpp */; }; 92 92 08744BAE0EDB7D92004C9E63 /* WMLOnEventElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08744BAD0EDB7D92004C9E63 /* WMLOnEventElement.h */; }; 93 0878B1FD10874E3F00A55097 /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */; }; 94 0878B1FE10874E3F00A55097 /* SynchronizablePropertyController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0878B1FA10874E3F00A55097 /* SynchronizablePropertyController.cpp */; }; 95 0878B1FF10874E3F00A55097 /* SynchronizablePropertyController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FB10874E3F00A55097 /* SynchronizablePropertyController.h */; }; 96 0878B20010874E3F00A55097 /* SynchronizableTypeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FC10874E3F00A55097 /* SynchronizableTypeWrapper.h */; }; 93 97 087FFA0F0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 087FFA0D0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp */; }; 94 98 087FFA100EFF3ED3009DBD88 /* WMLInsertedLegendElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 087FFA0E0EFF3ED3009DBD88 /* WMLInsertedLegendElement.h */; }; … … 5251 5255 08744BA90EDB7D86004C9E63 /* WMLOnEventElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLOnEventElement.cpp; sourceTree = "<group>"; }; 5252 5256 08744BAD0EDB7D92004C9E63 /* WMLOnEventElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLOnEventElement.h; sourceTree = "<group>"; }; 5257 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedProperty.h; sourceTree = "<group>"; }; 5258 0878B1FA10874E3F00A55097 /* SynchronizablePropertyController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronizablePropertyController.cpp; sourceTree = "<group>"; }; 5259 0878B1FB10874E3F00A55097 /* SynchronizablePropertyController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SynchronizablePropertyController.h; sourceTree = "<group>"; }; 5260 0878B1FC10874E3F00A55097 /* SynchronizableTypeWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SynchronizableTypeWrapper.h; sourceTree = "<group>"; }; 5253 5261 087FFA0D0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLInsertedLegendElement.cpp; sourceTree = "<group>"; }; 5254 5262 087FFA0E0EFF3ED3009DBD88 /* WMLInsertedLegendElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLInsertedLegendElement.h; sourceTree = "<group>"; }; … … 13485 13493 B22277F30D00BF1F0071B782 /* SVGAnimatedPoints.idl */, 13486 13494 B22277F40D00BF1F0071B782 /* SVGAnimatedPreserveAspectRatio.idl */, 13495 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */, 13487 13496 B22277F50D00BF1F0071B782 /* SVGAnimatedRect.idl */, 13488 13497 B22277F60D00BF1F0071B782 /* SVGAnimatedString.idl */, … … 13873 13882 B2E4EC950D00C22B00432643 /* SVGZoomEvent.h */, 13874 13883 B2E4EC960D00C22B00432643 /* SVGZoomEvent.idl */, 13884 0878B1FA10874E3F00A55097 /* SynchronizablePropertyController.cpp */, 13885 0878B1FB10874E3F00A55097 /* SynchronizablePropertyController.h */, 13886 0878B1FC10874E3F00A55097 /* SynchronizableTypeWrapper.h */, 13875 13887 B28C6A260D00C44800334AA4 /* xlinkattrs.in */, 13876 13888 ); … … 17688 17700 B22279850D00BF220071B782 /* SVGAnimatedPathData.h in Headers */, 17689 17701 B22279880D00BF220071B782 /* SVGAnimatedPoints.h in Headers */, 17702 0878B1FD10874E3F00A55097 /* SVGAnimatedProperty.h in Headers */, 17690 17703 B222798D0D00BF220071B782 /* SVGAnimatedTemplate.h in Headers */, 17691 17704 B22279900D00BF220071B782 /* SVGAnimateElement.h in Headers */, … … 17861 17874 B2227AF60D00BF220071B782 /* SVGZoomAndPan.h in Headers */, 17862 17875 B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */, 17876 0878B1FF10874E3F00A55097 /* SynchronizablePropertyController.h in Headers */, 17877 0878B20010874E3F00A55097 /* SynchronizableTypeWrapper.h in Headers */, 17863 17878 93E62D9B0985F41600E1B5E3 /* SystemTime.h in Headers */, 17864 17879 A8CFF0510A154F09000A4234 /* TableLayout.h in Headers */, … … 20024 20039 B2227AF50D00BF220071B782 /* SVGZoomAndPan.cpp in Sources */, 20025 20040 B2E4EC970D00C22B00432643 /* SVGZoomEvent.cpp in Sources */, 20041 0878B1FE10874E3F00A55097 /* SynchronizablePropertyController.cpp in Sources */, 20026 20042 6582A16309999D6D00BEEB6D /* SystemTimeMac.cpp in Sources */, 20027 20043 BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */, -
trunk/WebCore/svg/SVGAllInOne.cpp
r49400 r49745 151 151 #include "SVGZoomAndPan.cpp" 152 152 #include "SVGZoomEvent.cpp" 153 #include "SynchronizablePropertyController.cpp" -
trunk/WebCore/svg/SVGAnimatedProperty.h
r49602 r49745 72 72 virtual ~SVGAnimatedPropertyBase() { } 73 73 virtual void synchronize() const = 0; 74 virtual void startAnimation() const = 0; 75 virtual void stopAnimation() = 0; 74 76 }; 75 77 … … 126 128 PassRefPtr<TearOff> animatedTearOff() const; 127 129 130 void registerProperty(); 128 131 virtual void synchronize() const; 129 132 … … 142 145 143 146 mutable SynchronizableTypeWrapper<StorableType> m_value; 147 148 #ifndef NDEBUG 149 bool m_registered; 150 #endif 144 151 }; 145 152 … … 188 195 , m_attributeIdentifier(attributeName.localName()) 189 196 , m_value() 190 { 191 ASSERT(m_ownerType); 197 #ifndef NDEBUG 198 , m_registered(false) 199 #endif 200 { 201 ASSERT(m_ownerType); 202 registerProperty(); 192 203 } 193 204 … … 200 211 , m_attributeIdentifier(attributeIdentifier) 201 212 , m_value() 202 { 203 ASSERT(m_ownerType); 213 #ifndef NDEBUG 214 , m_registered(false) 215 #endif 216 { 217 ASSERT(m_ownerType); 218 registerProperty(); 204 219 } 205 220 … … 213 228 , m_attributeIdentifier(attributeName.localName()) 214 229 , m_value(arg1) 215 { 216 ASSERT(m_ownerType); 230 #ifndef NDEBUG 231 , m_registered(false) 232 #endif 233 { 234 ASSERT(m_ownerType); 235 registerProperty(); 217 236 } 218 237 … … 227 246 , m_attributeIdentifier(attributeIdentifier) 228 247 , m_value(arg1) 229 { 230 ASSERT(m_ownerType); 248 #ifndef NDEBUG 249 , m_registered(false) 250 #endif 251 { 252 ASSERT(m_ownerType); 253 registerProperty(); 231 254 } 232 255 … … 241 264 , m_attributeIdentifier(attributeName.localName()) 242 265 , m_value(arg1, arg2) 243 { 244 ASSERT(m_ownerType); 266 #ifndef NDEBUG 267 , m_registered(false) 268 #endif 269 { 270 ASSERT(m_ownerType); 271 registerProperty(); 245 272 } 246 273 … … 256 283 , m_attributeIdentifier(attributeIdentifier) 257 284 , m_value(arg1, arg2) 258 { 259 ASSERT(m_ownerType); 285 #ifndef NDEBUG 286 , m_registered(false) 287 #endif 288 { 289 ASSERT(m_ownerType); 290 registerProperty(); 260 291 } 261 292 … … 271 302 , m_attributeIdentifier(attributeName.localName()) 272 303 , m_value(arg1, arg2, arg3) 273 { 274 ASSERT(m_ownerType); 304 #ifndef NDEBUG 305 , m_registered(false) 306 #endif 307 { 308 ASSERT(m_ownerType); 309 registerProperty(); 275 310 } 276 311 … … 287 322 , m_attributeIdentifier(attributeIdentifier) 288 323 , m_value(arg1, arg2, arg3) 289 { 290 ASSERT(m_ownerType); 324 #ifndef NDEBUG 325 , m_registered(false) 326 #endif 327 { 328 ASSERT(m_ownerType); 329 registerProperty(); 291 330 } 292 331 … … 295 334 SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::value() const 296 335 { 336 ASSERT(m_registered); 297 337 return m_value; 298 338 } … … 301 341 void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::setValue(typename SVGAnimatedProperty::DecoratedType newValue) 302 342 { 343 ASSERT(m_registered); 303 344 m_value = newValue; 304 345 ownerElement()->setSynchronizedSVGAttributes(false); … … 309 350 SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::baseValue() const 310 351 { 352 ASSERT(m_registered); 311 353 const OwnerElement* ownerElement = this->ownerElement(); 312 354 SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions(); … … 320 362 void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::setBaseValue(typename SVGAnimatedProperty::DecoratedType newValue) 321 363 { 364 ASSERT(m_registered); 322 365 const OwnerElement* ownerElement = this->ownerElement(); 323 366 SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions(); … … 336 379 SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::animatedTearOff() const 337 380 { 381 ASSERT(m_registered); 338 382 return lookupOrCreateWrapper<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName, TearOff, OwnerElement>(*this, ownerElement(), m_attributeName, m_attributeIdentifier); 339 383 } 340 384 341 385 template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> 386 void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::registerProperty() 387 { 388 ASSERT(!m_registered); 389 ownerElement()->propertyController().registerProperty(m_attributeName, this); 390 391 #ifndef NDEBUG 392 m_registered = true; 393 #endif 394 } 395 396 template<typename OwnerTypeArg, typename AnimatedTypeArg, const char* TagName, const char* PropertyName> 342 397 void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::synchronize() const 343 398 { 399 ASSERT(m_registered); 344 400 if (!m_value.needsSynchronization()) 345 401 return; … … 352 408 void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::startAnimation() const 353 409 { 410 ASSERT(m_registered); 354 411 const OwnerElement* ownerElement = this->ownerElement(); 355 412 if (SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions()) { … … 362 419 void SVGAnimatedProperty<OwnerTypeArg, AnimatedTypeArg, TagName, PropertyName>::stopAnimation() 363 420 { 421 ASSERT(m_registered); 364 422 const OwnerElement* ownerElement = this->ownerElement(); 365 423 if (SVGDocumentExtensions* extensions = ownerElement->accessDocumentSVGExtensions()) { 366 424 ASSERT(extensions->hasBaseValue<DecoratedType>(ownerElement, m_attributeIdentifier)); 367 425 setValue(extensions->baseValue<DecoratedType>(ownerElement, m_attributeIdentifier)); 368 extensions->removeBaseValue< AnimatedType>(ownerElement, m_attributeIdentifier);426 extensions->removeBaseValue<DecoratedType>(ownerElement, m_attributeIdentifier); 369 427 } 370 428 } -
trunk/WebCore/svg/SVGAnimatedTemplate.h
r37900 r49745 159 159 if (!wrapper) { 160 160 wrapper = Type::create(creator, element, attrName); 161 element-> addSVGPropertySynchronizer(attrName, creator);161 element->propertyController().setPropertyNeedsSynchronization(attrName); 162 162 Type::wrapperCache()->set(key, wrapper.get()); 163 163 } -
trunk/WebCore/svg/SVGElement.cpp
r49424 r49745 271 271 272 272 if (name.isEmpty()) { 273 invokeAllSVGPropertySynchronizers();273 m_propertyController.synchronizeAllProperties(); 274 274 setSynchronizedSVGAttributes(true); 275 275 } else 276 invokeSVGPropertySynchronizer(name);276 m_propertyController.synchronizeProperty(name); 277 277 278 278 m_synchronizingSVGAttributes = false; -
trunk/WebCore/svg/SVGElement.h
r49424 r49745 26 26 #include "StyledElement.h" 27 27 #include "SVGAnimatedProperty.h" 28 #include "SynchronizablePropertyController.h" 28 29 29 30 namespace WebCore { … … 78 79 HashSet<SVGElementInstance*> instancesForElement() const; 79 80 80 void addSVGPropertySynchronizer(const QualifiedName& attrName, const SVGAnimatedPropertyBase& base) const81 {82 m_svgPropertyMap.set(attrName.localName(), &base);83 }84 85 81 void setCursorElement(SVGCursorElement* cursorElement) { m_cursorElement = cursorElement; } 86 82 void setCursorImageValue(CSSCursorImageValue* cursorImageValue) { m_cursorImageValue = cursorImageValue; } 83 84 SynchronizablePropertyController& propertyController() const { return m_propertyController; } 87 85 88 86 protected: … … 107 105 virtual void buildPendingResource() { } 108 106 109 // Inlined methods handling SVG property synchronization110 void invokeSVGPropertySynchronizer(const String& name) const111 {112 if (m_svgPropertyMap.contains(name)) {113 const SVGAnimatedPropertyBase* property = m_svgPropertyMap.get(name);114 ASSERT(property);115 116 property->synchronize();117 }118 }119 120 void invokeAllSVGPropertySynchronizers() const121 {122 HashMap<String, const SVGAnimatedPropertyBase*>::const_iterator it = m_svgPropertyMap.begin();123 const HashMap<String, const SVGAnimatedPropertyBase*>::const_iterator end = m_svgPropertyMap.end();124 for (; it != end; ++it) {125 const SVGAnimatedPropertyBase* property = it->second;126 ASSERT(property);127 128 property->synchronize();129 }130 }131 132 107 void mapInstanceToElement(SVGElementInstance*); 133 108 void removeInstanceMapping(SVGElementInstance*); … … 136 111 137 112 ContainerNode* m_shadowParent; 138 mutable HashMap<String, const SVGAnimatedPropertyBase*> m_svgPropertyMap;113 mutable SynchronizablePropertyController m_propertyController; 139 114 140 115 SVGCursorElement* m_cursorElement; -
trunk/WebCore/svg/SVGViewSpec.cpp
r49602 r49745 35 35 : SVGFitToViewBox() 36 36 , SVGZoomAndPan() 37 , m_contextElement(contextElement) 37 38 , m_viewBox(this, SVGNames::viewBoxAttr) 38 39 , m_preserveAspectRatio(this, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()) 39 40 , m_transform(SVGTransformList::create(SVGNames::transformAttr)) 40 , m_contextElement(contextElement)41 41 { 42 42 } … … 75 75 SVGElement* SVGViewSpec::viewTarget() const 76 76 { 77 return static_cast<SVGElement*>(m_contextElement->ownerDocument()->getElementById(m_viewTargetString)); 78 } 79 80 const SVGElement* SVGViewSpec::contextElement() const 81 { 82 return m_contextElement; 77 return static_cast<SVGElement*>(m_contextElement->document()->getElementById(m_viewTargetString)); 83 78 } 84 79 -
trunk/WebCore/svg/SVGViewSpec.h
r49602 r49745 52 52 SVGElement* viewTarget() const; 53 53 54 const SVG Element* contextElement() const;54 const SVGSVGElement* contextElement() const { return m_contextElement; } 55 55 56 56 private: 57 const SVGSVGElement* m_contextElement; 58 57 59 // SVGFitToViewBox 58 60 ANIMATED_PROPERTY_DECLARATIONS(SVGViewSpec, SVGFitToViewBoxIdentifier, SVGNames::viewBoxAttrString, FloatRect, ViewBox, viewBox) … … 60 62 61 63 mutable RefPtr<SVGTransformList> m_transform; 62 const SVGSVGElement* m_contextElement;63 64 String m_viewTargetString; 64 65 };
Note: See TracChangeset
for help on using the changeset viewer.