| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class SVGPathElement; | 42 class SVGPathElement; |
| 43 class SVGPathSegListTearOff; | 43 class SVGPathSegListTearOff; |
| 44 | 44 |
| 45 class SVGPathSegList : public SVGListPropertyHelper<SVGPathSegList, SVGPathSeg>
{ | 45 class SVGPathSegList : public SVGListPropertyHelper<SVGPathSegList, SVGPathSeg>
{ |
| 46 public: | 46 public: |
| 47 typedef void PrimitiveType; | 47 typedef void PrimitiveType; |
| 48 typedef SVGPathSeg ItemPropertyType; | 48 typedef SVGPathSeg ItemPropertyType; |
| 49 typedef SVGPathSegListTearOff TearOffType; | 49 typedef SVGPathSegListTearOff TearOffType; |
| 50 typedef SVGListPropertyHelper<SVGPathSegList, SVGPathSeg> Base; | 50 typedef SVGListPropertyHelper<SVGPathSegList, SVGPathSeg> Base; |
| 51 | 51 |
| 52 static PassRefPtr<SVGPathSegList> create(SVGPathElement* contextElement, SVG
PathSegRole role = PathSegUndefinedRole) | 52 static PassRefPtr<SVGPathSegList> create(SVGPathElement* contextElement) |
| 53 { | 53 { |
| 54 return adoptRef(new SVGPathSegList(contextElement, role)); | 54 return adoptRef(new SVGPathSegList(contextElement)); |
| 55 } | 55 } |
| 56 static PassRefPtr<SVGPathSegList> create() { ASSERT_NOT_REACHED(); return nu
llptr; } | 56 static PassRefPtr<SVGPathSegList> create() { ASSERT_NOT_REACHED(); return nu
llptr; } |
| 57 | 57 |
| 58 virtual ~SVGPathSegList(); | 58 virtual ~SVGPathSegList(); |
| 59 | 59 |
| 60 const SVGPathByteStream* byteStream() const; | 60 const SVGPathByteStream* byteStream() const; |
| 61 void clearByteStream() { m_byteStream.clear(); } | 61 void clearByteStream() { m_byteStream.clear(); } |
| 62 | 62 |
| 63 // SVGListPropertyHelper methods with |m_byteStream| sync: | 63 // SVGListPropertyHelper methods with |m_byteStream| sync: |
| 64 | 64 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 virtual String valueAsString() const OVERRIDE; | 136 virtual String valueAsString() const OVERRIDE; |
| 137 void setValueAsString(const String&, ExceptionState&); | 137 void setValueAsString(const String&, ExceptionState&); |
| 138 | 138 |
| 139 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) OVERR
IDE; | 139 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) OVERR
IDE; |
| 140 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<SVGPropertyBase> fromValue, PassRefPtr<SVGPrope
rtyBase> toValue, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement
*) OVERRIDE; | 140 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage,
unsigned repeatCount, PassRefPtr<SVGPropertyBase> fromValue, PassRefPtr<SVGPrope
rtyBase> toValue, PassRefPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement
*) OVERRIDE; |
| 141 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*)
OVERRIDE; | 141 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*)
OVERRIDE; |
| 142 | 142 |
| 143 static AnimatedPropertyType classType() { return AnimatedPath; } | 143 static AnimatedPropertyType classType() { return AnimatedPath; } |
| 144 | 144 |
| 145 private: | 145 private: |
| 146 SVGPathSegList(SVGPathElement*, SVGPathSegRole); | 146 SVGPathSegList(SVGPathElement*); |
| 147 SVGPathSegList(SVGPathElement*, SVGPathSegRole, PassOwnPtr<SVGPathByteStream
>); | 147 SVGPathSegList(SVGPathElement*, PassOwnPtr<SVGPathByteStream>); |
| 148 | 148 |
| 149 friend class SVGPathSegListBuilder; | 149 friend class SVGPathSegListBuilder; |
| 150 // This is only to be called from SVGPathSegListBuilder. | 150 // This is only to be called from SVGPathSegListBuilder. |
| 151 void appendWithoutByteStreamSync(PassRefPtr<ItemPropertyType> passNewItem) | 151 void appendWithoutByteStreamSync(PassRefPtr<ItemPropertyType> passNewItem) |
| 152 { | 152 { |
| 153 Base::append(passNewItem); | 153 Base::append(passNewItem); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void updateListFromByteStream(); | 156 void updateListFromByteStream(); |
| 157 void invalidateList(); | 157 void invalidateList(); |
| 158 | 158 |
| 159 // FIXME: This pointer should be removed after SVGPathSeg has a tear-off. | 159 // FIXME: This pointer should be removed after SVGPathSeg has a tear-off. |
| 160 // FIXME: oilpan: This is raw-ptr to avoid reference cycles. | 160 // FIXME: oilpan: This is raw-ptr to avoid reference cycles. |
| 161 // SVGPathSegList is either owned by SVGAnimatedPath or | 161 // SVGPathSegList is either owned by SVGAnimatedPath or |
| 162 // SVGPathSegListTearOff. Both keep |contextElement| alive, | 162 // SVGPathSegListTearOff. Both keep |contextElement| alive, |
| 163 // so this ptr is always valid. | 163 // so this ptr is always valid. |
| 164 SVGPathElement* m_contextElement; | 164 SVGPathElement* m_contextElement; |
| 165 | 165 |
| 166 SVGPathSegRole m_role; | |
| 167 mutable OwnPtr<SVGPathByteStream> m_byteStream; | 166 mutable OwnPtr<SVGPathByteStream> m_byteStream; |
| 168 bool m_listSyncedToByteStream; | 167 bool m_listSyncedToByteStream; |
| 169 }; | 168 }; |
| 170 | 169 |
| 171 inline PassRefPtr<SVGPathSegList> toSVGPathSegList(PassRefPtr<SVGPropertyBase> p
assBase) | 170 inline PassRefPtr<SVGPathSegList> toSVGPathSegList(PassRefPtr<SVGPropertyBase> p
assBase) |
| 172 { | 171 { |
| 173 RefPtr<SVGPropertyBase> base = passBase; | 172 RefPtr<SVGPropertyBase> base = passBase; |
| 174 ASSERT(base->type() == SVGPathSegList::classType()); | 173 ASSERT(base->type() == SVGPathSegList::classType()); |
| 175 return static_pointer_cast<SVGPathSegList>(base.release()); | 174 return static_pointer_cast<SVGPathSegList>(base.release()); |
| 176 } | 175 } |
| 177 | 176 |
| 178 } // namespace blink | 177 } // namespace blink |
| 179 | 178 |
| 180 #endif | 179 #endif |
| OLD | NEW |