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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return m_values.at(index).get(); | 68 return m_values.at(index).get(); |
69 } | 69 } |
70 | 70 |
71 const ItemPropertyType* at(size_t index) const | 71 const ItemPropertyType* at(size_t index) const |
72 { | 72 { |
73 return const_cast<SVGListPropertyHelper<Derived, ItemProperty>*>(this)->
at(index); | 73 return const_cast<SVGListPropertyHelper<Derived, ItemProperty>*>(this)->
at(index); |
74 } | 74 } |
75 | 75 |
76 class ConstIterator { | 76 class ConstIterator { |
77 private: | 77 private: |
78 typedef typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType> >
::const_iterator WrappedType; | 78 typedef typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType>>:
:const_iterator WrappedType; |
79 | 79 |
80 public: | 80 public: |
81 ConstIterator(WrappedType it) | 81 ConstIterator(WrappedType it) |
82 : m_it(it) | 82 : m_it(it) |
83 { | 83 { |
84 } | 84 } |
85 | 85 |
86 ConstIterator& operator++() { ++m_it; return *this; } | 86 ConstIterator& operator++() { ++m_it; return *this; } |
87 | 87 |
88 bool operator==(const ConstIterator& o) const { return m_it == o.m_it; } | 88 bool operator==(const ConstIterator& o) const { return m_it == o.m_it; } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 virtual PassRefPtrWillBeRawPtr<ItemPropertyType> createPaddingItem() const | 167 virtual PassRefPtrWillBeRawPtr<ItemPropertyType> createPaddingItem() const |
168 { | 168 { |
169 return ItemPropertyType::create(); | 169 return ItemPropertyType::create(); |
170 } | 170 } |
171 | 171 |
172 private: | 172 private: |
173 inline bool checkIndexBound(size_t, ExceptionState&); | 173 inline bool checkIndexBound(size_t, ExceptionState&); |
174 bool removeFromOldOwnerListAndAdjustIndex(PassRefPtrWillBeRawPtr<ItemPropert
yType>, size_t* indexToModify); | 174 bool removeFromOldOwnerListAndAdjustIndex(PassRefPtrWillBeRawPtr<ItemPropert
yType>, size_t* indexToModify); |
175 size_t findItem(PassRefPtrWillBeRawPtr<ItemPropertyType>); | 175 size_t findItem(PassRefPtrWillBeRawPtr<ItemPropertyType>); |
176 | 176 |
177 WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType> > m_values; | 177 WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType>> m_values; |
178 | 178 |
179 static PassRefPtrWillBeRawPtr<Derived> toDerived(PassRefPtrWillBeRawPtr<SVGP
ropertyBase> passBase) | 179 static PassRefPtrWillBeRawPtr<Derived> toDerived(PassRefPtrWillBeRawPtr<SVGP
ropertyBase> passBase) |
180 { | 180 { |
181 if (!passBase) | 181 if (!passBase) |
182 return nullptr; | 182 return nullptr; |
183 | 183 |
184 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; | 184 RefPtrWillBeRawPtr<SVGPropertyBase> base = passBase; |
185 ASSERT(base->type() == Derived::classType()); | 185 ASSERT(base->type() == Derived::classType()); |
186 return static_pointer_cast<Derived>(base); | 186 return static_pointer_cast<Derived>(base); |
187 } | 187 } |
(...skipping 11 matching lines...) Expand all Loading... |
199 return false; | 199 return false; |
200 } | 200 } |
201 | 201 |
202 return true; | 202 return true; |
203 } | 203 } |
204 | 204 |
205 template<typename Derived, typename ItemProperty> | 205 template<typename Derived, typename ItemProperty> |
206 void SVGListPropertyHelper<Derived, ItemProperty>::clear() | 206 void SVGListPropertyHelper<Derived, ItemProperty>::clear() |
207 { | 207 { |
208 // detach all list items as they are no longer part of this list | 208 // detach all list items as they are no longer part of this list |
209 typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType> >::const_iter
ator it = m_values.begin(); | 209 typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType>>::const_itera
tor it = m_values.begin(); |
210 typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType> >::const_iter
ator itEnd = m_values.end(); | 210 typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType>>::const_itera
tor itEnd = m_values.end(); |
211 for (; it != itEnd; ++it) { | 211 for (; it != itEnd; ++it) { |
212 ASSERT((*it)->ownerList() == this); | 212 ASSERT((*it)->ownerList() == this); |
213 (*it)->setOwnerList(0); | 213 (*it)->setOwnerList(0); |
214 } | 214 } |
215 | 215 |
216 m_values.clear(); | 216 m_values.clear(); |
217 } | 217 } |
218 | 218 |
219 template<typename Derived, typename ItemProperty> | 219 template<typename Derived, typename ItemProperty> |
220 PassRefPtrWillBeRawPtr<ItemProperty> SVGListPropertyHelper<Derived, ItemProperty
>::initialize(PassRefPtrWillBeRawPtr<ItemProperty> passNewItem) | 220 PassRefPtrWillBeRawPtr<ItemProperty> SVGListPropertyHelper<Derived, ItemProperty
>::initialize(PassRefPtrWillBeRawPtr<ItemProperty> passNewItem) |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 { | 374 { |
375 return m_values.find(item); | 375 return m_values.find(item); |
376 } | 376 } |
377 | 377 |
378 template<typename Derived, typename ItemProperty> | 378 template<typename Derived, typename ItemProperty> |
379 void SVGListPropertyHelper<Derived, ItemProperty>::deepCopy(PassRefPtrWillBeRawP
tr<Derived> passFrom) | 379 void SVGListPropertyHelper<Derived, ItemProperty>::deepCopy(PassRefPtrWillBeRawP
tr<Derived> passFrom) |
380 { | 380 { |
381 RefPtrWillBeRawPtr<Derived> from = passFrom; | 381 RefPtrWillBeRawPtr<Derived> from = passFrom; |
382 | 382 |
383 clear(); | 383 clear(); |
384 typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType> >::const_iter
ator it = from->m_values.begin(); | 384 typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType>>::const_itera
tor it = from->m_values.begin(); |
385 typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType> >::const_iter
ator itEnd = from->m_values.end(); | 385 typename WillBeHeapVector<RefPtrWillBeMember<ItemPropertyType>>::const_itera
tor itEnd = from->m_values.end(); |
386 for (; it != itEnd; ++it) { | 386 for (; it != itEnd; ++it) { |
387 append((*it)->clone()); | 387 append((*it)->clone()); |
388 } | 388 } |
389 } | 389 } |
390 | 390 |
391 template<typename Derived, typename ItemProperty> | 391 template<typename Derived, typename ItemProperty> |
392 bool SVGListPropertyHelper<Derived, ItemProperty>::adjustFromToListValues(PassRe
fPtrWillBeRawPtr<Derived> passFromList, PassRefPtrWillBeRawPtr<Derived> passToLi
st, float percentage, AnimationMode mode) | 392 bool SVGListPropertyHelper<Derived, ItemProperty>::adjustFromToListValues(PassRe
fPtrWillBeRawPtr<Derived> passFromList, PassRefPtrWillBeRawPtr<Derived> passToLi
st, float percentage, AnimationMode mode) |
393 { | 393 { |
394 RefPtrWillBeRawPtr<Derived> fromList = passFromList; | 394 RefPtrWillBeRawPtr<Derived> fromList = passFromList; |
395 RefPtrWillBeRawPtr<Derived> toList = passToList; | 395 RefPtrWillBeRawPtr<Derived> toList = passToList; |
(...skipping 22 matching lines...) Expand all Loading... |
418 for (size_t i = 0; i < paddingCount; ++i) | 418 for (size_t i = 0; i < paddingCount; ++i) |
419 append(createPaddingItem()); | 419 append(createPaddingItem()); |
420 } | 420 } |
421 | 421 |
422 return true; | 422 return true; |
423 } | 423 } |
424 | 424 |
425 } | 425 } |
426 | 426 |
427 #endif // SVGListPropertyHelper_h | 427 #endif // SVGListPropertyHelper_h |
OLD | NEW |