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

Side by Side Diff: Source/core/dom/DatasetDOMStringMap.cpp

Issue 674553002: Move parts of core/dom to C++11 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make Windows shut up when I just try following the style guide Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/ContextLifecycleNotifier.cpp ('k') | Source/core/dom/Element.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) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 void DatasetDOMStringMap::deref() 149 void DatasetDOMStringMap::deref()
150 { 150 {
151 m_element->deref(); 151 m_element->deref();
152 } 152 }
153 #endif 153 #endif
154 154
155 void DatasetDOMStringMap::getNames(Vector<String>& names) 155 void DatasetDOMStringMap::getNames(Vector<String>& names)
156 { 156 {
157 AttributeCollection attributes = m_element->attributes(); 157 AttributeCollection attributes = m_element->attributes();
158 AttributeCollection::iterator end = attributes.end(); 158 for (const Attribute& attr : attributes) {
159 for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it) { 159 if (isValidAttributeName(attr.localName()))
160 if (isValidAttributeName(it->localName())) 160 names.append(convertAttributeNameToPropertyName(attr.localName()));
161 names.append(convertAttributeNameToPropertyName(it->localName()));
162 } 161 }
163 } 162 }
164 163
165 String DatasetDOMStringMap::item(const String& name) 164 String DatasetDOMStringMap::item(const String& name)
166 { 165 {
167 AttributeCollection attributes = m_element->attributes(); 166 AttributeCollection attributes = m_element->attributes();
168 AttributeCollection::iterator end = attributes.end(); 167 for (const Attribute& attr : attributes) {
169 for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it) { 168 if (propertyNameMatchesAttributeName(name, attr.localName()))
170 if (propertyNameMatchesAttributeName(name, it->localName())) 169 return attr.value();
171 return it->value();
172 } 170 }
173 171
174 return String(); 172 return String();
175 } 173 }
176 174
177 bool DatasetDOMStringMap::contains(const String& name) 175 bool DatasetDOMStringMap::contains(const String& name)
178 { 176 {
179 AttributeCollection attributes = m_element->attributes(); 177 AttributeCollection attributes = m_element->attributes();
180 AttributeCollection::iterator end = attributes.end(); 178 for (const Attribute& attr : attributes) {
181 for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it) { 179 if (propertyNameMatchesAttributeName(name, attr.localName()))
182 if (propertyNameMatchesAttributeName(name, it->localName()))
183 return true; 180 return true;
184 } 181 }
185 return false; 182 return false;
186 } 183 }
187 184
188 void DatasetDOMStringMap::setItem(const String& name, const String& value, Excep tionState& exceptionState) 185 void DatasetDOMStringMap::setItem(const String& name, const String& value, Excep tionState& exceptionState)
189 { 186 {
190 if (!isValidPropertyName(name)) { 187 if (!isValidPropertyName(name)) {
191 exceptionState.throwDOMException(SyntaxError, "'" + name + "' is not a v alid property name."); 188 exceptionState.throwDOMException(SyntaxError, "'" + name + "' is not a v alid property name.");
192 return; 189 return;
(...skipping 14 matching lines...) Expand all
207 return false; 204 return false;
208 } 205 }
209 206
210 void DatasetDOMStringMap::trace(Visitor* visitor) 207 void DatasetDOMStringMap::trace(Visitor* visitor)
211 { 208 {
212 visitor->trace(m_element); 209 visitor->trace(m_element);
213 DOMStringMap::trace(visitor); 210 DOMStringMap::trace(visitor);
214 } 211 }
215 212
216 } // namespace blink 213 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/ContextLifecycleNotifier.cpp ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698