Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: Source/core/svg/properties/NewSVGListPropertyHelper.h

Issue 112003003: [SVG] SVGLength{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: revert aggressive svgAttributeChanged, add NeedsRebaseline Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGUseElement.cpp ('k') | Source/core/svg/properties/NewSVGListPropertyTearOffHelper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/properties/NewSVGListPropertyHelper.h
diff --git a/Source/core/svg/properties/NewSVGListPropertyHelper.h b/Source/core/svg/properties/NewSVGListPropertyHelper.h
index c6c2e16040fb6edfc999960409d72890a618bfaa..a1367f4674b1233f9294a6293bf25e33a9048e55 100644
--- a/Source/core/svg/properties/NewSVGListPropertyHelper.h
+++ b/Source/core/svg/properties/NewSVGListPropertyHelper.h
@@ -45,6 +45,11 @@ class NewSVGListPropertyHelper : public NewSVGPropertyBase {
public:
typedef ItemProperty ItemPropertyType;
+ NewSVGListPropertyHelper()
+ : NewSVGPropertyBase(Derived::classType())
+ {
+ }
+
// used from Blink C++ code:
ItemPropertyType* at(size_t index)
@@ -58,6 +63,38 @@ public:
return const_cast<NewSVGListPropertyHelper<Derived, ItemProperty>*>(this)->at(index);
}
+ class ConstIterator {
+ private:
+ typedef typename Vector<RefPtr<ItemPropertyType> >::const_iterator WrappedType;
+
+ public:
+ ConstIterator(WrappedType it)
+ : m_it(it)
+ {
+ }
+
+ ConstIterator& operator++() { ++m_it; return *this; }
+
+ bool operator==(const ConstIterator& o) const { return m_it == o.m_it; }
+ bool operator!=(const ConstIterator& o) const { return m_it != o.m_it; }
+
+ PassRefPtr<ItemPropertyType> operator*() { return *m_it; }
+ PassRefPtr<ItemPropertyType> operator->() { return *m_it; }
+
+ private:
+ WrappedType m_it;
+ };
+
+ ConstIterator begin() const
+ {
+ return ConstIterator(m_values.begin());
+ }
+
+ ConstIterator end() const
+ {
+ return ConstIterator(m_values.end());
+ }
+
void append(PassRefPtr<ItemPropertyType> newItem)
{
ASSERT(newItem);
@@ -98,7 +135,7 @@ protected:
inline bool checkIndexBound(size_t, ExceptionState&);
bool removeFromOldOwnerListAndAdjustIndex(PassRefPtr<ItemPropertyType>, PassRefPtr<Derived>, size_t* indexToModify);
size_t findItem(PassRefPtr<ItemPropertyType>);
- void deepCopy(const Derived&);
+ void deepCopy(PassRefPtr<Derived>);
Vector<RefPtr<ItemPropertyType> > m_values;
};
@@ -269,11 +306,15 @@ size_t NewSVGListPropertyHelper<Derived, ItemProperty>::findItem(PassRefPtr<Item
}
template<typename Derived, typename ItemProperty>
-void NewSVGListPropertyHelper<Derived, ItemProperty>::deepCopy(const Derived& from)
+void NewSVGListPropertyHelper<Derived, ItemProperty>::deepCopy(PassRefPtr<Derived> passFrom)
{
+ RefPtr<Derived> from = passFrom;
+
m_values.clear();
- for (size_t i = 0; i < from.m_values.size(); ++i) {
- m_values.append(from.m_values[i]->clone());
+ typename Vector<RefPtr<ItemPropertyType> >::const_iterator it = from->m_values.begin();
+ typename Vector<RefPtr<ItemPropertyType> >::const_iterator itEnd = from->m_values.end();
+ for (; it != itEnd; ++it) {
+ m_values.append((*it)->clone());
}
}
« no previous file with comments | « Source/core/svg/SVGUseElement.cpp ('k') | Source/core/svg/properties/NewSVGListPropertyTearOffHelper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698