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) | 52 static PassRefPtrWillBeRawPtr<SVGPathSegList> create(SVGPathElement* context Element) |
53 { | 53 { |
54 return adoptRef(new SVGPathSegList(contextElement)); | 54 return adoptRefWillBeNoop(new SVGPathSegList(contextElement)); |
55 } | 55 } |
56 static PassRefPtr<SVGPathSegList> create() { ASSERT_NOT_REACHED(); return nu llptr; } | 56 static PassRefPtrWillBeRawPtr<SVGPathSegList> create() |
57 { | |
58 ASSERT_NOT_REACHED(); | |
59 return nullptr; | |
60 } | |
57 | 61 |
58 virtual ~SVGPathSegList(); | 62 virtual ~SVGPathSegList(); |
59 | 63 |
60 const SVGPathByteStream* byteStream() const; | 64 const SVGPathByteStream* byteStream() const; |
61 void clearByteStream() { m_byteStream.clear(); } | 65 void clearByteStream() { m_byteStream.clear(); } |
62 | 66 |
63 // SVGListPropertyHelper methods with |m_byteStream| sync: | 67 // SVGListPropertyHelper methods with |m_byteStream| sync: |
64 | 68 |
65 ItemPropertyType* at(size_t index) | 69 ItemPropertyType* at(size_t index) |
66 { | 70 { |
(...skipping 14 matching lines...) Expand all Loading... | |
81 | 85 |
82 return !m_byteStream || m_byteStream->isEmpty(); | 86 return !m_byteStream || m_byteStream->isEmpty(); |
83 } | 87 } |
84 | 88 |
85 void clear() | 89 void clear() |
86 { | 90 { |
87 clearByteStream(); | 91 clearByteStream(); |
88 Base::clear(); | 92 Base::clear(); |
89 } | 93 } |
90 | 94 |
91 void append(PassRefPtr<ItemPropertyType> passNewItem) | 95 void append(PassRefPtrWillBeRawPtr<ItemPropertyType> passNewItem) |
92 { | 96 { |
93 updateListFromByteStream(); | 97 updateListFromByteStream(); |
94 clearByteStream(); | 98 clearByteStream(); |
95 Base::append(passNewItem); | 99 Base::append(passNewItem); |
96 } | 100 } |
97 | 101 |
98 PassRefPtr<ItemPropertyType> initialize(PassRefPtr<ItemPropertyType> passIte m) | 102 PassRefPtrWillBeRawPtr<ItemPropertyType> initialize(PassRefPtrWillBeRawPtr<I temPropertyType> passItem) |
99 { | 103 { |
100 clearByteStream(); | 104 clearByteStream(); |
101 return Base::initialize(passItem); | 105 return Base::initialize(passItem); |
102 } | 106 } |
103 | 107 |
104 PassRefPtr<ItemPropertyType> getItem(size_t index, ExceptionState& exception State) | 108 PassRefPtrWillBeRawPtr<ItemPropertyType> getItem(size_t index, ExceptionStat e& exceptionState) |
105 { | 109 { |
106 updateListFromByteStream(); | 110 updateListFromByteStream(); |
107 return Base::getItem(index, exceptionState); | 111 return Base::getItem(index, exceptionState); |
108 } | 112 } |
109 | 113 |
110 PassRefPtr<ItemPropertyType> insertItemBefore(PassRefPtr<ItemPropertyType> p assItem, size_t index) | 114 PassRefPtrWillBeRawPtr<ItemPropertyType> insertItemBefore(PassRefPtrWillBeRa wPtr<ItemPropertyType> passItem, size_t index) |
111 { | 115 { |
112 updateListFromByteStream(); | 116 updateListFromByteStream(); |
113 clearByteStream(); | 117 clearByteStream(); |
114 return Base::insertItemBefore(passItem, index); | 118 return Base::insertItemBefore(passItem, index); |
115 } | 119 } |
116 | 120 |
117 PassRefPtr<ItemPropertyType> replaceItem(PassRefPtr<ItemPropertyType> passIt em, size_t index, ExceptionState& exceptionState) | 121 PassRefPtrWillBeRawPtr<ItemPropertyType> replaceItem(PassRefPtrWillBeRawPtr< ItemPropertyType> passItem, size_t index, ExceptionState& exceptionState) |
118 { | 122 { |
119 updateListFromByteStream(); | 123 updateListFromByteStream(); |
120 clearByteStream(); | 124 clearByteStream(); |
121 return Base::replaceItem(passItem, index, exceptionState); | 125 return Base::replaceItem(passItem, index, exceptionState); |
122 } | 126 } |
123 | 127 |
124 PassRefPtr<ItemPropertyType> removeItem(size_t index, ExceptionState& except ionState) | 128 PassRefPtrWillBeRawPtr<ItemPropertyType> removeItem(size_t index, ExceptionS tate& exceptionState) |
125 { | 129 { |
126 updateListFromByteStream(); | 130 updateListFromByteStream(); |
127 clearByteStream(); | 131 clearByteStream(); |
128 return Base::removeItem(index, exceptionState); | 132 return Base::removeItem(index, exceptionState); |
129 } | 133 } |
130 | 134 |
131 PassRefPtr<ItemPropertyType> appendItem(PassRefPtr<ItemPropertyType> passIte m); | 135 PassRefPtrWillBeRawPtr<ItemPropertyType> appendItem(PassRefPtrWillBeRawPtr<I temPropertyType> passItem); |
132 | 136 |
133 // SVGPropertyBase: | 137 // SVGPropertyBase: |
134 virtual PassRefPtr<SVGPropertyBase> cloneForAnimation(const String&) const o verride; | 138 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> cloneForAnimation(const Stri ng&) const override; |
135 virtual PassRefPtr<SVGPathSegList> clone() override; | 139 virtual PassRefPtrWillBeRawPtr<SVGPathSegList> clone() override; |
136 virtual String valueAsString() const override; | 140 virtual String valueAsString() const override; |
137 void setValueAsString(const String&, ExceptionState&); | 141 void setValueAsString(const String&, ExceptionState&); |
138 | 142 |
139 virtual void add(PassRefPtrWillBeRawPtr<SVGPropertyBase>, SVGElement*) overr ide; | 143 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; | 144 virtual void calculateAnimatedValue(SVGAnimationElement*, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, PassRef PtrWillBeRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRawPtr<SVGPropertyBase > toAtEndOfDurationValue, SVGElement*) override; |
141 virtual float calculateDistance(PassRefPtr<SVGPropertyBase> to, SVGElement*) override; | 145 virtual float calculateDistance(PassRefPtrWillBeRawPtr<SVGPropertyBase> to, SVGElement*) override; |
142 | 146 |
143 static AnimatedPropertyType classType() { return AnimatedPath; } | 147 static AnimatedPropertyType classType() { return AnimatedPath; } |
144 | 148 |
149 virtual void trace(Visitor*) override; | |
150 | |
145 private: | 151 private: |
146 SVGPathSegList(SVGPathElement*); | 152 SVGPathSegList(SVGPathElement*); |
haraken
2014/11/11 05:22:46
Add explicit.
sof
2014/11/12 13:45:08
Done.
| |
147 SVGPathSegList(SVGPathElement*, PassOwnPtr<SVGPathByteStream>); | 153 SVGPathSegList(SVGPathElement*, PassOwnPtr<SVGPathByteStream>); |
148 | 154 |
149 friend class SVGPathSegListBuilder; | 155 friend class SVGPathSegListBuilder; |
150 // This is only to be called from SVGPathSegListBuilder. | 156 // This is only to be called from SVGPathSegListBuilder. |
151 void appendWithoutByteStreamSync(PassRefPtr<ItemPropertyType> passNewItem) | 157 void appendWithoutByteStreamSync(PassRefPtrWillBeRawPtr<ItemPropertyType> pa ssNewItem) |
152 { | 158 { |
153 Base::append(passNewItem); | 159 Base::append(passNewItem); |
154 } | 160 } |
155 | 161 |
156 void updateListFromByteStream(); | 162 void updateListFromByteStream(); |
157 void invalidateList(); | 163 void invalidateList(); |
158 | 164 |
159 // FIXME: This pointer should be removed after SVGPathSeg has a tear-off. | 165 // FIXME: This pointer should be removed after SVGPathSeg has a tear-off. |
160 // FIXME: oilpan: This is raw-ptr to avoid reference cycles. | 166 // |
161 // SVGPathSegList is either owned by SVGAnimatedPath or | 167 // SVGPathSegList is either owned by SVGAnimatedPath or SVGPathSegListTearOf f. |
162 // SVGPathSegListTearOff. Both keep |contextElement| alive, | 168 // Both keep |contextElement| alive, so this ptr is always valid. |
163 // so this ptr is always valid. | 169 RawPtrWillBeMember<SVGPathElement> m_contextElement; |
164 SVGPathElement* m_contextElement; | |
165 | 170 |
166 mutable OwnPtr<SVGPathByteStream> m_byteStream; | 171 mutable OwnPtr<SVGPathByteStream> m_byteStream; |
167 bool m_listSyncedToByteStream; | 172 bool m_listSyncedToByteStream; |
168 }; | 173 }; |
169 | 174 |
170 inline PassRefPtr<SVGPathSegList> toSVGPathSegList(PassRefPtr<SVGPropertyBase> p assBase) | 175 inline PassRefPtrWillBeRawPtr<SVGPathSegList> toSVGPathSegList(PassRefPtrWillBeR awPtr<SVGPropertyBase> passBase) |
171 { | 176 { |
172 RefPtr<SVGPropertyBase> base = passBase; | 177 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; |
173 ASSERT(base->type() == SVGPathSegList::classType()); | 178 ASSERT(base->type() == SVGPathSegList::classType()); |
174 return static_pointer_cast<SVGPathSegList>(base.release()); | 179 return static_pointer_cast<SVGPathSegList>(base.release()); |
175 } | 180 } |
176 | 181 |
177 } // namespace blink | 182 } // namespace blink |
178 | 183 |
179 #endif | 184 #endif |
OLD | NEW |