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 r
ights reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 2011, 2012 Apple Inc. All r
ights reserved. |
5 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 5 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 cache->addElementWithId(idAttrVal, element); | 186 cache->addElementWithId(idAttrVal, element); |
187 if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && !foundInpu
tElements.contains(nameAttrVal.impl())) | 187 if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && !foundInpu
tElements.contains(nameAttrVal.impl())) |
188 cache->addElementWithName(nameAttrVal, element); | 188 cache->addElementWithName(nameAttrVal, element); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 // Set the named item cache last as traversing the tree may cause cache inva
lidation. | 192 // Set the named item cache last as traversing the tree may cause cache inva
lidation. |
193 setNamedItemCache(cache.release()); | 193 setNamedItemCache(cache.release()); |
194 } | 194 } |
195 | 195 |
196 void HTMLFormControlsCollection::namedGetter(const AtomicString& name, bool& rad
ioNodeListEnabled, RefPtrWillBeRawPtr<RadioNodeList>& radioNodeList, bool& eleme
ntEnabled, RefPtrWillBeRawPtr<Element>& element) | 196 void HTMLFormControlsCollection::namedGetter(const AtomicString& name, RefPtrWil
lBeRawPtr<RadioNodeList>& radioNodeList, RefPtrWillBeRawPtr<Element>& element) |
197 { | 197 { |
198 WillBeHeapVector<RefPtrWillBeMember<Element> > namedItems; | 198 WillBeHeapVector<RefPtrWillBeMember<Element> > namedItems; |
199 this->namedItems(name, namedItems); | 199 this->namedItems(name, namedItems); |
200 | 200 |
201 if (namedItems.isEmpty()) | 201 if (namedItems.isEmpty()) |
202 return; | 202 return; |
203 | 203 |
204 if (namedItems.size() == 1) { | 204 if (namedItems.size() == 1) { |
205 elementEnabled = true; | |
206 element = namedItems.at(0); | 205 element = namedItems.at(0); |
207 return; | 206 return; |
208 } | 207 } |
209 | 208 |
210 radioNodeListEnabled = true; | |
211 radioNodeList = ownerNode().radioNodeList(name); | 209 radioNodeList = ownerNode().radioNodeList(name); |
212 } | 210 } |
213 | 211 |
214 void HTMLFormControlsCollection::supportedPropertyNames(Vector<String>& names) | 212 void HTMLFormControlsCollection::supportedPropertyNames(Vector<String>& names) |
215 { | 213 { |
216 // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-in
terfaces.html#htmlformcontrolscollection-0: | 214 // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-in
terfaces.html#htmlformcontrolscollection-0: |
217 // The supported property names consist of the non-empty values of all the i
d and name attributes | 215 // The supported property names consist of the non-empty values of all the i
d and name attributes |
218 // of all the elements represented by the collection, in tree order, ignorin
g later duplicates, | 216 // of all the elements represented by the collection, in tree order, ignorin
g later duplicates, |
219 // with the id of an element preceding its name if it contributes both, they
differ from each | 217 // with the id of an element preceding its name if it contributes both, they
differ from each |
220 // other, and neither is the duplicate of an earlier entry. | 218 // other, and neither is the duplicate of an earlier entry. |
(...skipping 17 matching lines...) Expand all Loading... |
238 } | 236 } |
239 } | 237 } |
240 | 238 |
241 void HTMLFormControlsCollection::trace(Visitor* visitor) | 239 void HTMLFormControlsCollection::trace(Visitor* visitor) |
242 { | 240 { |
243 visitor->trace(m_cachedElement); | 241 visitor->trace(m_cachedElement); |
244 HTMLCollection::trace(visitor); | 242 HTMLCollection::trace(visitor); |
245 } | 243 } |
246 | 244 |
247 } | 245 } |
OLD | NEW |