| 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 element.setHTMLOptionElement(option); | 422 element.setHTMLOptionElement(option); |
| 423 HTMLElementOrLong before; | 423 HTMLElementOrLong before; |
| 424 // Out of array bounds? First insert empty dummies. | 424 // Out of array bounds? First insert empty dummies. |
| 425 if (diff > 0) { | 425 if (diff > 0) { |
| 426 setLength(index, exceptionState); | 426 setLength(index, exceptionState); |
| 427 // Replace an existing entry? | 427 // Replace an existing entry? |
| 428 } else if (diff < 0) { | 428 } else if (diff < 0) { |
| 429 before.setHTMLElement(options()->item(index + 1)); | 429 before.setHTMLElement(options()->item(index + 1)); |
| 430 remove(index); | 430 remove(index); |
| 431 } | 431 } |
| 432 if (exceptionState.hadException()) |
| 433 return; |
| 432 // Finally add the new element. | 434 // Finally add the new element. |
| 433 if (!exceptionState.hadException()) { | 435 EventQueueScope scope; |
| 434 add(element, before, exceptionState); | 436 add(element, before, exceptionState); |
| 435 if (diff >= 0 && option->selected()) | 437 if (diff >= 0 && option->selected()) |
| 436 optionSelectionStateChanged(option, true); | 438 optionSelectionStateChanged(option, true); |
| 437 } | |
| 438 } | 439 } |
| 439 | 440 |
| 440 void HTMLSelectElement::setLength(unsigned newLen, ExceptionState& exceptionStat
e) | 441 void HTMLSelectElement::setLength(unsigned newLen, ExceptionState& exceptionStat
e) |
| 441 { | 442 { |
| 442 // We should check |newLen > maxListItems| first to avoid integer overflow. | 443 // We should check |newLen > maxListItems| first to avoid integer overflow. |
| 443 if (newLen > maxListItems || listItems().size() + newLen - length() > maxLis
tItems) { | 444 if (newLen > maxListItems || listItems().size() + newLen - length() > maxLis
tItems) { |
| 444 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource, War
ningMessageLevel, | 445 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource, War
ningMessageLevel, |
| 445 String::format("Blocked to expand the option list to %u items. The
maximum list length is %u.", newLen, maxListItems))); | 446 String::format("Blocked to expand the option list to %u items. The
maximum list length is %u.", newLen, maxListItems))); |
| 446 return; | 447 return; |
| 447 } | 448 } |
| (...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2038 } | 2039 } |
| 2039 | 2040 |
| 2040 void HTMLSelectElement::didMutateSubtree() | 2041 void HTMLSelectElement::didMutateSubtree() |
| 2041 { | 2042 { |
| 2042 DCHECK(popupIsVisible()); | 2043 DCHECK(popupIsVisible()); |
| 2043 DCHECK(m_popup); | 2044 DCHECK(m_popup); |
| 2044 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2045 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
| 2045 } | 2046 } |
| 2046 | 2047 |
| 2047 } // namespace blink | 2048 } // namespace blink |
| OLD | NEW |