| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 Apple Inc. All | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 Apple Inc. All |
| 5 * rights reserved. | 5 * rights reserved. |
| 6 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 6 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 NamedItemCache* cache = NamedItemCache::create(); | 136 NamedItemCache* cache = NamedItemCache::create(); |
| 137 HashSet<StringImpl*> foundInputElements; | 137 HashSet<StringImpl*> foundInputElements; |
| 138 | 138 |
| 139 for (const auto& listedElement : listedElements()) { | 139 for (const auto& listedElement : listedElements()) { |
| 140 if (listedElement->isEnumeratable()) { | 140 if (listedElement->isEnumeratable()) { |
| 141 HTMLElement* element = toHTMLElement(listedElement); | 141 HTMLElement* element = toHTMLElement(listedElement); |
| 142 const AtomicString& idAttrVal = element->getIdAttribute(); | 142 const AtomicString& idAttrVal = element->getIdAttribute(); |
| 143 const AtomicString& nameAttrVal = element->getNameAttribute(); | 143 const AtomicString& nameAttrVal = element->getNameAttribute(); |
| 144 if (!idAttrVal.isEmpty()) { | 144 if (!idAttrVal.isEmpty()) { |
| 145 cache->addElementWithId(idAttrVal, element); | 145 cache->addElementWithId(idAttrVal, element); |
| 146 foundInputElements.add(idAttrVal.impl()); | 146 foundInputElements.insert(idAttrVal.impl()); |
| 147 } | 147 } |
| 148 if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal) { | 148 if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal) { |
| 149 cache->addElementWithName(nameAttrVal, element); | 149 cache->addElementWithName(nameAttrVal, element); |
| 150 foundInputElements.add(nameAttrVal.impl()); | 150 foundInputElements.insert(nameAttrVal.impl()); |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 // HTMLFormControlsCollection doesn't support named getter for IMG | 155 // HTMLFormControlsCollection doesn't support named getter for IMG |
| 156 // elements. However we still need to handle IMG elements here because | 156 // elements. However we still need to handle IMG elements here because |
| 157 // HTMLFormElement named getter relies on this. | 157 // HTMLFormElement named getter relies on this. |
| 158 for (const auto& element : formImageElements()) { | 158 for (const auto& element : formImageElements()) { |
| 159 const AtomicString& idAttrVal = element->getIdAttribute(); | 159 const AtomicString& idAttrVal = element->getIdAttribute(); |
| 160 const AtomicString& nameAttrVal = element->getNameAttribute(); | 160 const AtomicString& nameAttrVal = element->getNameAttribute(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // its name if it contributes both, they differ from each other, and neither | 198 // its name if it contributes both, they differ from each other, and neither |
| 199 // is the duplicate of an earlier entry. | 199 // is the duplicate of an earlier entry. |
| 200 HashSet<AtomicString> existingNames; | 200 HashSet<AtomicString> existingNames; |
| 201 unsigned length = this->length(); | 201 unsigned length = this->length(); |
| 202 for (unsigned i = 0; i < length; ++i) { | 202 for (unsigned i = 0; i < length; ++i) { |
| 203 HTMLElement* element = item(i); | 203 HTMLElement* element = item(i); |
| 204 DCHECK(element); | 204 DCHECK(element); |
| 205 const AtomicString& idAttribute = element->getIdAttribute(); | 205 const AtomicString& idAttribute = element->getIdAttribute(); |
| 206 if (!idAttribute.isEmpty()) { | 206 if (!idAttribute.isEmpty()) { |
| 207 HashSet<AtomicString>::AddResult addResult = | 207 HashSet<AtomicString>::AddResult addResult = |
| 208 existingNames.add(idAttribute); | 208 existingNames.insert(idAttribute); |
| 209 if (addResult.isNewEntry) | 209 if (addResult.isNewEntry) |
| 210 names.push_back(idAttribute); | 210 names.push_back(idAttribute); |
| 211 } | 211 } |
| 212 const AtomicString& nameAttribute = element->getNameAttribute(); | 212 const AtomicString& nameAttribute = element->getNameAttribute(); |
| 213 if (!nameAttribute.isEmpty()) { | 213 if (!nameAttribute.isEmpty()) { |
| 214 HashSet<AtomicString>::AddResult addResult = | 214 HashSet<AtomicString>::AddResult addResult = |
| 215 existingNames.add(nameAttribute); | 215 existingNames.insert(nameAttribute); |
| 216 if (addResult.isNewEntry) | 216 if (addResult.isNewEntry) |
| 217 names.push_back(nameAttribute); | 217 names.push_back(nameAttribute); |
| 218 } | 218 } |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 DEFINE_TRACE(HTMLFormControlsCollection) { | 222 DEFINE_TRACE(HTMLFormControlsCollection) { |
| 223 visitor->trace(m_cachedElement); | 223 visitor->trace(m_cachedElement); |
| 224 HTMLCollection::trace(visitor); | 224 HTMLCollection::trace(visitor); |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace blink | 227 } // namespace blink |
| OLD | NEW |