| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 names.append(nameAttribute); | 62 names.append(nameAttribute); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 | 66 |
| 67 PassRefPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(ContainerNode& s
elect, CollectionType) | 67 PassRefPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(ContainerNode& s
elect, CollectionType) |
| 68 { | 68 { |
| 69 return adoptRef(new HTMLOptionsCollection(select)); | 69 return adoptRef(new HTMLOptionsCollection(select)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, Exception
State& exceptionState) | 72 void HTMLOptionsCollection::add(PassRefPtrWillBeRawPtr<HTMLOptionElement> elemen
t, ExceptionState& exceptionState) |
| 73 { | 73 { |
| 74 add(element, length(), exceptionState); | 74 add(element, length(), exceptionState); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index
, ExceptionState& exceptionState) | 77 void HTMLOptionsCollection::add(PassRefPtrWillBeRawPtr<HTMLOptionElement> elemen
t, int index, ExceptionState& exceptionState) |
| 78 { | 78 { |
| 79 HTMLOptionElement* newOption = element.get(); | 79 HTMLOptionElement* newOption = element.get(); |
| 80 | 80 |
| 81 if (!newOption) { | 81 if (!newOption) { |
| 82 exceptionState.throwTypeError("The element provided was not an HTMLOptio
nElement."); | 82 exceptionState.throwTypeError("The element provided was not an HTMLOptio
nElement."); |
| 83 return; | 83 return; |
| 84 } | 84 } |
| 85 | 85 |
| 86 if (index < -1) { | 86 if (index < -1) { |
| 87 exceptionState.throwDOMException(IndexSizeError, "The index provided ("
+ String::number(index) + ") is less than -1."); | 87 exceptionState.throwDOMException(IndexSizeError, "The index provided ("
+ String::number(index) + ") is less than -1."); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 returnValue1Enabled = true; | 135 returnValue1Enabled = true; |
| 136 returnValue1 = namedItems.at(0); | 136 returnValue1 = namedItems.at(0); |
| 137 return; | 137 return; |
| 138 } | 138 } |
| 139 | 139 |
| 140 // FIXME: The spec and Firefox do not return a NodeList. They always return
the first matching Element. | 140 // FIXME: The spec and Firefox do not return a NodeList. They always return
the first matching Element. |
| 141 returnValue0Enabled = true; | 141 returnValue0Enabled = true; |
| 142 returnValue0 = NamedNodesCollection::create(namedItems); | 142 returnValue0 = NamedNodesCollection::create(namedItems); |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtr<HT
MLOptionElement> value, ExceptionState& exceptionState) | 145 bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtrWil
lBeRawPtr<HTMLOptionElement> value, ExceptionState& exceptionState) |
| 146 { | 146 { |
| 147 HTMLSelectElement& base = toHTMLSelectElement(ownerNode()); | 147 HTMLSelectElement& base = toHTMLSelectElement(ownerNode()); |
| 148 if (!value) { // undefined or null | 148 if (!value) { // undefined or null |
| 149 base.remove(index); | 149 base.remove(index); |
| 150 return true; | 150 return true; |
| 151 } | 151 } |
| 152 base.setOption(index, value.get(), exceptionState); | 152 base.setOption(index, value.get(), exceptionState); |
| 153 return true; | 153 return true; |
| 154 } | 154 } |
| 155 | 155 |
| 156 } //namespace | 156 } //namespace |
| 157 | 157 |
| OLD | NEW |