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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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."); |
88 return; | 88 return; |
89 } | 89 } |
90 | 90 |
91 HTMLSelectElement& select = toHTMLSelectElement(ownerNode()); | 91 HTMLSelectElement& select = toHTMLSelectElement(ownerNode()); |
92 | 92 |
93 if (index == -1 || unsigned(index) >= length()) | 93 if (index == -1 || unsigned(index) >= length()) |
94 select.add(newOption, 0, exceptionState); | 94 select.add(newOption, 0, exceptionState); |
95 else | 95 else |
96 select.add(newOption, toHTMLOptionElement(item(index)), exceptionState); | 96 select.addBeforeOptionAtIndex(newOption, unsigned(index), exceptionState ); |
tkent
2014/03/27 06:13:35
Do not use C-style cast.
keishi
2014/03/27 06:52:03
Done.
| |
97 | 97 |
98 ASSERT(!exceptionState.hadException()); | 98 ASSERT(!exceptionState.hadException()); |
99 } | 99 } |
100 | 100 |
101 void HTMLOptionsCollection::remove(int index) | 101 void HTMLOptionsCollection::remove(int index) |
102 { | 102 { |
103 toHTMLSelectElement(ownerNode()).remove(index); | 103 toHTMLSelectElement(ownerNode()).remove(index); |
104 } | 104 } |
105 | 105 |
106 void HTMLOptionsCollection::remove(HTMLOptionElement* option) | 106 void HTMLOptionsCollection::remove(HTMLOptionElement* option) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |