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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 // We should check |newLen > maxListItems| first to avoid integer overflow. | 496 // We should check |newLen > maxListItems| first to avoid integer overflow. |
497 if (newLen > maxListItems || listItems().size() + newLen - length() > maxLis
tItems) { | 497 if (newLen > maxListItems || listItems().size() + newLen - length() > maxLis
tItems) { |
498 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource, War
ningMessageLevel, | 498 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource, War
ningMessageLevel, |
499 String::format("Blocked to expand the option list to %u items. The
maximum list length is %u.", newLen, maxListItems))); | 499 String::format("Blocked to expand the option list to %u items. The
maximum list length is %u.", newLen, maxListItems))); |
500 return; | 500 return; |
501 } | 501 } |
502 int diff = length() - newLen; | 502 int diff = length() - newLen; |
503 | 503 |
504 if (diff < 0) { // Add dummy elements. | 504 if (diff < 0) { // Add dummy elements. |
505 do { | 505 do { |
506 appendChild(document().createElement(optionTag, false), exceptionSta
te); | 506 appendChild(document().createElement(optionTag, CreatedByCreateEleme
nt), exceptionState); |
507 if (exceptionState.hadException()) | 507 if (exceptionState.hadException()) |
508 break; | 508 break; |
509 } while (++diff); | 509 } while (++diff); |
510 } else { | 510 } else { |
511 // Removing children fires mutation events, which might mutate the DOM | 511 // Removing children fires mutation events, which might mutate the DOM |
512 // further, so we first copy out a list of elements that we intend to | 512 // further, so we first copy out a list of elements that we intend to |
513 // remove then attempt to remove them one at a time. | 513 // remove then attempt to remove them one at a time. |
514 HeapVector<Member<Element>> itemsToRemove; | 514 HeapVector<Member<Element>> itemsToRemove; |
515 size_t optionIndex = 0; | 515 size_t optionIndex = 0; |
516 for (auto& item : listItems()) { | 516 for (auto& item : listItems()) { |
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2063 } | 2063 } |
2064 | 2064 |
2065 void HTMLSelectElement::didMutateSubtree() | 2065 void HTMLSelectElement::didMutateSubtree() |
2066 { | 2066 { |
2067 DCHECK(popupIsVisible()); | 2067 DCHECK(popupIsVisible()); |
2068 DCHECK(m_popup); | 2068 DCHECK(m_popup); |
2069 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2069 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
2070 } | 2070 } |
2071 | 2071 |
2072 } // namespace blink | 2072 } // namespace blink |
OLD | NEW |