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

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

Issue 23623017: Prepare for date/time input datalist support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed Created 7 years, 1 month 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
« no previous file with comments | « no previous file | Source/platform/DateTimeChooser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLInputElement.cpp
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index c35f154fd81cdb6d015e4ea478b9121db9dec279..25ee045f193cc0922abe660961518af7d4118d06 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -1845,9 +1845,13 @@ bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters&
for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(options->item(i)); ++i) {
if (!isValidValue(option->value()))
continue;
- parameters.suggestionValues.append(sanitizeValue(option->value()));
- parameters.localizedSuggestionValues.append(localizeValue(option->value()));
- parameters.suggestionLabels.append(option->value() == option->label() ? String() : option->label());
+ DateTimeSuggestion suggestion;
+ suggestion.value = m_inputType->parseToNumber(option->value(), Decimal::nan()).toDouble();
+ if (std::isnan(suggestion.value))
+ continue;
+ suggestion.localizedValue = localizeValue(option->value());
+ suggestion.label = option->value() == option->label() ? String() : option->label();
+ parameters.suggestions.append(suggestion);
}
}
}
« no previous file with comments | « no previous file | Source/platform/DateTimeChooser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698