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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 if (m_activeSelectionEndIndex >= 0) | 197 if (m_activeSelectionEndIndex >= 0) |
198 return m_activeSelectionEndIndex; | 198 return m_activeSelectionEndIndex; |
199 return lastSelectedListIndex(); | 199 return lastSelectedListIndex(); |
200 } | 200 } |
201 | 201 |
202 void HTMLSelectElement::add(HTMLElement* element, HTMLElement* before, Exception
State& exceptionState) | 202 void HTMLSelectElement::add(HTMLElement* element, HTMLElement* before, Exception
State& exceptionState) |
203 { | 203 { |
204 // Make sure the element is ref'd and deref'd so we don't leak it. | 204 // Make sure the element is ref'd and deref'd so we don't leak it. |
205 RefPtr<HTMLElement> protectNewChild(element); | 205 RefPtr<HTMLElement> protectNewChild(element); |
206 | 206 |
207 if (!element || !(isHTMLOptionElement(element) || isHTMLHRElement(element))) | 207 if (!element || !(isHTMLOptionElement(element) || isHTMLOptGroupElement(elem
ent) || isHTMLHRElement(element))) |
208 return; | 208 return; |
209 | 209 |
210 insertBefore(element, before, exceptionState); | 210 insertBefore(element, before, exceptionState); |
211 setNeedsValidityCheck(); | 211 setNeedsValidityCheck(); |
212 } | 212 } |
213 | 213 |
| 214 void HTMLSelectElement::addBeforeOptionAtIndex(HTMLElement* element, int beforeI
ndex, ExceptionState& exceptionState) |
| 215 { |
| 216 HTMLElement* beforeElement = toHTMLElement(options()->item(beforeIndex)); |
| 217 add(element, beforeElement, exceptionState); |
| 218 } |
| 219 |
214 void HTMLSelectElement::remove(int optionIndex) | 220 void HTMLSelectElement::remove(int optionIndex) |
215 { | 221 { |
216 int listIndex = optionToListIndex(optionIndex); | 222 int listIndex = optionToListIndex(optionIndex); |
217 if (listIndex < 0) | 223 if (listIndex < 0) |
218 return; | 224 return; |
219 | 225 |
220 listItems()[listIndex]->remove(IGNORE_EXCEPTION); | 226 listItems()[listIndex]->remove(IGNORE_EXCEPTION); |
221 } | 227 } |
222 | 228 |
223 String HTMLSelectElement::value() const | 229 String HTMLSelectElement::value() const |
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 { | 1639 { |
1634 return true; | 1640 return true; |
1635 } | 1641 } |
1636 | 1642 |
1637 bool HTMLSelectElement::supportsAutofocus() const | 1643 bool HTMLSelectElement::supportsAutofocus() const |
1638 { | 1644 { |
1639 return true; | 1645 return true; |
1640 } | 1646 } |
1641 | 1647 |
1642 } // namespace | 1648 } // namespace |
OLD | NEW |