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

Side by Side Diff: Source/core/svg/properties/NewSVGListPropertyTearOffHelper.h

Issue 195313003: [SVG2] Add getters and setters to SVG*List interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tryserver rebase Created 6 years, 9 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) 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 class NewSVGListPropertyTearOffHelper : public NewSVGPropertyTearOff<ListPropert y> { 74 class NewSVGListPropertyTearOffHelper : public NewSVGPropertyTearOff<ListPropert y> {
75 public: 75 public:
76 typedef ListProperty ListPropertyType; 76 typedef ListProperty ListPropertyType;
77 typedef typename ListPropertyType::ItemPropertyType ItemPropertyType; 77 typedef typename ListPropertyType::ItemPropertyType ItemPropertyType;
78 typedef typename ItemPropertyType::TearOffType ItemTearOffType; 78 typedef typename ItemPropertyType::TearOffType ItemTearOffType;
79 typedef ListItemPropertyTraits<ItemPropertyType> ItemTraits; 79 typedef ListItemPropertyTraits<ItemPropertyType> ItemTraits;
80 80
81 // SVG*List DOM interface: 81 // SVG*List DOM interface:
82 82
83 // WebIDL requires "unsigned long" type instead of size_t. 83 // WebIDL requires "unsigned long" type instead of size_t.
84 unsigned long numberOfItems() 84 unsigned long length()
85 { 85 {
86 return toDerived()->target()->numberOfItems(); 86 return toDerived()->target()->length();
87 } 87 }
88 88
89 void clear(ExceptionState& exceptionState) 89 void clear(ExceptionState& exceptionState)
90 { 90 {
91 if (toDerived()->isImmutable()) { 91 if (toDerived()->isImmutable()) {
92 exceptionState.throwDOMException(NoModificationAllowedError, "The ob ject is read-only."); 92 exceptionState.throwDOMException(NoModificationAllowedError, "The ob ject is read-only.");
93 return; 93 return;
94 } 94 }
95 95
96 toDerived()->target()->clear(); 96 toDerived()->target()->clear();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 exceptionState.throwTypeError("An invalid item cannot be replaced wi th an existing list item."); 155 exceptionState.throwTypeError("An invalid item cannot be replaced wi th an existing list item.");
156 return nullptr; 156 return nullptr;
157 } 157 }
158 158
159 RefPtr<ItemPropertyType> value = toDerived()->target()->replaceItem(getV alueForInsertionFromTearOff(item), index, exceptionState); 159 RefPtr<ItemPropertyType> value = toDerived()->target()->replaceItem(getV alueForInsertionFromTearOff(item), index, exceptionState);
160 toDerived()->commitChange(); 160 toDerived()->commitChange();
161 161
162 return createItemTearOff(value.release()); 162 return createItemTearOff(value.release());
163 } 163 }
164 164
165 bool anonymousIndexedSetter(unsigned index, PassRefPtr<ItemTearOffType> pass Item, ExceptionState& exceptionState)
166 {
167 replaceItem(passItem, index, exceptionState);
168 return true;
169 }
170
165 PassRefPtr<ItemTearOffType> removeItem(unsigned long index, ExceptionState& exceptionState) 171 PassRefPtr<ItemTearOffType> removeItem(unsigned long index, ExceptionState& exceptionState)
166 { 172 {
167 RefPtr<ItemPropertyType> value = toDerived()->target()->removeItem(index , exceptionState); 173 RefPtr<ItemPropertyType> value = toDerived()->target()->removeItem(index , exceptionState);
168 toDerived()->commitChange(); 174 toDerived()->commitChange();
169 175
170 return createItemTearOff(value.release()); 176 return createItemTearOff(value.release());
171 } 177 }
172 178
173 PassRefPtr<ItemTearOffType> appendItem(PassRefPtr<ItemTearOffType> passItem, ExceptionState& exceptionState) 179 PassRefPtr<ItemTearOffType> appendItem(PassRefPtr<ItemTearOffType> passItem, ExceptionState& exceptionState)
174 { 180 {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 return ItemTraits::createTearOff(value, toDerived()->contextElement(), t oDerived()->propertyIsAnimVal(), toDerived()->attributeName()); 215 return ItemTraits::createTearOff(value, toDerived()->contextElement(), t oDerived()->propertyIsAnimVal(), toDerived()->attributeName());
210 } 216 }
211 217
212 private: 218 private:
213 Derived* toDerived() { return static_cast<Derived*>(this); } 219 Derived* toDerived() { return static_cast<Derived*>(this); }
214 }; 220 };
215 221
216 } 222 }
217 223
218 #endif // NewSVGListPropertyTearOffHelper_h 224 #endif // NewSVGListPropertyTearOffHelper_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698