| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2011, 2012 Apple Computer, Inc. | 2 * Copyright (C) 2006, 2011, 2012 Apple Computer, Inc. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, Exception
State& es) | 44 void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, Exception
State& es) |
| 45 { | 45 { |
| 46 add(element, length(), es); | 46 add(element, length(), es); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index
, ExceptionState& es) | 49 void HTMLOptionsCollection::add(PassRefPtr<HTMLOptionElement> element, int index
, ExceptionState& es) |
| 50 { | 50 { |
| 51 HTMLOptionElement* newOption = element.get(); | 51 HTMLOptionElement* newOption = element.get(); |
| 52 | 52 |
| 53 if (!newOption) { | 53 if (!newOption) { |
| 54 es.throwDOMException(TypeMismatchError); | 54 es.throwUninformativeAndGenericDOMException(TypeMismatchError); |
| 55 return; | 55 return; |
| 56 } | 56 } |
| 57 | 57 |
| 58 if (index < -1) { | 58 if (index < -1) { |
| 59 es.throwDOMException(IndexSizeError); | 59 es.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 | 62 |
| 63 HTMLSelectElement* select = toHTMLSelectElement(ownerNode()); | 63 HTMLSelectElement* select = toHTMLSelectElement(ownerNode()); |
| 64 | 64 |
| 65 if (index == -1 || unsigned(index) >= length()) | 65 if (index == -1 || unsigned(index) >= length()) |
| 66 select->add(newOption, 0, es); | 66 select->add(newOption, 0, es); |
| 67 else | 67 else |
| 68 select->add(newOption, toHTMLOptionElement(item(index)), es); | 68 select->add(newOption, toHTMLOptionElement(item(index)), es); |
| 69 | 69 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 { | 117 { |
| 118 HTMLSelectElement* base = toHTMLSelectElement(ownerNode()); | 118 HTMLSelectElement* base = toHTMLSelectElement(ownerNode()); |
| 119 base->remove(index); | 119 base->remove(index); |
| 120 return true; | 120 return true; |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtr<HT
MLOptionElement> value, ExceptionState& es) | 123 bool HTMLOptionsCollection::anonymousIndexedSetter(unsigned index, PassRefPtr<HT
MLOptionElement> value, ExceptionState& es) |
| 124 { | 124 { |
| 125 HTMLSelectElement* base = toHTMLSelectElement(ownerNode()); | 125 HTMLSelectElement* base = toHTMLSelectElement(ownerNode()); |
| 126 if (!value) { | 126 if (!value) { |
| 127 es.throwDOMException(TypeMismatchError); | 127 es.throwUninformativeAndGenericDOMException(TypeMismatchError); |
| 128 return true; | 128 return true; |
| 129 } | 129 } |
| 130 base->setOption(index, value.get(), es); | 130 base->setOption(index, value.get(), es); |
| 131 return true; | 131 return true; |
| 132 } | 132 } |
| 133 | 133 |
| 134 } //namespace | 134 } //namespace |
| 135 | 135 |
| OLD | NEW |