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

Side by Side Diff: Source/core/svg/SVGStringListTearOff.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: s/slength/size 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
« no previous file with comments | « Source/core/svg/SVGStringList.idl ('k') | Source/core/svg/SVGTransformList.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 28 matching lines...) Expand all
39 class SVGStringListTearOff : public NewSVGPropertyTearOff<SVGStringList>, public ScriptWrappable { 39 class SVGStringListTearOff : public NewSVGPropertyTearOff<SVGStringList>, public ScriptWrappable {
40 public: 40 public:
41 static PassRefPtr<SVGStringListTearOff> create(PassRefPtr<SVGStringList> tar get, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName = nullQName()) 41 static PassRefPtr<SVGStringListTearOff> create(PassRefPtr<SVGStringList> tar get, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName = nullQName())
42 { 42 {
43 return adoptRef(new SVGStringListTearOff(target, contextElement, propert yIsAnimVal, attributeName)); 43 return adoptRef(new SVGStringListTearOff(target, contextElement, propert yIsAnimVal, attributeName));
44 } 44 }
45 45
46 // SVGStringList DOM interface: 46 // SVGStringList DOM interface:
47 47
48 // WebIDL requires "unsigned long" type instead of size_t. 48 // WebIDL requires "unsigned long" type instead of size_t.
49 unsigned long numberOfItems() 49 unsigned long length()
50 { 50 {
51 return target()->numberOfItems(); 51 return target()->length();
52 } 52 }
53 53
54 void clear(ExceptionState& exceptionState) 54 void clear(ExceptionState& exceptionState)
55 { 55 {
56 if (isImmutable()) { 56 if (isImmutable()) {
57 exceptionState.throwDOMException(NoModificationAllowedError, "The ob ject is read-only."); 57 exceptionState.throwDOMException(NoModificationAllowedError, "The ob ject is read-only.");
58 return; 58 return;
59 } 59 }
60 60
61 target()->clear(); 61 target()->clear();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 exceptionState.throwDOMException(NoModificationAllowedError, "The ob ject is read-only."); 99 exceptionState.throwDOMException(NoModificationAllowedError, "The ob ject is read-only.");
100 return String(); 100 return String();
101 } 101 }
102 102
103 target()->replaceItem(item, index, exceptionState); 103 target()->replaceItem(item, index, exceptionState);
104 commitChange(); 104 commitChange();
105 105
106 return item; 106 return item;
107 } 107 }
108 108
109 bool anonymousIndexedSetter(unsigned index, const String& item, ExceptionSta te& exceptionState)
110 {
111 replaceItem(item, index, exceptionState);
112 return true;
113 }
114
109 String removeItem(unsigned long index, ExceptionState& exceptionState) 115 String removeItem(unsigned long index, ExceptionState& exceptionState)
110 { 116 {
111 if (isImmutable()) { 117 if (isImmutable()) {
112 exceptionState.throwDOMException(NoModificationAllowedError, "The ob ject is read-only."); 118 exceptionState.throwDOMException(NoModificationAllowedError, "The ob ject is read-only.");
113 return String(); 119 return String();
114 } 120 }
115 121
116 String removedItem = target()->removeItem(index, exceptionState); 122 String removedItem = target()->removeItem(index, exceptionState);
117 commitChange(); 123 commitChange();
118 124
(...skipping 13 matching lines...) Expand all
132 return item; 138 return item;
133 } 139 }
134 140
135 protected: 141 protected:
136 SVGStringListTearOff(PassRefPtr<SVGStringList>, SVGElement*, PropertyIsAnimV alType, const QualifiedName&); 142 SVGStringListTearOff(PassRefPtr<SVGStringList>, SVGElement*, PropertyIsAnimV alType, const QualifiedName&);
137 }; 143 };
138 144
139 } // namespace WebCore 145 } // namespace WebCore
140 146
141 #endif // SVGStringListTearOff_h_ 147 #endif // SVGStringListTearOff_h_
OLDNEW
« no previous file with comments | « Source/core/svg/SVGStringList.idl ('k') | Source/core/svg/SVGTransformList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698