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

Side by Side Diff: Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.h

Issue 12288020: Merge 142759 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 23 matching lines...) Expand all
34 typedef SVGAnimatedListPropertyTearOff<SVGPathSegList> AnimatedListPropertyT earOff; 34 typedef SVGAnimatedListPropertyTearOff<SVGPathSegList> AnimatedListPropertyT earOff;
35 typedef SVGPropertyTraits<SVGPathSegList>::ListItemType ListItemType; 35 typedef SVGPropertyTraits<SVGPathSegList>::ListItemType ListItemType;
36 typedef PassRefPtr<SVGPathSeg> PassListItemType; 36 typedef PassRefPtr<SVGPathSeg> PassListItemType;
37 37
38 static PassRefPtr<SVGPathSegListPropertyTearOff> create(AnimatedListProperty TearOff* animatedProperty, SVGPropertyRole role, SVGPathSegRole pathSegRole, SVG PathSegList& values, ListWrapperCache& wrappers) 38 static PassRefPtr<SVGPathSegListPropertyTearOff> create(AnimatedListProperty TearOff* animatedProperty, SVGPropertyRole role, SVGPathSegRole pathSegRole, SVG PathSegList& values, ListWrapperCache& wrappers)
39 { 39 {
40 ASSERT(animatedProperty); 40 ASSERT(animatedProperty);
41 return adoptRef(new SVGPathSegListPropertyTearOff(animatedProperty, role , pathSegRole, values, wrappers)); 41 return adoptRef(new SVGPathSegListPropertyTearOff(animatedProperty, role , pathSegRole, values, wrappers));
42 } 42 }
43 43
44 int removeItemFromList(const ListItemType& removeItem, bool shouldSynchroniz eWrappers) 44 int findItem(const ListItemType& item) const
45 { 45 {
46 ASSERT(m_values); 46 ASSERT(m_values);
47
47 unsigned size = m_values->size(); 48 unsigned size = m_values->size();
48 for (unsigned i = 0; i < size; ++i) { 49 for (size_t i = 0; i < size; ++i) {
49 ListItemType& item = m_values->at(i); 50 if (item == m_values->at(i))
50 if (item != removeItem) 51 return i;
51 continue;
52
53 m_values->remove(i);
54
55 if (shouldSynchronizeWrappers)
56 commitChange();
57
58 return i;
59 } 52 }
60 53
61 return -1; 54 return -1;
62 } 55 }
63 56
57 void removeItemFromList(size_t itemIndex, bool shouldSynchronizeWrappers)
58 {
59 ASSERT(m_values);
60 ASSERT_WITH_SECURITY_IMPLICATION(itemIndex < m_values->size());
61
62 m_values->remove(itemIndex);
63
64 if (shouldSynchronizeWrappers)
65 commitChange();
66 }
67
64 // SVGList API 68 // SVGList API
65 void clear(ExceptionCode&); 69 void clear(ExceptionCode&);
66 70
67 PassListItemType initialize(PassListItemType passNewItem, ExceptionCode& ec) 71 PassListItemType initialize(PassListItemType passNewItem, ExceptionCode& ec)
68 { 72 {
69 // Not specified, but FF/Opera do it this way, and it's just sane. 73 // Not specified, but FF/Opera do it this way, and it's just sane.
70 if (!passNewItem) { 74 if (!passNewItem) {
71 ec = SVGException::SVG_WRONG_TYPE_ERR; 75 ec = SVGException::SVG_WRONG_TYPE_ERR;
72 return 0; 76 return 0;
73 } 77 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 ASSERT(m_values); 146 ASSERT(m_values);
143 m_values->commitChange(m_animatedProperty->contextElement(), ListModific ationUnknown); 147 m_values->commitChange(m_animatedProperty->contextElement(), ListModific ationUnknown);
144 } 148 }
145 149
146 virtual void commitChange(ListModification listModification) 150 virtual void commitChange(ListModification listModification)
147 { 151 {
148 ASSERT(m_values); 152 ASSERT(m_values);
149 m_values->commitChange(m_animatedProperty->contextElement(), listModific ation); 153 m_values->commitChange(m_animatedProperty->contextElement(), listModific ation);
150 } 154 }
151 155
152 virtual void processIncomingListItemValue(const ListItemType& newItem, unsig ned* indexToModify); 156 virtual bool processIncomingListItemValue(const ListItemType& newItem, unsig ned* indexToModify) OVERRIDE;
153 virtual void processIncomingListItemWrapper(RefPtr<ListItemTearOff>&, unsign ed*) 157 virtual bool processIncomingListItemWrapper(RefPtr<ListItemTearOff>&, unsign ed*)
154 { 158 {
155 ASSERT_NOT_REACHED(); 159 ASSERT_NOT_REACHED();
160 return true;
156 } 161 }
157 162
158 private: 163 private:
159 RefPtr<AnimatedListPropertyTearOff> m_animatedProperty; 164 RefPtr<AnimatedListPropertyTearOff> m_animatedProperty;
160 SVGPathSegRole m_pathSegRole; 165 SVGPathSegRole m_pathSegRole;
161 }; 166 };
162 167
163 } 168 }
164 169
165 #endif // ENABLE(SVG) 170 #endif // ENABLE(SVG)
166 #endif // SVGListPropertyTearOff_h 171 #endif // SVGListPropertyTearOff_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698