| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |