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

Unified Diff: third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Issue 2746823002: Correct elementMatches filter for datalist.options (Closed)
Patch Set: Remove superfluous test, added filter to callees. Created 3 years, 9 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/HTMLInputElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
index 677a9f86819cd94e5a8368f7b80a46ad5fb59109..95e2f189b7c0a3c95992000804b9dec31424b65b 100644
--- a/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLInputElement.cpp
@@ -1558,7 +1558,8 @@ bool HTMLInputElement::hasValidDataListOptions() const {
return false;
HTMLDataListOptionsCollection* options = dataList->options();
for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) {
- if (isValidValue(option->value()))
+ if (!option->value().isEmpty() && !option->isDisabledFormControl() &&
+ isValidValue(option->value()))
return true;
}
return false;
@@ -1593,7 +1594,8 @@ HTMLInputElement::filteredDataListOptions() const {
continue;
}
// TODO(tkent): Should allow invalid strings. crbug.com/607097.
- if (!isValidValue(option->value()))
+ if (option->value().isEmpty() || option->isDisabledFormControl() ||
+ !isValidValue(option->value()))
continue;
filtered.push_back(option);
}
@@ -1816,7 +1818,8 @@ bool HTMLInputElement::setupDateTimeChooserParameters(
if (HTMLDataListElement* dataList = this->dataList()) {
HTMLDataListOptionsCollection* options = dataList->options();
for (unsigned i = 0; HTMLOptionElement* option = options->item(i); ++i) {
- if (!isValidValue(option->value()))
+ if (option->value().isEmpty() || option->isDisabledFormControl() ||
+ !isValidValue(option->value()))
continue;
DateTimeSuggestion suggestion;
suggestion.value =

Powered by Google App Engine
This is Rietveld 408576698