| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 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 if (!m_element->hasAttributes()) | |
| 158 return; | |
| 159 | |
| 160 AttributeCollection attributes = m_element->attributes(); | 157 AttributeCollection attributes = m_element->attributes(); |
| 161 AttributeCollection::const_iterator end = attributes.end(); | 158 AttributeCollection::const_iterator end = attributes.end(); |
| 162 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { | 159 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { |
| 163 if (isValidAttributeName(it->localName())) | 160 if (isValidAttributeName(it->localName())) |
| 164 names.append(convertAttributeNameToPropertyName(it->localName())); | 161 names.append(convertAttributeNameToPropertyName(it->localName())); |
| 165 } | 162 } |
| 166 } | 163 } |
| 167 | 164 |
| 168 String DatasetDOMStringMap::item(const String& name) | 165 String DatasetDOMStringMap::item(const String& name) |
| 169 { | 166 { |
| 170 if (!m_element->hasAttributes()) | |
| 171 return String(); | |
| 172 | |
| 173 AttributeCollection attributes = m_element->attributes(); | 167 AttributeCollection attributes = m_element->attributes(); |
| 174 AttributeCollection::const_iterator end = attributes.end(); | 168 AttributeCollection::const_iterator end = attributes.end(); |
| 175 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { | 169 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { |
| 176 if (propertyNameMatchesAttributeName(name, it->localName())) | 170 if (propertyNameMatchesAttributeName(name, it->localName())) |
| 177 return it->value(); | 171 return it->value(); |
| 178 } | 172 } |
| 179 | 173 |
| 180 return String(); | 174 return String(); |
| 181 } | 175 } |
| 182 | 176 |
| 183 bool DatasetDOMStringMap::contains(const String& name) | 177 bool DatasetDOMStringMap::contains(const String& name) |
| 184 { | 178 { |
| 185 if (!m_element->hasAttributes()) | |
| 186 return false; | |
| 187 | |
| 188 AttributeCollection attributes = m_element->attributes(); | 179 AttributeCollection attributes = m_element->attributes(); |
| 189 AttributeCollection::const_iterator end = attributes.end(); | 180 AttributeCollection::const_iterator end = attributes.end(); |
| 190 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { | 181 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { |
| 191 if (propertyNameMatchesAttributeName(name, it->localName())) | 182 if (propertyNameMatchesAttributeName(name, it->localName())) |
| 192 return true; | 183 return true; |
| 193 } | 184 } |
| 194 return false; | 185 return false; |
| 195 } | 186 } |
| 196 | 187 |
| 197 void DatasetDOMStringMap::setItem(const String& name, const String& value, Excep
tionState& exceptionState) | 188 void DatasetDOMStringMap::setItem(const String& name, const String& value, Excep
tionState& exceptionState) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 216 return false; | 207 return false; |
| 217 } | 208 } |
| 218 | 209 |
| 219 void DatasetDOMStringMap::trace(Visitor* visitor) | 210 void DatasetDOMStringMap::trace(Visitor* visitor) |
| 220 { | 211 { |
| 221 visitor->trace(m_element); | 212 visitor->trace(m_element); |
| 222 DOMStringMap::trace(visitor); | 213 DOMStringMap::trace(visitor); |
| 223 } | 214 } |
| 224 | 215 |
| 225 } // namespace blink | 216 } // namespace blink |
| OLD | NEW |