Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSelectElement.cpp

Issue 2372913002: fixed <select> element isn't updated after its single option removing. (Closed)
Patch Set: remove anchor element and adjunst some indents Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/select/select-remove-option-single-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 } 829 }
830 if (!firstEnabledOption && !option->isDisabledFormControl()) { 830 if (!firstEnabledOption && !option->isDisabledFormControl()) {
831 firstEnabledOption = option; 831 firstEnabledOption = option;
832 if (reason == ResetReasonSelectedOptionRemoved) { 832 if (reason == ResetReasonSelectedOptionRemoved) {
833 // There must be no selected OPTIONs. 833 // There must be no selected OPTIONs.
834 break; 834 break;
835 } 835 }
836 } 836 }
837 ++optionIndex; 837 ++optionIndex;
838 } 838 }
839 if (!lastSelectedOption && m_size <= 1 && firstEnabledOption && !firstEnable dOption->selected()) { 839 if (!lastSelectedOption && m_size <= 1 && (!firstEnabledOption || (firstEnab ledOption && !firstEnabledOption->selected()))) {
840 selectOption(firstEnabledOption, reason == ResetReasonSelectedOptionRemo ved ? 0 : DeselectOtherOptions); 840 selectOption(firstEnabledOption, reason == ResetReasonSelectedOptionRemo ved ? 0 : DeselectOtherOptions);
841 lastSelectedOption = firstEnabledOption; 841 lastSelectedOption = firstEnabledOption;
842 didChange = true; 842 didChange = true;
843 } 843 }
844 if (didChange) 844 if (didChange)
845 setNeedsValidityCheck(); 845 setNeedsValidityCheck();
846 m_lastOnChangeOption = lastSelectedOption; 846 m_lastOnChangeOption = lastSelectedOption;
847 } 847 }
848 848
849 HTMLOptionElement* HTMLSelectElement::selectedOption() const 849 HTMLOptionElement* HTMLSelectElement::selectedOption() const
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 } 2024 }
2025 2025
2026 void HTMLSelectElement::didMutateSubtree() 2026 void HTMLSelectElement::didMutateSubtree()
2027 { 2027 {
2028 DCHECK(popupIsVisible()); 2028 DCHECK(popupIsVisible());
2029 DCHECK(m_popup); 2029 DCHECK(m_popup);
2030 m_popup->updateFromElement(PopupMenu::ByDOMChange); 2030 m_popup->updateFromElement(PopupMenu::ByDOMChange);
2031 } 2031 }
2032 2032
2033 } // namespace blink 2033 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/select/select-remove-option-single-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698