| 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. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 * | 21 * |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 #include "core/html/HTMLFormControlsCollection.h" | 25 #include "core/html/HTMLFormControlsCollection.h" |
| 26 | 26 |
| 27 #include "bindings/core/v8/UnionTypesCore.h" |
| 27 #include "core/HTMLNames.h" | 28 #include "core/HTMLNames.h" |
| 28 #include "core/frame/UseCounter.h" | 29 #include "core/frame/UseCounter.h" |
| 29 #include "core/html/HTMLFieldSetElement.h" | 30 #include "core/html/HTMLFieldSetElement.h" |
| 30 #include "core/html/HTMLFormElement.h" | 31 #include "core/html/HTMLFormElement.h" |
| 31 #include "core/html/HTMLImageElement.h" | 32 #include "core/html/HTMLImageElement.h" |
| 32 #include "wtf/HashSet.h" | 33 #include "wtf/HashSet.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 using namespace HTMLNames; | 37 using namespace HTMLNames; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 cache->addElementWithId(idAttrVal, element); | 186 cache->addElementWithId(idAttrVal, element); |
| 186 if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && !foundInpu
tElements.contains(nameAttrVal.impl())) | 187 if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && !foundInpu
tElements.contains(nameAttrVal.impl())) |
| 187 cache->addElementWithName(nameAttrVal, element); | 188 cache->addElementWithName(nameAttrVal, element); |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 | 191 |
| 191 // 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. |
| 192 setNamedItemCache(cache.release()); | 193 setNamedItemCache(cache.release()); |
| 193 } | 194 } |
| 194 | 195 |
| 195 void HTMLFormControlsCollection::namedGetter(const AtomicString& name, RefPtrWil
lBeRawPtr<RadioNodeList>& radioNodeList, RefPtrWillBeRawPtr<Element>& element) | 196 void HTMLFormControlsCollection::namedGetter(const AtomicString& name, RadioNode
ListOrElement& returnValue) |
| 196 { | 197 { |
| 197 WillBeHeapVector<RefPtrWillBeMember<Element> > namedItems; | 198 WillBeHeapVector<RefPtrWillBeMember<Element> > namedItems; |
| 198 this->namedItems(name, namedItems); | 199 this->namedItems(name, namedItems); |
| 199 | 200 |
| 200 if (namedItems.isEmpty()) | 201 if (namedItems.isEmpty()) |
| 201 return; | 202 return; |
| 202 | 203 |
| 203 if (namedItems.size() == 1) { | 204 if (namedItems.size() == 1) { |
| 204 element = namedItems.at(0); | 205 returnValue.setElement(namedItems.at(0)); |
| 205 return; | 206 return; |
| 206 } | 207 } |
| 207 | 208 |
| 208 radioNodeList = ownerNode().radioNodeList(name); | 209 returnValue.setRadioNodeList(ownerNode().radioNodeList(name)); |
| 209 } | 210 } |
| 210 | 211 |
| 211 void HTMLFormControlsCollection::supportedPropertyNames(Vector<String>& names) | 212 void HTMLFormControlsCollection::supportedPropertyNames(Vector<String>& names) |
| 212 { | 213 { |
| 213 // 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: |
| 214 // 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 |
| 215 // 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, |
| 216 // 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 |
| 217 // other, and neither is the duplicate of an earlier entry. | 218 // other, and neither is the duplicate of an earlier entry. |
| 218 HashSet<AtomicString> existingNames; | 219 HashSet<AtomicString> existingNames; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 235 } | 236 } |
| 236 } | 237 } |
| 237 | 238 |
| 238 void HTMLFormControlsCollection::trace(Visitor* visitor) | 239 void HTMLFormControlsCollection::trace(Visitor* visitor) |
| 239 { | 240 { |
| 240 visitor->trace(m_cachedElement); | 241 visitor->trace(m_cachedElement); |
| 241 HTMLCollection::trace(visitor); | 242 HTMLCollection::trace(visitor); |
| 242 } | 243 } |
| 243 | 244 |
| 244 } | 245 } |
| OLD | NEW |