| OLD | NEW |
| 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef NewSVGPropertyTearOff_h | 31 #ifndef SVGPropertyTearOff_h |
| 32 #define NewSVGPropertyTearOff_h | 32 #define SVGPropertyTearOff_h |
| 33 | 33 |
| 34 #include "core/dom/QualifiedName.h" | 34 #include "core/dom/QualifiedName.h" |
| 35 #include "core/svg/properties/NewSVGProperty.h" | 35 #include "core/svg/properties/SVGProperty.h" |
| 36 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
| 37 | 37 |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 enum PropertyIsAnimValType { | 40 enum PropertyIsAnimValType { |
| 41 PropertyIsNotAnimVal, | 41 PropertyIsNotAnimVal, |
| 42 PropertyIsAnimVal | 42 PropertyIsAnimVal |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class NewSVGPropertyTearOffBase : public RefCounted<NewSVGPropertyTearOffBase> { | 45 class SVGPropertyTearOffBase : public RefCounted<SVGPropertyTearOffBase> { |
| 46 public: | 46 public: |
| 47 virtual ~NewSVGPropertyTearOffBase() { } | 47 virtual ~SVGPropertyTearOffBase() { } |
| 48 | 48 |
| 49 PropertyIsAnimValType propertyIsAnimVal() const | 49 PropertyIsAnimValType propertyIsAnimVal() const |
| 50 { | 50 { |
| 51 return m_propertyIsAnimVal; | 51 return m_propertyIsAnimVal; |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool isAnimVal() const | 54 bool isAnimVal() const |
| 55 { | 55 { |
| 56 return m_propertyIsAnimVal == PropertyIsAnimVal; | 56 return m_propertyIsAnimVal == PropertyIsAnimVal; |
| 57 } | 57 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 79 } | 79 } |
| 80 | 80 |
| 81 const QualifiedName& attributeName() | 81 const QualifiedName& attributeName() |
| 82 { | 82 { |
| 83 return m_attributeName; | 83 return m_attributeName; |
| 84 } | 84 } |
| 85 | 85 |
| 86 virtual AnimatedPropertyType type() const = 0; | 86 virtual AnimatedPropertyType type() const = 0; |
| 87 | 87 |
| 88 protected: | 88 protected: |
| 89 NewSVGPropertyTearOffBase(SVGElement* contextElement, PropertyIsAnimValType
propertyIsAnimVal, const QualifiedName& attributeName = nullQName()) | 89 SVGPropertyTearOffBase(SVGElement* contextElement, PropertyIsAnimValType pro
pertyIsAnimVal, const QualifiedName& attributeName = nullQName()) |
| 90 : m_contextElement(contextElement) | 90 : m_contextElement(contextElement) |
| 91 , m_propertyIsAnimVal(propertyIsAnimVal) | 91 , m_propertyIsAnimVal(propertyIsAnimVal) |
| 92 , m_isReadOnlyProperty(false) | 92 , m_isReadOnlyProperty(false) |
| 93 , m_attributeName(attributeName) | 93 , m_attributeName(attributeName) |
| 94 { | 94 { |
| 95 } | 95 } |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 // These references are kept alive from V8 wrapper to prevent reference cycl
es | 98 // These references are kept alive from V8 wrapper to prevent reference cycl
es |
| 99 SVGElement* m_contextElement; | 99 SVGElement* m_contextElement; |
| 100 | 100 |
| 101 PropertyIsAnimValType m_propertyIsAnimVal; | 101 PropertyIsAnimValType m_propertyIsAnimVal; |
| 102 bool m_isReadOnlyProperty; | 102 bool m_isReadOnlyProperty; |
| 103 QualifiedName m_attributeName; | 103 QualifiedName m_attributeName; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 template <typename Property> | 106 template <typename Property> |
| 107 class NewSVGPropertyTearOff : public NewSVGPropertyTearOffBase { | 107 class SVGPropertyTearOff : public SVGPropertyTearOffBase { |
| 108 public: | 108 public: |
| 109 Property* target() | 109 Property* target() |
| 110 { | 110 { |
| 111 return m_target.get(); | 111 return m_target.get(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void setTarget(PassRefPtr<Property> target) | 114 void setTarget(PassRefPtr<Property> target) |
| 115 { | 115 { |
| 116 m_target = target; | 116 m_target = target; |
| 117 } | 117 } |
| 118 | 118 |
| 119 virtual AnimatedPropertyType type() const OVERRIDE | 119 virtual AnimatedPropertyType type() const OVERRIDE |
| 120 { | 120 { |
| 121 return Property::classType(); | 121 return Property::classType(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 protected: | 124 protected: |
| 125 NewSVGPropertyTearOff(PassRefPtr<Property> target, SVGElement* contextElemen
t, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName =
nullQName()) | 125 SVGPropertyTearOff(PassRefPtr<Property> target, SVGElement* contextElement,
PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName = nu
llQName()) |
| 126 : NewSVGPropertyTearOffBase(contextElement, propertyIsAnimVal, attribute
Name) | 126 : SVGPropertyTearOffBase(contextElement, propertyIsAnimVal, attributeNam
e) |
| 127 , m_target(target) | 127 , m_target(target) |
| 128 { | 128 { |
| 129 ASSERT(m_target); | 129 ASSERT(m_target); |
| 130 } | 130 } |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 RefPtr<Property> m_target; | 133 RefPtr<Property> m_target; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } | 136 } |
| 137 | 137 |
| 138 #endif // NewSVGPropertyTearOff_h | 138 #endif // SVGPropertyTearOff_h |
| OLD | NEW |