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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 if (!exceptionState.hadException()) { | 479 if (!exceptionState.hadException()) { |
480 add(element, before, exceptionState); | 480 add(element, before, exceptionState); |
481 if (diff >= 0 && option->selected()) | 481 if (diff >= 0 && option->selected()) |
482 optionSelectionStateChanged(option, true); | 482 optionSelectionStateChanged(option, true); |
483 } | 483 } |
484 } | 484 } |
485 | 485 |
486 void HTMLSelectElement::setLength(unsigned newLen, ExceptionState& exceptionStat
e) | 486 void HTMLSelectElement::setLength(unsigned newLen, ExceptionState& exceptionStat
e) |
487 { | 487 { |
488 if (newLen > maxSelectItems) | 488 if (newLen > maxSelectItems) |
489 newLen = maxSelectItems; | 489 return; |
490 int diff = length() - newLen; | 490 int diff = length() - newLen; |
491 | 491 |
492 if (diff < 0) { // Add dummy elements. | 492 if (diff < 0) { // Add dummy elements. |
493 do { | 493 do { |
494 appendChild(document().createElement(optionTag, false), exceptionSta
te); | 494 appendChild(document().createElement(optionTag, false), exceptionSta
te); |
495 if (exceptionState.hadException()) | 495 if (exceptionState.hadException()) |
496 break; | 496 break; |
497 } while (++diff); | 497 } while (++diff); |
498 } else { | 498 } else { |
499 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& items = listIte
ms(); | 499 const WillBeHeapVector<RawPtrWillBeMember<HTMLElement>>& items = listIte
ms(); |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 int focusedIndex = activeSelectionEndListIndex(); | 1780 int focusedIndex = activeSelectionEndListIndex(); |
1781 if (focusedIndex < 0) | 1781 if (focusedIndex < 0) |
1782 focusedIndex = firstSelectableListIndex(); | 1782 focusedIndex = firstSelectableListIndex(); |
1783 if (focusedIndex < 0) | 1783 if (focusedIndex < 0) |
1784 return nullptr; | 1784 return nullptr; |
1785 HTMLElement* focused = listItems()[focusedIndex]; | 1785 HTMLElement* focused = listItems()[focusedIndex]; |
1786 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; | 1786 return isHTMLOptionElement(focused) ? toHTMLOptionElement(focused) : nullptr
; |
1787 } | 1787 } |
1788 | 1788 |
1789 } // namespace | 1789 } // namespace |
OLD | NEW |