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

Unified Diff: Source/core/html/forms/BaseDateAndTimeInputType.cpp

Issue 83413002: Derive the step base for an input element as (now) specified. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
Index: Source/core/html/forms/BaseDateAndTimeInputType.cpp
diff --git a/Source/core/html/forms/BaseDateAndTimeInputType.cpp b/Source/core/html/forms/BaseDateAndTimeInputType.cpp
index bf87e948cc0f52c30c0bc49b9912411dd1313c28..33a7ab77c0fbd0ffca314c81c2767aebddd701a1 100644
--- a/Source/core/html/forms/BaseDateAndTimeInputType.cpp
+++ b/Source/core/html/forms/BaseDateAndTimeInputType.cpp
@@ -60,7 +60,7 @@ void BaseDateAndTimeInputType::setValueAsDate(double value, ExceptionState&) con
double BaseDateAndTimeInputType::valueAsDouble() const
{
- const Decimal value = parseToNumber(element().value(), Decimal::nan());
+ const Decimal value = parseToNumber(element().value(), String(), Decimal::nan());
return value.isFinite() ? value.toDouble() : DateComponents::invalidMilliseconds();
}
@@ -103,10 +103,10 @@ bool BaseDateAndTimeInputType::isSteppable() const
return true;
}
-Decimal BaseDateAndTimeInputType::parseToNumber(const String& source, const Decimal& defaultValue) const
+Decimal BaseDateAndTimeInputType::parseToNumber(const String& source, const String& alternative, const Decimal& defaultValue) const
{
DateComponents date;
- if (!parseToDateComponents(source, &date))
+ if (!parseToDateComponents(source, &date) && !parseToDateComponents(alternative, &date))
return defaultValue;
double msec = date.millisecondsSinceEpoch();
ASSERT(std::isfinite(msec));

Powered by Google App Engine
This is Rietveld 408576698