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

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

Issue 24863002: Revert 157959 "Introduce a new reference graph to SVG*TearOffs." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 7 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 | Annotate | Revision Log
OLDNEW
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 13 matching lines...) Expand all
24 #include "core/svg/properties/SVGAnimatedPropertyDescription.h" 24 #include "core/svg/properties/SVGAnimatedPropertyDescription.h"
25 #include "core/svg/properties/SVGPropertyInfo.h" 25 #include "core/svg/properties/SVGPropertyInfo.h"
26 #include "wtf/RefCounted.h" 26 #include "wtf/RefCounted.h"
27 27
28 namespace WebCore { 28 namespace WebCore {
29 29
30 class SVGElement; 30 class SVGElement;
31 31
32 class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty> { 32 class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty> {
33 public: 33 public:
34 SVGElement* contextElement() const { return m_contextElement; } 34 SVGElement* contextElement() const { return m_contextElement.get(); }
35 void resetContextElement() { m_contextElement = 0; }
36 const QualifiedName& attributeName() const { return m_attributeName; } 35 const QualifiedName& attributeName() const { return m_attributeName; }
37 AnimatedPropertyType animatedPropertyType() const { return m_animatedPropert yType; } 36 AnimatedPropertyType animatedPropertyType() const { return m_animatedPropert yType; }
38 bool isAnimating() const { return m_isAnimating; } 37 bool isAnimating() const { return m_isAnimating; }
39 bool isReadOnly() const { return m_isReadOnly; } 38 bool isReadOnly() const { return m_isReadOnly; }
40 void setIsReadOnly() { m_isReadOnly = true; } 39 void setIsReadOnly() { m_isReadOnly = true; }
41 40
42 void commitChange(); 41 void commitChange();
43 42
44 virtual bool isAnimatedListTearOff() const { return false; } 43 virtual bool isAnimatedListTearOff() const { return false; }
45 virtual void detachWrappers() { }
46 44
47 // Caching facilities. 45 // Caching facilities.
48 typedef HashMap<SVGAnimatedPropertyDescription, RefPtr<SVGAnimatedProperty>, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> C ache; 46 typedef HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAni matedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> Cache;
49 47
50 virtual ~SVGAnimatedProperty(); 48 virtual ~SVGAnimatedProperty();
51 49
52 template<typename OwnerType, typename TearOffType, typename PropertyType> 50 template<typename OwnerType, typename TearOffType, typename PropertyType>
53 static PassRefPtr<TearOffType> lookupOrCreateWrapper(OwnerType* element, con st SVGPropertyInfo* info, PropertyType& property) 51 static PassRefPtr<TearOffType> lookupOrCreateWrapper(OwnerType* element, con st SVGPropertyInfo* info, PropertyType& property)
54 { 52 {
55 ASSERT(info); 53 ASSERT(info);
56 SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); 54 SVGAnimatedPropertyDescription key(element, info->propertyIdentifier);
57 RefPtr<SVGAnimatedProperty> wrapper = animatedPropertyCache()->get(key); 55 RefPtr<SVGAnimatedProperty> wrapper = animatedPropertyCache()->get(key);
58 if (!wrapper) { 56 if (!wrapper) {
59 wrapper = TearOffType::create(element, info->attributeName, info->an imatedPropertyType, property); 57 wrapper = TearOffType::create(element, info->attributeName, info->an imatedPropertyType, property);
60 if (info->animatedPropertyState == PropertyIsReadOnly) 58 if (info->animatedPropertyState == PropertyIsReadOnly)
61 wrapper->setIsReadOnly(); 59 wrapper->setIsReadOnly();
62 animatedPropertyCache()->set(key, wrapper); 60 animatedPropertyCache()->set(key, wrapper.get());
63 } 61 }
64 return static_pointer_cast<TearOffType>(wrapper); 62 return static_pointer_cast<TearOffType>(wrapper);
65 } 63 }
66 64
67 template<typename OwnerType, typename TearOffType> 65 template<typename OwnerType, typename TearOffType>
68 static TearOffType* lookupWrapper(OwnerType* element, const SVGPropertyInfo* info) 66 static TearOffType* lookupWrapper(OwnerType* element, const SVGPropertyInfo* info)
69 { 67 {
70 ASSERT(info); 68 ASSERT(info);
71 SVGAnimatedPropertyDescription key(element, info->propertyIdentifier); 69 SVGAnimatedPropertyDescription key(element, info->propertyIdentifier);
72 return static_cast<TearOffType*>(animatedPropertyCache()->get(key)); 70 return static_cast<TearOffType*>(animatedPropertyCache()->get(key));
73 } 71 }
74 72
75 template<typename OwnerType, typename TearOffType> 73 template<typename OwnerType, typename TearOffType>
76 static TearOffType* lookupWrapper(const OwnerType* element, const SVGPropert yInfo* info) 74 static TearOffType* lookupWrapper(const OwnerType* element, const SVGPropert yInfo* info)
77 { 75 {
78 return lookupWrapper<OwnerType, TearOffType>(const_cast<OwnerType*>(elem ent), info); 76 return lookupWrapper<OwnerType, TearOffType>(const_cast<OwnerType*>(elem ent), info);
79 } 77 }
80 78
81 static void detachAnimatedPropertiesWrappersForElement(SVGElement*);
82 static void detachAnimatedPropertiesForElement(SVGElement*);
83
84 protected: 79 protected:
85 SVGAnimatedProperty(SVGElement*, const QualifiedName&, AnimatedPropertyType) ; 80 SVGAnimatedProperty(SVGElement*, const QualifiedName&, AnimatedPropertyType) ;
86 81
87 private: 82 private:
88 static Cache* animatedPropertyCache(); 83 static Cache* animatedPropertyCache();
89 84
90 SVGElement* m_contextElement; 85 RefPtr<SVGElement> m_contextElement;
91 const QualifiedName& m_attributeName; 86 const QualifiedName& m_attributeName;
92 AnimatedPropertyType m_animatedPropertyType; 87 AnimatedPropertyType m_animatedPropertyType;
93 88
94 protected: 89 protected:
95 bool m_isAnimating; 90 bool m_isAnimating;
96 bool m_isReadOnly; 91 bool m_isReadOnly;
97 }; 92 };
98 93
99 } 94 }
100 95
101 #endif // SVGAnimatedProperty_h 96 #endif // SVGAnimatedProperty_h
OLDNEW
« no previous file with comments | « Source/core/svg/properties/SVGAnimatedListPropertyTearOff.h ('k') | Source/core/svg/properties/SVGAnimatedProperty.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698