Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 class SVGPropertyBase : public GarbageCollectedFinalized<SVGPropertyBase> { | 44 class SVGPropertyBase : public GarbageCollectedFinalized<SVGPropertyBase> { |
| 45 WTF_MAKE_NONCOPYABLE(SVGPropertyBase); | 45 WTF_MAKE_NONCOPYABLE(SVGPropertyBase); |
| 46 | 46 |
| 47 public: | 47 public: |
| 48 // Properties do not have a primitive type by default | 48 // Properties do not have a primitive type by default |
| 49 typedef void PrimitiveType; | 49 typedef void PrimitiveType; |
| 50 | 50 |
| 51 virtual ~SVGPropertyBase() {} | 51 virtual ~SVGPropertyBase() {} |
| 52 | 52 |
| 53 // FIXME: remove this in WebAnimations transition. | 53 // FIXME: remove this in WebAnimations transition. |
| 54 // This is used from SVGAnimatedNewPropertyAnimator for its animate-by-string implementation. | 54 // This is used from SVGAnimatedNewPropertyAnimator for its animate-by-string |
| 55 // implementation. | |
| 55 virtual SVGPropertyBase* cloneForAnimation(const String&) const = 0; | 56 virtual SVGPropertyBase* cloneForAnimation(const String&) const = 0; |
| 56 | 57 |
| 57 virtual String valueAsString() const = 0; | 58 virtual String valueAsString() const = 0; |
| 58 | 59 |
| 59 // FIXME: remove below and just have this inherit AnimatableValue in WebAnimat ions transition. | 60 // FIXME: remove below and just have this inherit AnimatableValue in |
| 61 // WebAnimations transition. | |
| 60 virtual void add(SVGPropertyBase*, SVGElement*) = 0; | 62 virtual void add(SVGPropertyBase*, SVGElement*) = 0; |
| 61 virtual void calculateAnimatedValue(SVGAnimationElement*, | 63 virtual void calculateAnimatedValue(SVGAnimationElement*, |
| 62 float percentage, | 64 float percentage, |
| 63 unsigned repeatCount, | 65 unsigned repeatCount, |
| 64 SVGPropertyBase* from, | 66 SVGPropertyBase* from, |
| 65 SVGPropertyBase* to, | 67 SVGPropertyBase* to, |
| 66 SVGPropertyBase* toAtEndOfDurationValue, | 68 SVGPropertyBase* toAtEndOfDurationValue, |
| 67 SVGElement*) = 0; | 69 SVGElement*) = 0; |
| 68 virtual float calculateDistance(SVGPropertyBase* to, SVGElement*) = 0; | 70 virtual float calculateDistance(SVGPropertyBase* to, SVGElement*) = 0; |
| 69 | 71 |
| 70 virtual AnimatedPropertyType type() const = 0; | 72 virtual AnimatedPropertyType type() const = 0; |
| 71 | 73 |
| 72 SVGPropertyBase* ownerList() const { return m_ownerList; } | 74 SVGPropertyBase* ownerList() const { return m_ownerList; } |
| 73 | 75 |
| 74 void setOwnerList(SVGPropertyBase* ownerList) { | 76 void setOwnerList(SVGPropertyBase* ownerList) { |
| 75 // Previous owner list must be cleared before setting new owner list. | 77 // Previous owner list must be cleared before setting new owner list. |
| 76 ASSERT((!ownerList && m_ownerList) || (ownerList && !m_ownerList)); | 78 ASSERT((!ownerList && m_ownerList) || (ownerList && !m_ownerList)); |
| 77 | 79 |
| 78 m_ownerList = ownerList; | 80 m_ownerList = ownerList; |
| 79 } | 81 } |
| 80 | 82 |
| 81 DEFINE_INLINE_VIRTUAL_TRACE() {} | 83 DEFINE_INLINE_VIRTUAL_TRACE() {} |
| 82 | 84 |
| 83 protected: | 85 protected: |
| 84 SVGPropertyBase() : m_ownerList(nullptr) {} | 86 SVGPropertyBase() : m_ownerList(nullptr) {} |
| 85 | 87 |
| 86 private: | 88 private: |
| 87 // Oilpan: the back reference to the owner should be a Member, but this can cr eate | 89 // Oilpan: the back reference to the owner should be a Member, but this can |
| 88 // cycles when SVG properties meet the off-heap InterpolationValue hierarchy. | 90 // create cycles when SVG properties meet the off-heap InterpolationValue |
| 89 // Not tracing it is safe, albeit an undesirable state of affairs. | 91 // hierarchy. Not tracing it is safe, albeit an undesirable state of affairs. |
|
pdr.
2016/10/04 21:05:30
Super nit: one space after periods for consistency
Nico
2016/10/04 21:10:23
I use vim's gq to join lines manually, and it defa
| |
| 90 // See http://crbug.com/528275 for the detail. | 92 // See http://crbug.com/528275 for the detail. |
| 91 UntracedMember<SVGPropertyBase> m_ownerList; | 93 UntracedMember<SVGPropertyBase> m_ownerList; |
| 92 }; | 94 }; |
| 93 | 95 |
| 94 #define DEFINE_SVG_PROPERTY_TYPE_CASTS(thisType) \ | 96 #define DEFINE_SVG_PROPERTY_TYPE_CASTS(thisType) \ |
| 95 DEFINE_TYPE_CASTS(thisType, SVGPropertyBase, value, \ | 97 DEFINE_TYPE_CASTS(thisType, SVGPropertyBase, value, \ |
| 96 value->type() == thisType::classType(), \ | 98 value->type() == thisType::classType(), \ |
| 97 value.type() == thisType::classType()); | 99 value.type() == thisType::classType()); |
| 98 | 100 |
| 99 } // namespace blink | 101 } // namespace blink |
| 100 | 102 |
| 101 #endif // SVGProperty_h | 103 #endif // SVGProperty_h |
| OLD | NEW |