OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
4 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 4 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights
reserved. |
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
10 * | 10 * |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if (m_activeSelectionEndIndex >= 0) | 196 if (m_activeSelectionEndIndex >= 0) |
197 return m_activeSelectionEndIndex; | 197 return m_activeSelectionEndIndex; |
198 return lastSelectedListIndex(); | 198 return lastSelectedListIndex(); |
199 } | 199 } |
200 | 200 |
201 void HTMLSelectElement::add(HTMLElement* element, HTMLElement* before, Exception
State& exceptionState) | 201 void HTMLSelectElement::add(HTMLElement* element, HTMLElement* before, Exception
State& exceptionState) |
202 { | 202 { |
203 // Make sure the element is ref'd and deref'd so we don't leak it. | 203 // Make sure the element is ref'd and deref'd so we don't leak it. |
204 RefPtr<HTMLElement> protectNewChild(element); | 204 RefPtr<HTMLElement> protectNewChild(element); |
205 | 205 |
206 if (!element || !(isHTMLOptionElement(element) || isHTMLHRElement(element))) | 206 if (!element || !(isHTMLOptionElement(element) || isHTMLOptGroupElement(elem
ent) || isHTMLHRElement(element))) |
207 return; | 207 return; |
208 | 208 |
209 insertBefore(element, before, exceptionState); | 209 insertBefore(element, before, exceptionState); |
210 setNeedsValidityCheck(); | 210 setNeedsValidityCheck(); |
211 } | 211 } |
212 | 212 |
| 213 void HTMLSelectElement::addBeforeOptionAtIndex(HTMLElement* element, unsigned be
foreIndex, ExceptionState& exceptionState) |
| 214 { |
| 215 HTMLElement* beforeElement = toHTMLElement(options()->item(beforeIndex)); |
| 216 add(element, beforeElement, exceptionState); |
| 217 } |
| 218 |
213 void HTMLSelectElement::remove(int optionIndex) | 219 void HTMLSelectElement::remove(int optionIndex) |
214 { | 220 { |
215 int listIndex = optionToListIndex(optionIndex); | 221 int listIndex = optionToListIndex(optionIndex); |
216 if (listIndex < 0) | 222 if (listIndex < 0) |
217 return; | 223 return; |
218 | 224 |
219 listItems()[listIndex]->remove(IGNORE_EXCEPTION); | 225 listItems()[listIndex]->remove(IGNORE_EXCEPTION); |
220 } | 226 } |
221 | 227 |
222 String HTMLSelectElement::value() const | 228 String HTMLSelectElement::value() const |
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 { | 1623 { |
1618 return true; | 1624 return true; |
1619 } | 1625 } |
1620 | 1626 |
1621 bool HTMLSelectElement::supportsAutofocus() const | 1627 bool HTMLSelectElement::supportsAutofocus() const |
1622 { | 1628 { |
1623 return true; | 1629 return true; |
1624 } | 1630 } |
1625 | 1631 |
1626 } // namespace | 1632 } // namespace |
OLD | NEW |