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

Unified 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: add layout test Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
index a344bcde69df0cb2454ba0cc2ee0f00afd10af7c..ca017d1f0dfae2ab4d9ed49c02ccac47dec13ec6 100644
--- a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
@@ -836,7 +836,7 @@ void HTMLSelectElement::resetToDefaultSelection(ResetReason reason)
}
++optionIndex;
}
- if (!lastSelectedOption && m_size <= 1 && firstEnabledOption && !firstEnabledOption->selected()) {
+ if (!lastSelectedOption && m_size <= 1 && (!firstEnabledOption || (firstEnabledOption && !firstEnabledOption->selected()))) {
selectOption(firstEnabledOption, reason == ResetReasonSelectedOptionRemoved ? 0 : DeselectOtherOptions);
lastSelectedOption = firstEnabledOption;
didChange = true;

Powered by Google App Engine
This is Rietveld 408576698