| 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 if (multiple()) | 880 if (multiple()) |
| 881 return; | 881 return; |
| 882 HTMLOptionElement* firstEnabledOption = nullptr; | 882 HTMLOptionElement* firstEnabledOption = nullptr; |
| 883 int firstEnabledOptionIndex = -1; | 883 int firstEnabledOptionIndex = -1; |
| 884 HTMLOptionElement* lastSelectedOption = nullptr; | 884 HTMLOptionElement* lastSelectedOption = nullptr; |
| 885 bool didChange = false; | 885 bool didChange = false; |
| 886 int optionIndex = 0; | 886 int optionIndex = 0; |
| 887 // We can't use HTMLSelectElement::options here because this function is | 887 // We can't use HTMLSelectElement::options here because this function is |
| 888 // called in Node::insertedInto and Node::removedFrom before invalidating | 888 // called in Node::insertedInto and Node::removedFrom before invalidating |
| 889 // node collections. | 889 // node collections. |
| 890 for (auto& item : listItems()) { | 890 for (const auto& option : optionList()) { |
| 891 if (!isHTMLOptionElement(item)) | |
| 892 continue; | |
| 893 HTMLOptionElement* option = toHTMLOptionElement(item); | |
| 894 if (option->selected()) { | 891 if (option->selected()) { |
| 895 if (lastSelectedOption) { | 892 if (lastSelectedOption) { |
| 896 lastSelectedOption->setSelectedState(false); | 893 lastSelectedOption->setSelectedState(false); |
| 897 didChange = true; | 894 didChange = true; |
| 898 } | 895 } |
| 899 lastSelectedOption = option; | 896 lastSelectedOption = option; |
| 900 } | 897 } |
| 901 if (!firstEnabledOption && !option->isDisabledFormControl()) { | 898 if (!firstEnabledOption && !option->isDisabledFormControl()) { |
| 902 firstEnabledOption = option; | 899 firstEnabledOption = option; |
| 903 firstEnabledOptionIndex = optionIndex; | 900 firstEnabledOptionIndex = optionIndex; |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 } | 2127 } |
| 2131 | 2128 |
| 2132 void HTMLSelectElement::didMutateSubtree() | 2129 void HTMLSelectElement::didMutateSubtree() |
| 2133 { | 2130 { |
| 2134 DCHECK(popupIsVisible()); | 2131 DCHECK(popupIsVisible()); |
| 2135 DCHECK(m_popup); | 2132 DCHECK(m_popup); |
| 2136 m_popup->updateFromElement(PopupMenu::ByDOMChange); | 2133 m_popup->updateFromElement(PopupMenu::ByDOMChange); |
| 2137 } | 2134 } |
| 2138 | 2135 |
| 2139 } // namespace blink | 2136 } // namespace blink |
| OLD | NEW |