OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2011, 2012 Apple Computer, Inc. | 2 * Copyright (C) 2006, 2011, 2012 Apple Computer, Inc. |
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 void HTMLOptionsCollection::setSelectedIndex(int index) | 111 void HTMLOptionsCollection::setSelectedIndex(int index) |
112 { | 112 { |
113 toHTMLSelectElement(ownerNode()).setSelectedIndex(index); | 113 toHTMLSelectElement(ownerNode()).setSelectedIndex(index); |
114 } | 114 } |
115 | 115 |
116 void HTMLOptionsCollection::setLength(unsigned length, ExceptionState& exception
State) | 116 void HTMLOptionsCollection::setLength(unsigned length, ExceptionState& exception
State) |
117 { | 117 { |
118 toHTMLSelectElement(ownerNode()).setLength(length, exceptionState); | 118 toHTMLSelectElement(ownerNode()).setLength(length, exceptionState); |
119 } | 119 } |
120 | 120 |
121 void HTMLOptionsCollection::namedGetter(const AtomicString& name, bool& returnVa
lue0Enabled, RefPtrWillBeRawPtr<NodeList>& returnValue0, bool& returnValue1Enabl
ed, RefPtrWillBeRawPtr<Element>& returnValue1) | 121 void HTMLOptionsCollection::namedGetter(const AtomicString& name, Nullable<RefPt
rWillBeRawPtr<NodeList> >& returnValue0, Nullable<RefPtrWillBeRawPtr<Element> >&
returnValue1) |
122 { | 122 { |
123 WillBeHeapVector<RefPtrWillBeMember<Element> > namedItems; | 123 WillBeHeapVector<RefPtrWillBeMember<Element> > namedItems; |
124 this->namedItems(name, namedItems); | 124 this->namedItems(name, namedItems); |
125 | 125 |
126 if (!namedItems.size()) | 126 if (!namedItems.size()) |
127 return; | 127 return; |
128 | 128 |
129 if (namedItems.size() == 1) { | 129 if (namedItems.size() == 1) { |
130 returnValue1Enabled = true; | 130 returnValue1.set(namedItems.at(0)); |
131 returnValue1 = namedItems.at(0); | |
132 return; | 131 return; |
133 } | 132 } |
134 | 133 |
135 // FIXME: The spec and Firefox do not return a NodeList. They always return
the first matching Element. | 134 // FIXME: The spec and Firefox do not return a NodeList. They always return
the first matching Element. |
136 returnValue0Enabled = true; | 135 returnValue0.set(StaticElementList::adopt(namedItems)); |
137 returnValue0 = StaticElementList::adopt(namedItems); | |
138 } | 136 } |
139 | 137 |
140 bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtrWil
lBeRawPtr<HTMLOptionElement> value, ExceptionState& exceptionState) | 138 bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtrWil
lBeRawPtr<HTMLOptionElement> value, ExceptionState& exceptionState) |
141 { | 139 { |
142 HTMLSelectElement& base = toHTMLSelectElement(ownerNode()); | 140 HTMLSelectElement& base = toHTMLSelectElement(ownerNode()); |
143 if (!value) { // undefined or null | 141 if (!value) { // undefined or null |
144 base.remove(index); | 142 base.remove(index); |
145 return true; | 143 return true; |
146 } | 144 } |
147 base.setOption(index, value.get(), exceptionState); | 145 base.setOption(index, value.get(), exceptionState); |
148 return true; | 146 return true; |
149 } | 147 } |
150 | 148 |
151 } //namespace | 149 } //namespace |
152 | 150 |
OLD | NEW |