| 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 25 matching lines...) Expand all Loading... |
| 36 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
| 37 #include "wtf/PassRefPtr.h" | 37 #include "wtf/PassRefPtr.h" |
| 38 #include "wtf/RefCounted.h" | 38 #include "wtf/RefCounted.h" |
| 39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class SVGElement; | 43 class SVGElement; |
| 44 class SVGAnimationElement; | 44 class SVGAnimationElement; |
| 45 | 45 |
| 46 class SVGPropertyBase : public RefCountedWillBeGarbageCollectedFinalized<SVGProp
ertyBase> { | 46 class SVGPropertyBase : public GarbageCollectedFinalized<SVGPropertyBase> { |
| 47 WTF_MAKE_NONCOPYABLE(SVGPropertyBase); | 47 WTF_MAKE_NONCOPYABLE(SVGPropertyBase); |
| 48 | 48 |
| 49 public: | 49 public: |
| 50 // Properties do not have a primitive type by default | 50 // Properties do not have a primitive type by default |
| 51 typedef void PrimitiveType; | 51 typedef void PrimitiveType; |
| 52 | 52 |
| 53 virtual ~SVGPropertyBase() | 53 virtual ~SVGPropertyBase() |
| 54 { | 54 { |
| 55 #if !ENABLE(OILPAN) | 55 #if !ENABLE(OILPAN) |
| 56 // Oilpan: a property can legitimately be swept out along with its list, | 56 // Oilpan: a property can legitimately be swept out along with its list, |
| 57 // hence this cannot be made to hold. | 57 // hence this cannot be made to hold. |
| 58 ASSERT(!m_ownerList); | 58 ASSERT(!m_ownerList); |
| 59 #endif | 59 #endif |
| 60 } | 60 } |
| 61 | 61 |
| 62 // FIXME: remove this in WebAnimations transition. | 62 // FIXME: remove this in WebAnimations transition. |
| 63 // This is used from SVGAnimatedNewPropertyAnimator for its animate-by-strin
g implementation. | 63 // This is used from SVGAnimatedNewPropertyAnimator for its animate-by-strin
g implementation. |
| 64 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const Stri
ng&) const = 0; | 64 virtual RawPtr<SVGPropertyBase> cloneForAnimation(const String&) const = 0; |
| 65 | 65 |
| 66 virtual String valueAsString() const = 0; | 66 virtual String valueAsString() const = 0; |
| 67 | 67 |
| 68 // FIXME: remove below and just have this inherit AnimatableValue in WebAnim
ations transition. | 68 // FIXME: remove below and just have this inherit AnimatableValue in WebAnim
ations transition. |
| 69 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) = 0; | 69 virtual void add(RawPtr<SVGPropertyBase>, SVGElement*) = 0; |
| 70 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> from, PassRefPtrWi
llBeRawPtr<SVGPropertyBase> to, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndO
fDurationValue, SVGElement*) = 0; | 70 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, RawPtr<SVGPropertyBase> from, RawPtr<SVGPropertyBase> to,
RawPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement*) = 0; |
| 71 virtual float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to,
SVGElement*) = 0; | 71 virtual float calculateDistance(RawPtr<SVGPropertyBase> to, SVGElement*) = 0
; |
| 72 | 72 |
| 73 AnimatedPropertyType type() const | 73 AnimatedPropertyType type() const |
| 74 { | 74 { |
| 75 return m_type; | 75 return m_type; |
| 76 } | 76 } |
| 77 | 77 |
| 78 SVGPropertyBase* ownerList() const | 78 SVGPropertyBase* ownerList() const |
| 79 { | 79 { |
| 80 return m_ownerList; | 80 return m_ownerList; |
| 81 } | 81 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 97 { | 97 { |
| 98 } | 98 } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 const AnimatedPropertyType m_type; | 101 const AnimatedPropertyType m_type; |
| 102 | 102 |
| 103 // Oilpan: the back reference to the owner should be a Member, but this can
create | 103 // Oilpan: the back reference to the owner should be a Member, but this can
create |
| 104 // cycles when SVG properties meet the off-heap InterpolationValue hierarchy
. | 104 // cycles when SVG properties meet the off-heap InterpolationValue hierarchy
. |
| 105 // Not tracing it is safe, albeit an undesirable state of affairs. | 105 // Not tracing it is safe, albeit an undesirable state of affairs. |
| 106 // See http://crbug.com/528275 for the detail. | 106 // See http://crbug.com/528275 for the detail. |
| 107 RawPtrWillBeUntracedMember<SVGPropertyBase> m_ownerList; | 107 UntracedMember<SVGPropertyBase> m_ownerList; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 #define DEFINE_SVG_PROPERTY_TYPE_CASTS(thisType)\ | 110 #define DEFINE_SVG_PROPERTY_TYPE_CASTS(thisType)\ |
| 111 DEFINE_TYPE_CASTS(thisType, SVGPropertyBase, value, value->type() == thisTyp
e::classType(), value.type() == thisType::classType());\ | 111 DEFINE_TYPE_CASTS(thisType, SVGPropertyBase, value, value->type() == thisTyp
e::classType(), value.type() == thisType::classType());\ |
| 112 inline PassRefPtrWillBeRawPtr<thisType> to##thisType(PassRefPtrWillBeRawPtr<
SVGPropertyBase> passBase)\ | 112 inline RawPtr<thisType> to##thisType(RawPtr<SVGPropertyBase> passBase)\ |
| 113 {\ | 113 {\ |
| 114 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase;\ | 114 RawPtr<SVGPropertyBase> base = passBase;\ |
| 115 ASSERT(base->type() == thisType::classType());\ | 115 ASSERT(base->type() == thisType::classType());\ |
| 116 return static_pointer_cast<thisType>(base.release());\ | 116 return static_pointer_cast<thisType>(base.release());\ |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace blink | 119 } // namespace blink |
| 120 | 120 |
| 121 #endif // SVGProperty_h | 121 #endif // SVGProperty_h |
| OLD | NEW |